-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[EarlyCSE] Compare GEP instructions based on offset #65875
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 8 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
a0e8343
[EarlyCSE] Pre-commit offset-based GEP (NFC)
dianqk ac1daad
[EarlyCSE] Add a vectorization failure example (NFC)
dianqk 31e2ec9
[EarlyCSE] Compare GEP instructions based on offset
dianqk 089349f
[EarlyCSE] Use ref
dianqk 12eda5c
fixup! [EarlyCSE] Compare GEP instructions based on offset
dianqk b498e5c
fixup! [EarlyCSE] Compare GEP instructions based on offset
dianqk 2803cd2
[EarlyCSE] Use std::optional<APInt>
dianqk 82f1eca
[EarlyCSE] Replace APInt with uint64_t
dianqk b6158f9
[EarlyCSE] Replace uint64_t with int64_t
dianqk 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,44 @@ | ||
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 3 | ||
; RUN: opt < %s -S -passes=early-cse -earlycse-debug-hash | FileCheck %s | ||
; RUN: opt < %s -S -passes='early-cse<memssa>' | FileCheck %s | ||
|
||
%T1 = type { i64, i64, i64 } | ||
|
||
declare void @use_vec(<4 x ptr>); | ||
|
||
define void @foo(ptr %a, <4 x i64> %b, i64 %i) { | ||
; CHECK-LABEL: define void @foo( | ||
; CHECK-SAME: ptr [[A:%.*]], <4 x i64> [[B:%.*]], i64 [[I:%.*]]) { | ||
; CHECK-NEXT: [[S1A:%.*]] = getelementptr i8, ptr [[A]], i64 8 | ||
; CHECK-NEXT: [[N1D:%.*]] = getelementptr i8, ptr [[A]], i64 7 | ||
; CHECK-NEXT: [[N1G:%.*]] = getelementptr i32, ptr [[A]], i64 1 | ||
; CHECK-NEXT: [[N1H:%.*]] = getelementptr i8, ptr [[A]], i64 [[I]] | ||
; CHECK-NEXT: [[V:%.*]] = getelementptr i64, ptr [[A]], <4 x i64> <i64 1, i64 1, i64 1, i64 1> | ||
; CHECK-NEXT: call void @use_vec(<4 x ptr> [[V]]) | ||
; CHECK-NEXT: [[V2:%.*]] = getelementptr i64, ptr [[A]], <4 x i64> <i64 0, i64 2, i64 1, i64 1> | ||
; CHECK-NEXT: call void @use_vec(<4 x ptr> [[V2]]) | ||
; CHECK-NEXT: ret void | ||
; | ||
%s1a = getelementptr i8, ptr %a, i64 8 | ||
%s1av = load i64, ptr %s1a | ||
%s1b = getelementptr inbounds i8, ptr %a, i64 8 | ||
%s1bv = load i64, ptr %s1b | ||
%s1c = getelementptr %T1, ptr %a, i64 0, i32 1 | ||
%s1cv = load i64, ptr %s1c | ||
%n1d = getelementptr i8, ptr %a, i64 7 | ||
%n1dv = load i64, ptr %n1d | ||
%s1e = getelementptr i64, ptr %a, i64 1 | ||
%s1ev = load i64, ptr %s1e | ||
%s1f = getelementptr i32, ptr %a, i64 2 | ||
%s1fv = load i64, ptr %s1f | ||
%n1g = getelementptr i32, ptr %a, i64 1 | ||
%n1gv = load i64, ptr %n1g | ||
%n1h = getelementptr i8, ptr %a, i64 %i | ||
%n1hv = load i64, ptr %n1h | ||
|
||
%v = getelementptr i64, ptr %a, <4 x i64> <i64 1, i64 1, i64 1, i64 1> | ||
call void @use_vec(<4 x ptr> %v) | ||
%v2 = getelementptr i64, ptr %a, <4 x i64> <i64 0, i64 2, i64 1, i64 1> | ||
call void @use_vec(<4 x ptr> %v2) | ||
ret void | ||
} |
44 changes: 44 additions & 0 deletions
44
llvm/test/Transforms/PhaseOrdering/X86/unroll-vectorizer.ll
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,44 @@ | ||
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 3 | ||
; RUN: opt < %s -O3 -S | FileCheck %s | ||
|
||
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" | ||
target triple = "x86_64-unknown-linux-gnu" | ||
|
||
%Zip = type { { ptr, ptr }, { [32 x i8], { i64, i64 } } } | ||
|
||
define void @foo(ptr %a, <32 x i8> %_0) #0 { | ||
; CHECK-LABEL: define void @foo( | ||
; CHECK-SAME: ptr nocapture writeonly [[A:%.*]], <32 x i8> [[_0:%.*]]) local_unnamed_addr #[[ATTR0:[0-9]+]] { | ||
; CHECK-NEXT: start: | ||
; CHECK-NEXT: store <32 x i8> [[_0]], ptr [[A]], align 1 | ||
; CHECK-NEXT: ret void | ||
; | ||
start: | ||
%z = alloca %Zip, align 8 | ||
%sroa_1 = getelementptr i8, ptr %z, i64 16 | ||
store <32 x i8> %_0, ptr %sroa_1, align 8 | ||
%len_ = getelementptr i8, ptr %z, i64 56 | ||
store i64 32, ptr %len_, align 8 | ||
%_1 = getelementptr %Zip, ptr %z, i64 0, i32 1, i32 1 | ||
%_2 = getelementptr %Zip, ptr %z, i64 0, i32 1, i32 1, i32 1 | ||
%len = load i64, ptr %_2, align 8 | ||
%_10 = getelementptr %Zip, ptr %z, i64 0, i32 1 | ||
br label %body | ||
|
||
body: ; preds = %body, %start | ||
%_34 = phi ptr [ %_34i, %body ], [ %a, %start ] | ||
%idx = phi i64 [ %idx_, %body ], [ 0, %start ] | ||
%_34i = getelementptr i8, ptr %_34, i64 1 | ||
%idx_ = add i64 %idx, 1 | ||
store i64 0, ptr %_1, align 8 | ||
%_24 = getelementptr i8, ptr %_10, i64 %idx | ||
%_18 = load i8, ptr %_24, align 1 | ||
store i8 %_18, ptr %_34, align 1 | ||
%_6 = icmp eq i64 %len, %idx_ | ||
br i1 %_6, label %exit, label %body | ||
|
||
exit: ; preds = %body | ||
ret void | ||
} | ||
|
||
attributes #0 = { "target-cpu"="znver3" } |
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.