diff options
author | Sanjay Patel <spatel@rotateright.com> | 2021-05-24 10:15:08 -0400 |
---|---|---|
committer | Sanjay Patel <spatel@rotateright.com> | 2021-05-24 10:34:40 -0400 |
commit | a0e71f1832d194baffb25a4e7394b623d2bf97cb (patch) | |
tree | 139db0035bf29cc2da6d919f956b83f4e24f7a54 /llvm/lib/Analysis/ConstantFolding.cpp | |
parent | 3dd206367116b5519d984fe023d098ca3bbe2307 (diff) | |
download | llvm-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.cpp | 2 |
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. |