[PATCH] D92203: [ConstantFold] Fold operations to poison if possible
Juneyoung Lee via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Nov 27 04:42:18 PST 2020
aqjune added inline comments.
================
Comment at: llvm/lib/IR/ConstantFold.cpp:784
+ if (isa<PoisonValue>(Cond))
+ return PoisonValue::get(V1->getType());
+
----------------
This is poison because `select poison, ?, ?` is poison.
================
Comment at: llvm/lib/IR/ConstantFold.cpp:841
+ // extractelt poison, C -> poison
+ // extractelt C, undef -> poison
+ if (isa<PoisonValue>(Val) || isa<UndefValue>(Idx))
----------------
This is poison because undef can be folded into out-of-bounds index, which makes extractelement yield poison according to LangRef.
================
Comment at: llvm/lib/IR/ConstantFold.cpp:905
if (isa<UndefValue>(Idx))
- return UndefValue::get(Val->getType());
+ return PoisonValue::get(Val->getType());
----------------
This is poison because insertelement with out-of-bounds index yields poison.
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