File tree 2 files changed +60
-0
lines changed
llvm/test/Transforms/InstCombine
2 files changed +60
-0
lines changed Original file line number Diff line number Diff line change @@ -518,3 +518,32 @@ if.else:
518
518
if.end:
519
519
ret i1 false
520
520
}
521
+
522
+ define i1 @test_inv_and (float %x , i1 %cond2 ) {
523
+ ; CHECK-LABEL: define i1 @test_inv_and(
524
+ ; CHECK-SAME: float [[X:%.*]], i1 [[COND2:%.*]]) {
525
+ ; CHECK-NEXT: [[COND:%.*]] = fcmp oge float [[X]], -1.000000e+00
526
+ ; CHECK-NEXT: call void @use(i1 [[COND]])
527
+ ; CHECK-NEXT: [[NOT:%.*]] = xor i1 [[COND]], true
528
+ ; CHECK-NEXT: [[AND:%.*]] = and i1 [[COND2]], [[NOT]]
529
+ ; CHECK-NEXT: br i1 [[AND]], label [[IF_THEN:%.*]], label [[IF_ELSE:%.*]]
530
+ ; CHECK: if.then:
531
+ ; CHECK-NEXT: [[RET1:%.*]] = fcmp oeq float [[X]], 0x7FF0000000000000
532
+ ; CHECK-NEXT: ret i1 [[RET1]]
533
+ ; CHECK: if.else:
534
+ ; CHECK-NEXT: ret i1 false
535
+ ;
536
+ %cond = fcmp oge float %x , -1 .0
537
+ %neg = fneg float %x
538
+ call void @use (i1 %cond )
539
+ %not = xor i1 %cond , true
540
+ %and = and i1 %not , %cond2
541
+ br i1 %and , label %if.then , label %if.else
542
+ if.then:
543
+ %ret1 = fcmp oeq float %neg , 0xFFF0000000000000
544
+ ret i1 %ret1
545
+ if.else:
546
+ ret i1 false
547
+ }
548
+
549
+ declare void @use (i1 )
Original file line number Diff line number Diff line change @@ -2365,6 +2365,37 @@ exit:
2365
2365
ret i8 %or2
2366
2366
}
2367
2367
2368
+ define i8 @test_inv_cond_and (i8 %x , i1 %c ) {
2369
+ ; CHECK-LABEL: @test_inv_cond_and(
2370
+ ; CHECK-NEXT: [[AND:%.*]] = and i8 [[X:%.*]], 3
2371
+ ; CHECK-NEXT: [[CMP:%.*]] = icmp ne i8 [[AND]], 0
2372
+ ; CHECK-NEXT: call void @use(i1 [[CMP]])
2373
+ ; CHECK-NEXT: [[NOT:%.*]] = xor i1 [[CMP]], true
2374
+ ; CHECK-NEXT: [[COND:%.*]] = and i1 [[C:%.*]], [[NOT]]
2375
+ ; CHECK-NEXT: br i1 [[COND]], label [[IF:%.*]], label [[EXIT:%.*]]
2376
+ ; CHECK: if:
2377
+ ; CHECK-NEXT: [[OR1:%.*]] = or i8 [[X]], -4
2378
+ ; CHECK-NEXT: ret i8 [[OR1]]
2379
+ ; CHECK: exit:
2380
+ ; CHECK-NEXT: [[OR2:%.*]] = or i8 [[X]], -4
2381
+ ; CHECK-NEXT: ret i8 [[OR2]]
2382
+ ;
2383
+ %and = and i8 %x , 3
2384
+ %cmp = icmp ne i8 %and , 0
2385
+ call void @use (i1 %cmp )
2386
+ %not = xor i1 %cmp , true
2387
+ %cond = and i1 %not , %c
2388
+ br i1 %cond , label %if , label %exit
2389
+
2390
+ if:
2391
+ %or1 = or i8 %x , -4
2392
+ ret i8 %or1
2393
+
2394
+ exit:
2395
+ %or2 = or i8 %x , -4
2396
+ ret i8 %or2
2397
+ }
2398
+
2368
2399
declare void @dummy ()
2369
2400
declare void @use (i1 )
2370
2401
declare void @sink (i8 )
You can’t perform that action at this time.
0 commit comments