Skip to content

Commit d3e1068

Browse files
committed
[IR] Add support for samesign in Operator::hasPoisonGeneratingFlags
1 parent 3046d48 commit d3e1068

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

llvm/lib/IR/Operator.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,8 @@ bool Operator::hasPoisonGeneratingFlags() const {
5050
if (auto *NNI = dyn_cast<PossiblyNonNegInst>(this))
5151
return NNI->hasNonNeg();
5252
return false;
53+
case Instruction::ICmp:
54+
return cast<ICmpInst>(this)->hasSameSign();
5355
default:
5456
if (const auto *FP = dyn_cast<FPMathOperator>(this))
5557
return FP->hasNoNaNs() || FP->hasNoInfs();

llvm/test/Transforms/InstCombine/icmp.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5368,7 +5368,7 @@ define i1 @icmp_and_inv_pow2_or_zero_ne_0(i32 %A, i32 %B) {
53685368

53695369
define i1 @icmp_samesign_logical_and(i32 %In) {
53705370
; CHECK-LABEL: @icmp_samesign_logical_and(
5371-
; CHECK-NEXT: [[C2:%.*]] = icmp samesign eq i32 [[IN:%.*]], 1
5371+
; CHECK-NEXT: [[C2:%.*]] = icmp eq i32 [[IN:%.*]], 1
53725372
; CHECK-NEXT: ret i1 [[C2]]
53735373
;
53745374
%c1 = icmp samesign sgt i32 %In, -1

0 commit comments

Comments
 (0)