-
Notifications
You must be signed in to change notification settings - Fork 14.8k
[CodeGen] Use getObjectPtrOffset to generate loads/stores for mem intrinsics #80184
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
+56
−8
Merged
Changes from 5 commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
8fce40a
Use getObjectPtrOffset to generate constant offsets for memcpy/memset
dschuff 6e09932
remove debug prints, reformat
dschuff 108e14a
autogenerate test expectation
dschuff 1f0d980
fix test invocation
dschuff 99eddb8
fix format
dschuff 120ac5a
mark all loads and stores as dereferenceable
dschuff 069523a
Merge branch 'main' into memset_offset
dschuff 7661fdd
Merge branch 'main' into memset_offset
dschuff f24da0c
update tests
dschuff c5eae8c
update more tests
dschuff 951232e
Back out dereferenceable(), just use getObjectPtrOffset
dschuff 2bbf2e1
clang-format
dschuff 1c55043
add comment explaining the test's purpose
dschuff eec7c5f
Merge branch 'main' into memset_offset
dschuff 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,30 @@ | ||
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py | ||
; RUN: llc < %s -mcpu=mvp -wasm-disable-explicit-locals -wasm-keep-registers | FileCheck %s | ||
|
||
target triple = "wasm32-unknown-unknown" | ||
|
||
define void @call_memset(ptr dereferenceable(16)) #0 { | ||
; CHECK-LABEL: call_memset: | ||
; CHECK: .functype call_memset (i32) -> () | ||
; CHECK-NEXT: # %bb.0: | ||
; CHECK-NEXT: i64.const $push0=, 0 | ||
; CHECK-NEXT: i64.store 8($0):p2align=0, $pop0 | ||
; CHECK-NEXT: i64.const $push1=, 0 | ||
; CHECK-NEXT: i64.store 0($0):p2align=0, $pop1 | ||
; CHECK-NEXT: return | ||
call void @llvm.memset.p0.i32(ptr align 1 %0, i8 0, i32 16, i1 false) | ||
ret void | ||
} | ||
|
||
define void @call_memcpy(ptr dereferenceable(16) %dst, ptr dereferenceable(16) %src) #0 { | ||
; CHECK-LABEL: call_memcpy: | ||
; CHECK: .functype call_memcpy (i32, i32) -> () | ||
; CHECK-NEXT: # %bb.0: | ||
; CHECK-NEXT: i64.load $push0=, 8($1):p2align=0 | ||
; CHECK-NEXT: i64.store 8($0):p2align=0, $pop0 | ||
; CHECK-NEXT: i64.load $push1=, 0($1):p2align=0 | ||
; CHECK-NEXT: i64.store 0($0):p2align=0, $pop1 | ||
; CHECK-NEXT: return | ||
call void @llvm.memcpy.p0.p0.i32(ptr align 1 %dst, ptr align 1 %src, i32 16, i1 false) | ||
ret void | ||
} |
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.
Maybe should move this to a parameter of getMemBasePlusOffset
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.
Yeah that's actually the only difference between the 2 functions (getObjectPtrOffset is just implemented in terms of getMemBasePlusOffset anway). So if you think it's a good idea I wouldn't mind just collapsing them as a separate refactoring (it would also fix the annoyance that the 2 functions have the same parameters but in a different order).