[PATCH] D93998: [InstSimplify] Fold out-of-bounds shift to poison
Juneyoung Lee via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Jan 4 17:28:24 PST 2021
aqjune added inline comments.
================
Comment at: llvm/test/Transforms/InstCombine/shift.ll:1724
+; CHECK-NEXT: [[G18:%.*]] = getelementptr i177*, i177** [[A2:%.*]], i64 poison
+; CHECK-NEXT: store i177** [[G18]], i177*** undef, align 8
; CHECK-NEXT: ret i177 0
----------------
nikic wrote:
> 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
The source program looks really interesting - it has gep with i1 index..!
I guess %G18 should have been folded like this:
gep %A2, i1 %C8 -> gep %A2, i1 undef -> gep %A2, i64 0 (by constfold sext undef) -> gep %A2
With poison, constfold sext poison is poison, hence it resulted in here.
I'll make a patch that makes gep poison -> poison.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D93998/new/
https://reviews.llvm.org/D93998
More information about the llvm-commits
mailing list