-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[ConstraintElim] Check if second op implies first for And. #75750
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -31,7 +31,7 @@ define i1 @test_first_and_condition_implied_by_second_ops(i8 %x) { | |
; CHECK-NEXT: entry: | ||
; CHECK-NEXT: [[C_1:%.*]] = icmp ugt i8 [[X:%.*]], 10 | ||
; CHECK-NEXT: [[T_1:%.*]] = icmp ugt i8 [[X]], 5 | ||
; CHECK-NEXT: [[AND:%.*]] = and i1 [[T_1]], [[C_1]] | ||
; CHECK-NEXT: [[AND:%.*]] = and i1 true, [[C_1]] | ||
; CHECK-NEXT: br i1 [[AND]], label [[THEN:%.*]], label [[ELSE:%.*]] | ||
; CHECK: then: | ||
; CHECK-NEXT: ret i1 false | ||
|
@@ -105,7 +105,7 @@ define i1 @test_same_cond_for_and(i8 %x) { | |
; CHECK-LABEL: @test_same_cond_for_and( | ||
; CHECK-NEXT: entry: | ||
; CHECK-NEXT: [[C_1:%.*]] = icmp ugt i8 [[X:%.*]], 10 | ||
; CHECK-NEXT: [[AND:%.*]] = and i1 [[C_1]], true | ||
; CHECK-NEXT: [[AND:%.*]] = and i1 true, [[C_1]] | ||
; CHECK-NEXT: br i1 [[AND]], label [[THEN:%.*]], label [[ELSE:%.*]] | ||
; CHECK: then: | ||
; CHECK-NEXT: ret i1 false | ||
|
@@ -128,7 +128,7 @@ define i1 @test_same_cond_for_and_select_form(i8 %x) { | |
; CHECK-LABEL: @test_same_cond_for_and_select_form( | ||
; CHECK-NEXT: entry: | ||
; CHECK-NEXT: [[C_1:%.*]] = icmp ugt i8 [[X:%.*]], 10 | ||
; CHECK-NEXT: [[AND:%.*]] = select i1 [[C_1]], i1 true, i1 false | ||
; CHECK-NEXT: [[AND:%.*]] = select i1 [[C_1]], i1 [[C_1]], i1 false | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why did this regress? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In this case, both conds are the same, and in the new code we will try |
||
; CHECK-NEXT: br i1 [[AND]], label [[THEN:%.*]], label [[ELSE:%.*]] | ||
; CHECK: then: | ||
; CHECK-NEXT: ret i1 false | ||
|
@@ -152,7 +152,7 @@ define i1 @test_second_and_condition_not_implied_by_first(i8 %x) { | |
; CHECK-NEXT: entry: | ||
; CHECK-NEXT: [[C_1:%.*]] = icmp ugt i8 [[X:%.*]], 10 | ||
; CHECK-NEXT: [[C_2:%.*]] = icmp ugt i8 [[X]], 5 | ||
; CHECK-NEXT: [[AND:%.*]] = and i1 [[C_2]], [[C_1]] | ||
; CHECK-NEXT: [[AND:%.*]] = and i1 true, [[C_1]] | ||
; CHECK-NEXT: br i1 [[AND]], label [[THEN:%.*]], label [[ELSE:%.*]] | ||
; CHECK: then: | ||
; CHECK-NEXT: ret i1 false | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this due to a poison-propagation issue?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep, added a comment plus a TODO to check if the first op may be poison, thanks!