[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 01:42:19 PST 2020
nikic added inline comments.
================
Comment at: llvm/lib/IR/ConstantFold.cpp:1111
+ bool IsScalarOrScalarVec = !C1->getType()->isVectorTy() || IsScalableVector;
+ if (IsScalarOrScalarVec && (isa<PoisonValue>(C1) || isa<PoisonValue>(C2)))
+ return isa<PoisonValue>(C1) ? C1 : C2;
----------------
I don't get this, why do we care about IsScalarOrScalarVec here? Isn't just this sufficient here (all binops propagate poison)?
```
if (isa<PoisonValue>(C1) || isa<PoisonValue>(C2))
return PoisonValue::get(C1->getType());
```
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