aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Analysis/ConstantFolding.cpp
diff options
context:
space:
mode:
authorPedro Lobo <pedro.lobo@tecnico.ulisboa.pt>2024-12-04 18:41:05 +0000
committerGitHub <noreply@github.com>2024-12-04 18:41:05 +0000
commit0d1e762da7ad22e31e98cf372a692027ff0bb610 (patch)
treec994ad86fd22582126cbe447666fd6fbed4ad7a9 /llvm/lib/Analysis/ConstantFolding.cpp
parentfd02693fb61ecc7630c66f9bad62bcdb143b9b91 (diff)
downloadllvm-0d1e762da7ad22e31e98cf372a692027ff0bb610.zip
llvm-0d1e762da7ad22e31e98cf372a692027ff0bb610.tar.gz
llvm-0d1e762da7ad22e31e98cf372a692027ff0bb610.tar.bz2
[InstSimplify] Refine `abs(min/undef, true)` to `poison` (#118669)
Calls to `@llvm.abs(undef, i1 true)` and `@llvm.abs(INT_MIN, i1 true)` can be optimized to `poison` instead of `undef`. [Alive2](https://alive2.llvm.org/ce/z/Hg-2ug)
Diffstat (limited to 'llvm/lib/Analysis/ConstantFolding.cpp')
-rw-r--r--llvm/lib/Analysis/ConstantFolding.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/llvm/lib/Analysis/ConstantFolding.cpp b/llvm/lib/Analysis/ConstantFolding.cpp
index 47b96e0..efbccee 100644
--- a/llvm/lib/Analysis/ConstantFolding.cpp
+++ b/llvm/lib/Analysis/ConstantFolding.cpp
@@ -3018,9 +3018,9 @@ static Constant *ConstantFoldIntrinsicCall2(Intrinsic::ID IntrinsicID, Type *Ty,
assert(C1 && "Must be constant int");
assert((C1->isOne() || C1->isZero()) && "Must be 0 or 1");
- // Undef or minimum val operand with poison min --> undef
+ // Undef or minimum val operand with poison min --> poison
if (C1->isOne() && (!C0 || C0->isMinSignedValue()))
- return UndefValue::get(Ty);
+ return PoisonValue::get(Ty);
// Undef operand with no poison min --> 0 (sign bit must be clear)
if (!C0)