-
Notifications
You must be signed in to change notification settings - Fork 15.2k
[FlattenCFG] Fixup Phi nodes during CFG flattening #143766
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
Open
HighW4y2H3ll
wants to merge
4
commits into
llvm:main
Choose a base branch
from
HighW4y2H3ll:fix_cfg_flatten
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 1 commit
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,53 @@ | ||
| ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --tool ./opt --version 5 | ||
| ; RUN: opt < %s -passes=flatten-cfg -S | FileCheck %s | ||
|
|
||
| define i1 @_Z7compareRK1SS1_(ptr %a, ptr %b) { | ||
| ; CHECK-LABEL: @_Z7compareRK1SS1_( | ||
| ; CHECK-SAME: ptr [[A:%.*]], ptr [[B:%.*]]) { | ||
| ; CHECK-NEXT: entry: | ||
| ; CHECK-NEXT: %0 = load i32, ptr %a, align 4, !tbaa !3 | ||
| ; CHECK-NEXT: %1 = load i32, ptr %b, align 4, !tbaa !3 | ||
| ; CHECK-NEXT: %cmp.i = icmp sge i32 %0, %1 | ||
| ; CHECK-NEXT: %cmp.i19 = icmp eq i32 %0, %1 | ||
| ; CHECK-NEXT: %2 = and i1 %cmp.i, %cmp.i19 | ||
| ; CHECK-NEXT: %3 = select i1 %cmp.i, i1 false, i1 true | ||
| ; CHECK-NEXT: br i1 %2, label %land.rhs, label %lor.end | ||
| ; CHECK-LABEL: lor.end: ; preds = %land.rhs, %entry | ||
| ; CHECK-NEXT: %6 = phi i1 [ %cmp, %land.rhs ], [ %3, %entry ] | ||
| ; CHECK-NEXT: ret i1 %6 | ||
| entry: | ||
| %0 = load i32, ptr %a, align 4, !tbaa !3 | ||
| %1 = load i32, ptr %b, align 4, !tbaa !3 | ||
| %cmp.i = icmp slt i32 %0, %1 | ||
| br i1 %cmp.i, label %lor.end, label %lor.rhs | ||
|
|
||
| lor.rhs: ; preds = %entry | ||
| %cmp.i19 = icmp eq i32 %0, %1 | ||
| br i1 %cmp.i19, label %land.rhs, label %lor.end | ||
|
|
||
| land.rhs: ; preds = %lor.rhs | ||
| %y = getelementptr inbounds nuw i8, ptr %a, i64 4 | ||
| %2 = load i32, ptr %y, align 4, !tbaa !8 | ||
| %y14 = getelementptr inbounds nuw i8, ptr %b, i64 4 | ||
| %3 = load i32, ptr %y14, align 4, !tbaa !8 | ||
| %cmp = icmp slt i32 %2, %3 | ||
| br label %lor.end | ||
|
|
||
| lor.end: ; preds = %lor.rhs, %land.rhs, %entry | ||
| %4 = phi i1 [ true, %entry ], [ false, %lor.rhs ], [ %cmp, %land.rhs ] | ||
| ret i1 %4 | ||
| } | ||
|
|
||
| !llvm.module.flags = !{!0, !1} | ||
| !llvm.ident = !{!2} | ||
|
|
||
| !0 = !{i32 1, !"wchar_size", i32 4} | ||
| !1 = !{i32 7, !"uwtable", i32 2} | ||
| !2 = !{!"clang"} | ||
| !3 = !{!4, !5, i64 0} | ||
| !4 = !{!"_ZTS1S", !5, i64 0, !5, i64 4} | ||
| !5 = !{!"int", !6, i64 0} | ||
| !6 = !{!"omnipotent char", !7, i64 0} | ||
| !7 = !{!"Simple C++ TBAA"} | ||
| !8 = !{!4, !5, i64 4} | ||
| !9 = !{!5, !5, i64 0} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
It looks like your transform lost the contents of land.rhs entirely?
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.
ohh not at all, I just skipped the checking of the
land.rhssince its entirely unchanged. let me add it there if that works better.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.
You should use update_test_checks.py to generate the check lines (your test file says it does that, but it doesn't actually).