-
Notifications
You must be signed in to change notification settings - Fork 15.4k
[Polly] Add vectorize metadata to loops identified as vectorizable by polly #113994
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 all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
337ef36
[Polly] Add vectorize metadata to loops identified as vectorizable by…
kartcq 374788e
Update CodeGeneration.cpp
kartcq fd61d16
Apply suggestions from code review
kartcq 075a778
Apply suggestions from code review
kartcq fe01b97
Merge branch 'codegen' of https://github.com/kartcq/llvm-project into…
kartcq c368310
Update CodeGeneration.cpp
kartcq 92703e2
Remove changes that are already made in #119188
kartcq 7a51d22
Update IRBuilder.cpp
kartcq 1a07e39
Update basic_vec_annotate.ll
kartcq 2e84b67
Update IRBuilder.cpp
kartcq 9771c7f
Merge branch 'main' into codegen
kartcq 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
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,61 @@ | ||
| ; RUN: opt %loadNPMPolly -S -passes=polly-codegen -polly-annotate-metadata-vectorize < %s | FileCheck %s | ||
|
|
||
| ; Basic verification of vectorize metadata getting added when "-polly-vectorize-metadata" is | ||
| ; passed. | ||
|
|
||
| ; void add(int *A, int *B, int *C,int n) { | ||
| ; for(int i=0; i<n; i++) | ||
| ; C[i] += A[i] + B[i]; | ||
| ; } | ||
|
|
||
| ; CHECK: for.body: | ||
| ; CHECK: br {{.*}} !llvm.loop [[LOOP:![0-9]+]] | ||
| ; CHECK: polly.stmt.for.body: | ||
| ; CHECK: br {{.*}} !llvm.loop [[POLLY_LOOP:![0-9]+]] | ||
| ; CHECK: [[LOOP]] = distinct !{[[LOOP]], [[META2:![0-9]+]], [[META3:![0-9]+]]} | ||
| ; CHECK: [[META3]] = !{!"llvm.loop.vectorize.enable", i32 0} | ||
| ; CHECK: [[POLLY_LOOP]] = distinct !{[[POLLY_LOOP]], [[META2:![0-9]+]], [[META3:![0-9]+]]} | ||
| ; CHECK: [[META3]] = !{!"llvm.loop.vectorize.enable", i1 true} | ||
|
|
||
| target datalayout = "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128-Fn32" | ||
| target triple = "aarch64-unknown-linux-gnu" | ||
|
|
||
| ; Function Attrs: nofree norecurse nosync nounwind memory(argmem: readwrite) uwtable | ||
| define dso_local void @add(ptr nocapture noundef readonly %A, ptr nocapture noundef readonly %B, ptr nocapture noundef %C, i32 noundef %n) local_unnamed_addr #0 { | ||
| entry: | ||
| br label %entry.split | ||
|
|
||
| entry.split: ; preds = %entry | ||
| %cmp10 = icmp sgt i32 %n, 0 | ||
| br i1 %cmp10, label %for.body.preheader, label %for.cond.cleanup | ||
|
|
||
| for.body.preheader: ; preds = %entry.split | ||
| %wide.trip.count = zext nneg i32 %n to i64 | ||
| br label %for.body | ||
|
|
||
| for.cond.cleanup.loopexit: ; preds = %for.body | ||
| br label %for.cond.cleanup | ||
|
|
||
| for.cond.cleanup: ; preds = %for.cond.cleanup.loopexit, %entry.split | ||
| ret void | ||
|
|
||
| for.body: ; preds = %for.body.preheader, %for.body | ||
| %indvars.iv = phi i64 [ 0, %for.body.preheader ], [ %indvars.iv.next, %for.body ] | ||
| %arrayidx = getelementptr inbounds i32, ptr %A, i64 %indvars.iv | ||
| %0 = load i32, ptr %arrayidx, align 4 | ||
| %arrayidx2 = getelementptr inbounds i32, ptr %B, i64 %indvars.iv | ||
| %1 = load i32, ptr %arrayidx2, align 4 | ||
| %add = add nsw i32 %1, %0 | ||
| %arrayidx4 = getelementptr inbounds i32, ptr %C, i64 %indvars.iv | ||
| %2 = load i32, ptr %arrayidx4, align 4 | ||
| %add5 = add nsw i32 %add, %2 | ||
| store i32 %add5, ptr %arrayidx4, align 4 | ||
| %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 | ||
| %exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count | ||
| br i1 %exitcond.not, label %for.cond.cleanup.loopexit, label %for.body, !llvm.loop !0 | ||
| } | ||
|
|
||
| attributes #0 = { nofree norecurse nosync nounwind memory(argmem: readwrite) uwtable "frame-pointer"="non-leaf" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="cortex-a57" "target-features"="+aes,+crc,+fp-armv8,+neon,+outline-atomics,+perfmon,+sha2,+v8a,-fmv" } | ||
|
|
||
| !0 = distinct !{!0, !1} | ||
| !1 = !{!"llvm.loop.mustprogress"} |
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.