Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions llvm/lib/Analysis/ConstantFolding.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions llvm/test/Transforms/InstSimplify/ConstProp/abs.ll
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ declare <8 x i8> @llvm.abs.v8i8(<8 x i8>, i1)

define i8 @undef_val_min_poison() {
; CHECK-LABEL: @undef_val_min_poison(
; CHECK-NEXT: ret i8 undef
; CHECK-NEXT: ret i8 poison
;
%r = call i8 @llvm.abs.i8(i8 undef, i1 true)
ret i8 %r
Expand All @@ -22,7 +22,7 @@ define i8 @undef_val_min_not_poison() {

define i8 @min_val_min_poison() {
; CHECK-LABEL: @min_val_min_poison(
; CHECK-NEXT: ret i8 undef
; CHECK-NEXT: ret i8 poison
;
%r = call i8 @llvm.abs.i8(i8 -128, i1 true)
ret i8 %r
Expand Down
Loading