File tree Expand file tree Collapse file tree 2 files changed +24
-0
lines changed
test/Transforms/InstCombine Expand file tree Collapse file tree 2 files changed +24
-0
lines changed Original file line number Diff line number Diff line change @@ -50,6 +50,8 @@ bool Operator::hasPoisonGeneratingFlags() const {
50
50
if (auto *NNI = dyn_cast<PossiblyNonNegInst>(this ))
51
51
return NNI->hasNonNeg ();
52
52
return false ;
53
+ case Instruction::ICmp:
54
+ return cast<ICmpInst>(this )->hasSameSign ();
53
55
default :
54
56
if (const auto *FP = dyn_cast<FPMathOperator>(this ))
55
57
return FP->hasNoNaNs () || FP->hasNoInfs ();
Original file line number Diff line number Diff line change @@ -5365,3 +5365,25 @@ define i1 @icmp_and_inv_pow2_or_zero_ne_0(i32 %A, i32 %B) {
5365
5365
%cmp = icmp ne i32 %and , 0
5366
5366
ret i1 %cmp
5367
5367
}
5368
+
5369
+ define i1 @icmp_samesign_logical_and (i32 %In ) {
5370
+ ; CHECK-LABEL: @icmp_samesign_logical_and(
5371
+ ; CHECK-NEXT: [[C2:%.*]] = icmp eq i32 [[IN:%.*]], 1
5372
+ ; CHECK-NEXT: ret i1 [[C2]]
5373
+ ;
5374
+ %c1 = icmp samesign sgt i32 %In , -1
5375
+ %c2 = icmp samesign eq i32 %In , 1
5376
+ %V = select i1 %c1 , i1 %c2 , i1 false
5377
+ ret i1 %V
5378
+ }
5379
+
5380
+ define i1 @icmp_samesign_logical_or (i32 %In ) {
5381
+ ; CHECK-LABEL: @icmp_samesign_logical_or(
5382
+ ; CHECK-NEXT: [[V:%.*]] = icmp ne i32 [[IN:%.*]], 1
5383
+ ; CHECK-NEXT: ret i1 [[V]]
5384
+ ;
5385
+ %c1 = icmp samesign slt i32 %In , 0
5386
+ %c2 = icmp samesign ne i32 %In , 1
5387
+ %V = select i1 %c1 , i1 true , i1 %c2
5388
+ ret i1 %V
5389
+ }
You can’t perform that action at this time.
0 commit comments