File tree Expand file tree Collapse file tree 1 file changed +21
-0
lines changed
llvm/test/Transforms/ConstraintElimination Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -478,3 +478,24 @@ entry:
478
478
%and = select i1 %c.1 , i1 %c.2 , i1 false
479
479
ret i1 %and
480
480
}
481
+
482
+ define i1 @and_select_second_implies_first_guaranteed_not_poison (ptr noundef %A , ptr noundef %B ) {
483
+ ; CHECK-LABEL: @and_select_second_implies_first_guaranteed_not_poison(
484
+ ; CHECK-NEXT: entry:
485
+ ; CHECK-NEXT: [[C_1:%.*]] = icmp ne ptr [[A:%.*]], [[B:%.*]]
486
+ ; CHECK-NEXT: [[GEP:%.*]] = getelementptr inbounds ptr, ptr [[B]], i64 -1
487
+ ; CHECK-NEXT: [[C_2:%.*]] = icmp ugt ptr [[GEP]], [[A]]
488
+ ; CHECK-NEXT: call void @no_noundef(i1 [[C_2]])
489
+ ; CHECK-NEXT: [[AND:%.*]] = select i1 [[C_1]], i1 [[C_2]], i1 false
490
+ ; CHECK-NEXT: ret i1 [[AND]]
491
+ ;
492
+ entry:
493
+ %c.1 = icmp ne ptr %A , %B
494
+ %gep = getelementptr inbounds ptr , ptr %B , i64 -1
495
+ %c.2 = icmp ugt ptr %gep , %A
496
+ call void @no_noundef (i1 %c.2 )
497
+ %and = select i1 %c.1 , i1 %c.2 , i1 false
498
+ ret i1 %and
499
+ }
500
+
501
+ declare void @no_noundef (i1 noundef)
You can’t perform that action at this time.
0 commit comments