diff options
author | Pedro Lobo <pedro.lobo@tecnico.ulisboa.pt> | 2024-12-04 18:41:05 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-12-04 18:41:05 +0000 |
commit | 0d1e762da7ad22e31e98cf372a692027ff0bb610 (patch) | |
tree | c994ad86fd22582126cbe447666fd6fbed4ad7a9 /llvm/lib/Analysis/ConstantFolding.cpp | |
parent | fd02693fb61ecc7630c66f9bad62bcdb143b9b91 (diff) | |
download | llvm-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.cpp | 4 |
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) |