aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Analysis/ConstantFolding.cpp
diff options
context:
space:
mode:
authorSanjay Patel <spatel@rotateright.com>2021-05-24 10:15:08 -0400
committerSanjay Patel <spatel@rotateright.com>2021-05-24 10:34:40 -0400
commita0e71f1832d194baffb25a4e7394b623d2bf97cb (patch)
tree139db0035bf29cc2da6d919f956b83f4e24f7a54 /llvm/lib/Analysis/ConstantFolding.cpp
parent3dd206367116b5519d984fe023d098ca3bbe2307 (diff)
downloadllvm-a0e71f1832d194baffb25a4e7394b623d2bf97cb.zip
llvm-a0e71f1832d194baffb25a4e7394b623d2bf97cb.tar.gz
llvm-a0e71f1832d194baffb25a4e7394b623d2bf97cb.tar.bz2
[ConstProp] propagate poison from vector reduction element(s) to result
This follows from the underlying logic for binops and min/max. Although it does not appear that we handle this for min/max intrinsics currently. https://alive2.llvm.org/ce/z/Kq9Xnh
Diffstat (limited to 'llvm/lib/Analysis/ConstantFolding.cpp')
-rw-r--r--llvm/lib/Analysis/ConstantFolding.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/llvm/lib/Analysis/ConstantFolding.cpp b/llvm/lib/Analysis/ConstantFolding.cpp
index 948c884..7d4fcdc 100644
--- a/llvm/lib/Analysis/ConstantFolding.cpp
+++ b/llvm/lib/Analysis/ConstantFolding.cpp
@@ -1715,7 +1715,7 @@ Constant *constantFoldVectorReduce(Intrinsic::ID IID, Constant *Op) {
return ConstantInt::get(VT->getElementType(), 0);
// This is the same as the underlying binops - poison propagates.
- if (isa<PoisonValue>(Op))
+ if (isa<PoisonValue>(Op) || Op->containsPoisonElement())
return PoisonValue::get(VT->getElementType());
// TODO: Handle undef.