Make InstSimplify return poison rather than undef for out-of-bounds shifts, as specified by LandRef:
If op2 is (statically or dynamically) equal to or larger than the number of bits in op1, this instruction returns a poison value.
Paths
| Differential D93998
[InstSimplify] Fold out-of-bounds shift to poison ClosedPublic Authored by nikic on Jan 3 2021, 12:13 PM.
Details Summary Make InstSimplify return poison rather than undef for out-of-bounds shifts, as specified by LandRef:
Diff Detail
Event Timeline
This revision is now accepted and ready to land.Jan 5 2021, 7:14 PM Closed by commit rGa6df39236fdc: [InstSimplify] Fold out-of-bounds shift to poison (authored by nikic). · Explain WhyJan 6 2021, 11:41 AM This revision was automatically updated to reflect the committed changes.
Revision Contents
Diff 314951 llvm/lib/Analysis/InstructionSimplify.cpp
llvm/test/Transforms/InstCombine/add-shl-sdiv-to-srem.ll
llvm/test/Transforms/InstCombine/out-of-bounds-indexes.ll
llvm/test/Transforms/InstCombine/phi-shifts.ll
llvm/test/Transforms/InstCombine/shift.ll
llvm/test/Transforms/InstSimplify/shift-knownbits.ll
llvm/test/Transforms/InstSimplify/shift.ll
llvm/test/Transforms/InstSimplify/undef.ll
|
A peculiar regression. Not sure how this folded before, but we're clearly missing a fold here: https://llvm.godbolt.org/z/89bah8 Poison can fold to poison: https://alive2.llvm.org/ce/z/7Nwdri Undef can fold to base pointer: https://alive2.llvm.org/ce/z/y6NLvJ Undef can't fold to undef: https://alive2.llvm.org/ce/z/emLp_H