-
Notifications
You must be signed in to change notification settings - Fork 15.2k
[LoopVersioning] Add a check to see if the input loop is in LCSSA form #116443
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
Merged
Merged
Changes from 1 commit
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
bfc6152
[LoopVersioning] Add a check to see if the input loop is in LCSSA form
VedantParanjape 682c557
Update llvm/lib/Transforms/Utils/LoopVersioning.cpp
VedantParanjape 19f9ae2
fixed nitpick in the testcase
VedantParanjape cce211b
remove undef from test
VedantParanjape 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,57 @@ | ||
| ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 5 | ||
| ; RUN: opt -passes=loop-versioning -aa-pipeline='' -S < %s | FileCheck %s | ||
| target triple = "x86_64-unknown-linux-gnu" | ||
VedantParanjape marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| @a = external global i16, align 1 | ||
| @b = external global i16, align 1 | ||
| @c = external global i16, align 1 | ||
|
|
||
| define void @f2() { | ||
| ; CHECK-LABEL: define void @f2() { | ||
| ; CHECK-NEXT: [[FOR_BODY_LVER_CHECK:.*:]] | ||
| ; CHECK-NEXT: [[BOUND0:%.*]] = icmp ult ptr @b, getelementptr inbounds nuw (i8, ptr @a, i64 2) | ||
| ; CHECK-NEXT: [[BOUND1:%.*]] = icmp ult ptr @a, getelementptr inbounds nuw (i8, ptr @b, i64 2) | ||
| ; CHECK-NEXT: [[FOUND_CONFLICT:%.*]] = and i1 [[BOUND0]], [[BOUND1]] | ||
| ; CHECK-NEXT: br i1 [[FOUND_CONFLICT]], label %[[FOR_BODY_PH_LVER_ORIG:.*]], label %[[FOR_BODY_PH:.*]] | ||
| ; CHECK: [[FOR_BODY_PH_LVER_ORIG]]: | ||
| ; CHECK-NEXT: br label %[[FOR_BODY_LVER_ORIG:.*]] | ||
| ; CHECK: [[FOR_BODY_LVER_ORIG]]: | ||
| ; CHECK-NEXT: [[TMP0:%.*]] = load i16, ptr @a, align 1 | ||
| ; CHECK-NEXT: store i16 [[TMP0]], ptr @b, align 1 | ||
| ; CHECK-NEXT: [[INC_LVER_ORIG:%.*]] = add nsw i16 undef, 1 | ||
| ; CHECK-NEXT: br i1 false, label %[[FOR_BODY_LVER_ORIG]], label %[[FOR_COND_FOR_END_CRIT_EDGE_LOOPEXIT:.*]] | ||
| ; CHECK: [[FOR_BODY_PH]]: | ||
| ; CHECK-NEXT: br label %[[FOR_BODY:.*]] | ||
| ; CHECK: [[FOR_BODY]]: | ||
| ; CHECK-NEXT: [[TMP1:%.*]] = load i16, ptr @a, align 1, !alias.scope [[META0:![0-9]+]] | ||
| ; CHECK-NEXT: store i16 [[TMP1]], ptr @b, align 1, !alias.scope [[META3:![0-9]+]], !noalias [[META0]] | ||
| ; CHECK-NEXT: [[INC:%.*]] = add nsw i16 undef, 1 | ||
| ; CHECK-NEXT: br i1 false, label %[[FOR_BODY]], label %[[FOR_COND_FOR_END_CRIT_EDGE_LOOPEXIT1:.*]] | ||
| ; CHECK: [[FOR_COND_FOR_END_CRIT_EDGE_LOOPEXIT]]: | ||
| ; CHECK-NEXT: [[INC_LCSSA_PH:%.*]] = phi i16 [ [[INC_LVER_ORIG]], %[[FOR_BODY_LVER_ORIG]] ] | ||
| ; CHECK-NEXT: [[SPLIT2_PH:%.*]] = phi i16 [ [[INC_LVER_ORIG]], %[[FOR_BODY_LVER_ORIG]] ] | ||
| ; CHECK-NEXT: br label %[[FOR_COND_FOR_END_CRIT_EDGE:.*]] | ||
| ; CHECK: [[FOR_COND_FOR_END_CRIT_EDGE_LOOPEXIT1]]: | ||
| ; CHECK-NEXT: [[INC_LCSSA_PH2:%.*]] = phi i16 [ [[INC]], %[[FOR_BODY]] ] | ||
| ; CHECK-NEXT: [[SPLIT2_PH3:%.*]] = phi i16 [ [[INC]], %[[FOR_BODY]] ] | ||
| ; CHECK-NEXT: br label %[[FOR_COND_FOR_END_CRIT_EDGE]] | ||
| ; CHECK: [[FOR_COND_FOR_END_CRIT_EDGE]]: | ||
| ; CHECK-NEXT: [[INC_LCSSA:%.*]] = phi i16 [ [[INC_LCSSA_PH]], %[[FOR_COND_FOR_END_CRIT_EDGE_LOOPEXIT]] ], [ [[INC_LCSSA_PH2]], %[[FOR_COND_FOR_END_CRIT_EDGE_LOOPEXIT1]] ] | ||
| ; CHECK-NEXT: [[SPLIT2:%.*]] = phi i16 [ [[SPLIT2_PH]], %[[FOR_COND_FOR_END_CRIT_EDGE_LOOPEXIT]] ], [ [[SPLIT2_PH3]], %[[FOR_COND_FOR_END_CRIT_EDGE_LOOPEXIT1]] ] | ||
| ; CHECK-NEXT: store i16 [[INC_LCSSA]], ptr @c, align 1 | ||
| ; CHECK-NEXT: ret void | ||
| ; | ||
| entry: | ||
| br label %for.body | ||
|
|
||
| for.body: ; preds = %for.body, %entry | ||
| %0 = load i16, ptr @a, align 1 | ||
| store i16 %0, ptr @b, align 1 | ||
| %inc = add nsw i16 undef, 1 | ||
| br i1 false, label %for.body, label %for.cond.for.end_crit_edge | ||
|
|
||
| for.cond.for.end_crit_edge: ; preds = %for.body | ||
| %split2 = phi i16 [ %inc, %for.body ] | ||
| store i16 %inc, ptr @c, align 1 | ||
| ret void | ||
VedantParanjape marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| } | ||
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.
Uh oh!
There was an error while loading. Please reload this page.