[PATCH] D92203: [ConstantFold] Fold operations to poison if possible

Nikita Popov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Nov 28 09:17:05 PST 2020


nikic added inline comments.


================
Comment at: llvm/test/Transforms/InstSimplify/ConstProp/poison.ll:114
+  %i4 = select i1 true, i8 poison, i8 %x
+  call void (...) @use(i1 %i1, i1 %i2, i8 %i3, i8 %i4, i8* getelementptr (i8, i8* poison, i64 1))
+  ret void
----------------
aqjune wrote:
> The GEP had to be written as a constant expr because InstSimplify's SimplifyGEPInst wasn't calling llvm::ConstantFoldGetElementPtr.
It looks like it does invoke constant folding, but there is an earlier check for an undef base pointer, which also catches poison. When that is replaced to check poison first, it should work correctly.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D92203/new/

https://reviews.llvm.org/D92203



More information about the llvm-commits mailing list