For always poison shifts, any KnownBits return value is valid. Currently we return unknown, but returning zero is generally more profitable. We had some code in ValueTracking that tried to do this, but was actually dead code.
Details
Details
Diff Detail
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
Comment Actions
Shouldn't something have simplified these shifts to poison already?
No objection to the patch.
Comment Actions
On the IR level, yes, we do that here: https://github.com/llvm/llvm-project/blob/bba9209f1d198efc7e492f0e273fff0b0a5ef060/llvm/lib/Analysis/InstructionSimplify.cpp#L1361-L1365 The changes in InstCombine are because the shift is a constant expression, so these don't get simplified (until I get around to removing support for shift expressions...) The backend doesn't have something equivalent (and probably shouldn't have it -- doesn't seem like something that is valuable enough to compute known bits for).
Comment Actions
Think this makes sense. Don't think I really have the domain knowledge to approve though.