[PATCH] D92203: [ConstantFold] Fold operations to poison if possible
Juneyoung Lee via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sat Nov 28 08:55:26 PST 2020
aqjune marked an inline comment as done.
aqjune 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;
----------------
nikic wrote:
> 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());
> ```
That's right, fixed
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