Skip to content

[only tests] Add tests for current read/write unaligned behaviour - #158341

Closed
scottmcm wants to merge 2 commits into
rust-lang:mainfrom
scottmcm:unaligned-pinning
Closed

[only tests] Add tests for current read/write unaligned behaviour#158341
scottmcm wants to merge 2 commits into
rust-lang:mainfrom
scottmcm:unaligned-pinning

Conversation

@scottmcm

Copy link
Copy Markdown
Member

This adds some tests to record what we're currently doing for read_unaligned and write_unaligned.

I had part of this in #158202, but I'm going to close that in favour of a different approach (#158291 being the first part of that) so figured I'd check in tests showing current behaviour to help make the fix PRs clearer.

@rustbotrustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Jun 24, 2026
@rustbot

Copy link
Copy Markdown
Collaborator

r? @mejrs

rustbot has assigned @mejrs.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

Why was this reviewer chosen?

The reviewer was selected based on:

  • Owners of files modified in this PR: compiler
  • compiler expanded to 73 candidates
  • Random selection from 20 candidates

@rust-log-analyzer

This comment has been minimized.

@mejrs

Copy link
Copy Markdown
Member

I'm not qualified to review this sort of stuff

r? @folkertdev perhaps?

@rustbotrustbot assigned folkertdev and unassigned mejrsJun 24, 2026
@scottmcm
scottmcm marked this pull request as draft June 25, 2026 05:06
@scottmcm

Copy link
Copy Markdown
MemberAuthor

Moving to draft because it'll conflict with #158345

@rustbotrustbot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jun 25, 2026
@rust-log-analyzer

Copy link
Copy Markdown
Collaborator

The job aarch64-gnu-llvm-21-1 failed! Check out the build log: (web)(plain enhanced)(plain)

Click to see the possible cause of the failure (guessed by this bot)

---- [codegen] tests/codegen-llvm/read_write_unaligned.rs stdout ----
------FileCheck stdout------------------------------
------FileCheck stderr------------------------------
/checkout/tests/codegen-llvm/read_write_unaligned.rs:27:17: error: CHECK-NEXT: is not on the line after the previous match
// CHECK-NEXT: ret i16 [[TEMP]]
^
/checkout/obj/build/aarch64-unknown-linux-gnu/test/codegen-llvm/read_write_unaligned/read_write_unaligned.ll:19:2: note: 'next' match was here
ret i16 %_2.sroa.0.0.copyload
^
/checkout/obj/build/aarch64-unknown-linux-gnu/test/codegen-llvm/read_write_unaligned/read_write_unaligned.ll:16:53: note: previous match ended here
%_2.sroa.0.0.copyload = load i16, ptr %ptr, align 1
^
/checkout/obj/build/aarch64-unknown-linux-gnu/test/codegen-llvm/read_write_unaligned/read_write_unaligned.ll:17:1: note: non-matching line after previous match is here
%0 = icmp ne i16 %_2.sroa.0.0.copyload, 0
^
Input file: /checkout/obj/build/aarch64-unknown-linux-gnu/test/codegen-llvm/read_write_unaligned/read_write_unaligned.ll
Check file: /checkout/tests/codegen-llvm/read_write_unaligned.rs
-dump-input=help explains the following input dump.
Input was:
<<<<<<
1: ; ModuleID = 'read_write_unaligned.e30f5481d8566fd2-cgu.0' 2: source_filename = "read_write_unaligned.e30f5481d8566fd2-cgu.0" 3: target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128-Fn32" 4: target triple = "aarch64-unknown-linux-gnu" 5: 6: ; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable 7: define noundef nonnull ptr @read_unaligned_ptr(ptr noundef readonly captures(none) %ptr) unnamed_addr #0 { 8: start: 9: %_2.sroa.0.0.copyload = load ptr, ptr %ptr, align 1, !nonnull !4, !noundef !4 10: ret ptr %_2.sroa.0.0.copyload 11: } 12: 13: ; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read, inaccessiblemem: write) uwtable 14: define noundef range(i16 1, 0) i16 @read_unaligned_i16(ptr noundef readonly captures(none) %ptr) unnamed_addr #1 { 15: start: 16: %_2.sroa.0.0.copyload = load i16, ptr %ptr, align 1 17: %0 = icmp ne i16 %_2.sroa.0.0.copyload, 0 18: tail call void @llvm.assume(i1 %0) 19: ret i16 %_2.sroa.0.0.copyload next:27 !~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: match on wrong line
20: } 21: 22: ; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) uwtable 23: define void @typed_copy_unaligned_i32(ptr noundef readonly captures(none) %src, ptr noundef writeonly captures(none) initializes((0, 4)) %dst) unnamed_addr #2 { 24: start: 25: %_4.sroa.0.0.copyload = load i32, ptr %src, align 1 26: store i32 %_4.sroa.0.0.copyload, ptr %dst, align 1 27: ret void 28: } 29: 30: ; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: write) uwtable 31: define void @write_unaligned_i64(ptr noundef writeonly captures(none) initializes((0, 8)) %ptr, i64 noundef range(i64 1, 0) %val) unnamed_addr #3 { 32: start: 33: store i64 %val, ptr %ptr, align 1 34: ret void 35: } 36: 37: ; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) uwtable 38: define void @read_unaligned_huge(ptr dead_on_unwind noalias nofree noundef writable writeonly sret([8192 x i8]) align 128 captures(none) dereferenceable(8192) initializes((0, 8192)) %_0, ptr noundef readonly captures(none) %ptr) unnamed_addr #2 { 39: start: 40: tail call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 128 dereferenceable(8192) %_0, ptr noundef nonnull align 1 dereferenceable(8192) %ptr, i64 8192, i1 false) 41: ret void 42: } 43: 44: ; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) uwtable 45: define void @write_unaligned_huge(ptr noundef writeonly captures(none) initializes((0, 8192)) %ptr, ptr dead_on_return noalias nofree noundef readonly align 128 captures(none) dereferenceable(8192) %val) unnamed_addr #2 { 46: start: 47: tail call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 1 dereferenceable(8192) %ptr, ptr noundef nonnull align 128 dereferenceable(8192) %val, i64 8192, i1 false) 48: ret void 49: } 50: 51: ; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) 52: declare void @llvm.memcpy.p0.p0.i64(ptr noalias writeonly captures(none), ptr noalias readonly captures(none), i64, i1 immarg) #4 53: 54: ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(inaccessiblemem: write) 55: declare void @llvm.assume(i1 noundef) #5 56: 57: attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable "frame-pointer"="non-leaf" "probe-stack"="inline-asm" "target-cpu"="generic" "target-features"="+v8a,+outline-atomics" } 58: attributes #1 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read, inaccessiblemem: write) uwtable "frame-pointer"="non-leaf" "probe-stack"="inline-asm" "target-cpu"="generic" "target-features"="+v8a,+outline-atomics" } 59: attributes #2 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) uwtable "frame-pointer"="non-leaf" "probe-stack"="inline-asm" "target-cpu"="generic" "target-features"="+v8a,+outline-atomics" } 60: attributes #3 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: write) uwtable "frame-pointer"="non-leaf" "probe-stack"="inline-asm" "target-cpu"="generic" "target-features"="+v8a,+outline-atomics" } 61: attributes #4 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) } 62: attributes #5 = { mustprogress nocallback nofree nosync nounwind willreturn memory(inaccessiblemem: write) } 63: 64: !llvm.module.flags = !{!0, !1, !2} 65: !llvm.ident = !{!3} 66: 67: !0 = !{i32 8, !"PIC Level", i32 2} 68: !1 = !{i32 7, !"uwtable", i32 2} 69: !2 = !{i32 7, !"frame-pointer", i32 1} 70: !3 = !{!"rustc version 1.98.0-nightly (53db257c2 2026-06-25)"} 71: !4 = !{} >>>>>>
------------------------------------------
error: verification with 'FileCheck' failed
status: exit status: 1
command: "/usr/lib/llvm-21/bin/FileCheck" "--input-file" "/checkout/obj/build/aarch64-unknown-linux-gnu/test/codegen-llvm/read_write_unaligned/read_write_unaligned.ll" "/checkout/tests/codegen-llvm/read_write_unaligned.rs" "--check-prefix=CHECK" "--allow-unused-prefixes" "--dump-input-context" "100"
stdout: none
--- stderr -------------------------------
/checkout/tests/codegen-llvm/read_write_unaligned.rs:27:17: error: CHECK-NEXT: is not on the line after the previous match
// CHECK-NEXT: ret i16 [[TEMP]]
^
/checkout/obj/build/aarch64-unknown-linux-gnu/test/codegen-llvm/read_write_unaligned/read_write_unaligned.ll:19:2: note: 'next' match was here
ret i16 %_2.sroa.0.0.copyload
^
/checkout/obj/build/aarch64-unknown-linux-gnu/test/codegen-llvm/read_write_unaligned/read_write_unaligned.ll:16:53: note: previous match ended here
%_2.sroa.0.0.copyload = load i16, ptr %ptr, align 1
^
/checkout/obj/build/aarch64-unknown-linux-gnu/test/codegen-llvm/read_write_unaligned/read_write_unaligned.ll:17:1: note: non-matching line after previous match is here
%0 = icmp ne i16 %_2.sroa.0.0.copyload, 0
^
Input file: /checkout/obj/build/aarch64-unknown-linux-gnu/test/codegen-llvm/read_write_unaligned/read_write_unaligned.ll
Check file: /checkout/tests/codegen-llvm/read_write_unaligned.rs
-dump-input=help explains the following input dump.
Input was:
<<<<<<
1: ; ModuleID = 'read_write_unaligned.e30f5481d8566fd2-cgu.0' 2: source_filename = "read_write_unaligned.e30f5481d8566fd2-cgu.0" 3: target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128-Fn32" 4: target triple = "aarch64-unknown-linux-gnu" 5: 6: ; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable 7: define noundef nonnull ptr @read_unaligned_ptr(ptr noundef readonly captures(none) %ptr) unnamed_addr #0 { 8: start: 9: %_2.sroa.0.0.copyload = load ptr, ptr %ptr, align 1, !nonnull !4, !noundef !4 10: ret ptr %_2.sroa.0.0.copyload 11: } 12: 13: ; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read, inaccessiblemem: write) uwtable 14: define noundef range(i16 1, 0) i16 @read_unaligned_i16(ptr noundef readonly captures(none) %ptr) unnamed_addr #1 { 15: start: 16: %_2.sroa.0.0.copyload = load i16, ptr %ptr, align 1 17: %0 = icmp ne i16 %_2.sroa.0.0.copyload, 0 18: tail call void @llvm.assume(i1 %0) 19: ret i16 %_2.sroa.0.0.copyload next:27 !~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: match on wrong line
20: } 21: 22: ; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) uwtable 23: define void @typed_copy_unaligned_i32(ptr noundef readonly captures(none) %src, ptr noundef writeonly captures(none) initializes((0, 4)) %dst) unnamed_addr #2 { 24: start: 25: %_4.sroa.0.0.copyload = load i32, ptr %src, align 1 26: store i32 %_4.sroa.0.0.copyload, ptr %dst, align 1 27: ret void 28: } 29: 30: ; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: write) uwtable 31: define void @write_unaligned_i64(ptr noundef writeonly captures(none) initializes((0, 8)) %ptr, i64 noundef range(i64 1, 0) %val) unnamed_addr #3 { 32: start: 33: store i64 %val, ptr %ptr, align 1 34: ret void 35: } 36: 37: ; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) uwtable 38: define void @read_unaligned_huge(ptr dead_on_unwind noalias nofree noundef writable writeonly sret([8192 x i8]) align 128 captures(none) dereferenceable(8192) initializes((0, 8192)) %_0, ptr noundef readonly captures(none) %ptr) unnamed_addr #2 { 39: start: 40: tail call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 128 dereferenceable(8192) %_0, ptr noundef nonnull align 1 dereferenceable(8192) %ptr, i64 8192, i1 false) 41: ret void 42: } 43: 44: ; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) uwtable 45: define void @write_unaligned_huge(ptr noundef writeonly captures(none) initializes((0, 8192)) %ptr, ptr dead_on_return noalias nofree noundef readonly align 128 captures(none) dereferenceable(8192) %val) unnamed_addr #2 { 46: start: 47: tail call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 1 dereferenceable(8192) %ptr, ptr noundef nonnull align 128 dereferenceable(8192) %val, i64 8192, i1 false) 48: ret void 49: } 50: 51: ; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) 52: declare void @llvm.memcpy.p0.p0.i64(ptr noalias writeonly captures(none), ptr noalias readonly captures(none), i64, i1 immarg) #4 53: 54: ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(inaccessiblemem: write) 55: declare void @llvm.assume(i1 noundef) #5 56: 57: attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable "frame-pointer"="non-leaf" "probe-stack"="inline-asm" "target-cpu"="generic" "target-features"="+v8a,+outline-atomics" } 58: attributes #1 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read, inaccessiblemem: write) uwtable "frame-pointer"="non-leaf" "probe-stack"="inline-asm" "target-cpu"="generic" "target-features"="+v8a,+outline-atomics" } 59: attributes #2 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) uwtable "frame-pointer"="non-leaf" "probe-stack"="inline-asm" "target-cpu"="generic" "target-features"="+v8a,+outline-atomics" } 60: attributes #3 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: write) uwtable "frame-pointer"="non-leaf" "probe-stack"="inline-asm" "target-cpu"="generic" "target-features"="+v8a,+outline-atomics" } 61: attributes #4 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) } 62: attributes #5 = { mustprogress nocallback nofree nosync nounwind willreturn memory(inaccessiblemem: write) } 63: 64: !llvm.module.flags = !{!0, !1, !2} 65: !llvm.ident = !{!3} 66: 67: !0 = !{i32 8, !"PIC Level", i32 2} 68: !1 = !{i32 7, !"uwtable", i32 2} 69: !2 = !{i32 7, !"frame-pointer", i32 1} 70: !3 = !{!"rustc version 1.98.0-nightly (53db257c2 2026-06-25)"} 71: !4 = !{} >>>>>>
------------------------------------------
---- [codegen] tests/codegen-llvm/read_write_unaligned.rs stdout end ----

@rustbotrustbot removed the S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. label Jun 26, 2026
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants

@scottmcm@rustbot@rust-log-analyzer@mejrs@folkertdev
, 'i'); if (__m === '*' || __re.test(location.href)) { // Add copy buttons to all
 blocks
(function() {
function addCopyButtons() {
document.querySelectorAll('pre code').forEach(function(codeBlock) {
if (codeBlock.parentElement.hasAttribute('data-copy-added')) return;
codeBlock.parentElement.setAttribute('data-copy-added', 'true');
var btn = document.createElement('button');
btn.textContent = 'Copy';
btn.style.cssText = 'position:absolute;top:4px;right:4px;padding:2px 8px;font-size:11px;background:#4ecdc4;border:none;border-radius:4px;color:#1a1a2e;cursor:pointer;opacity:0.7;transition:opacity 0.2s;';
btn.onmouseover = function() { this.style.opacity = '1'; };
btn.onmouseout = function() { this.style.opacity = '0.7'; };
btn.onclick = function() {
navigator.clipboard.writeText(codeBlock.textContent).then(function() {
btn.textContent = 'Copied!';
setTimeout(function() { btn.textContent = 'Copy'; }, 1500);
});
};
codeBlock.parentElement.style.position = 'relative';
codeBlock.parentElement.appendChild(btn);
});
}
addCopyButtons();
// Re-run on dynamic content
var observer = new MutationObserver(addCopyButtons);
observer.observe(document.body, { childList: true, subtree: true });
})();
}
} catch(__e) { console.warn('[Userscript:Add Copy Buttons to Code Blocks]', __e); }
})();
(function(){
try {
var __m = "github.com";
var __re = new RegExp('^' + "github\\.com" + '
[only tests] Add tests for current read/write unaligned behaviour by scottmcm · Pull Request #158341 · rust-lang/rust · GitHub
Skip to content

[only tests] Add tests for current read/write unaligned behaviour - #158341

Closed
scottmcm wants to merge 2 commits into
rust-lang:mainfrom
scottmcm:unaligned-pinning
Closed

[only tests] Add tests for current read/write unaligned behaviour#158341
scottmcm wants to merge 2 commits into
rust-lang:mainfrom
scottmcm:unaligned-pinning

Conversation

@scottmcm

Copy link
Copy Markdown
Member

This adds some tests to record what we're currently doing for read_unaligned and write_unaligned.

I had part of this in #158202, but I'm going to close that in favour of a different approach (#158291 being the first part of that) so figured I'd check in tests showing current behaviour to help make the fix PRs clearer.

@rustbotrustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Jun 24, 2026
@rustbot

Copy link
Copy Markdown
Collaborator

r? @mejrs

rustbot has assigned @mejrs.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

Why was this reviewer chosen?

The reviewer was selected based on:

  • Owners of files modified in this PR: compiler
  • compiler expanded to 73 candidates
  • Random selection from 20 candidates

@rust-log-analyzer

This comment has been minimized.

@mejrs

Copy link
Copy Markdown
Member

I'm not qualified to review this sort of stuff

r? @folkertdev perhaps?

@rustbotrustbot assigned folkertdev and unassigned mejrsJun 24, 2026
@scottmcm
scottmcm marked this pull request as draft June 25, 2026 05:06
@scottmcm

Copy link
Copy Markdown
MemberAuthor

Moving to draft because it'll conflict with #158345

@rustbotrustbot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jun 25, 2026
@rust-log-analyzer

Copy link
Copy Markdown
Collaborator

The job aarch64-gnu-llvm-21-1 failed! Check out the build log: (web)(plain enhanced)(plain)

Click to see the possible cause of the failure (guessed by this bot)

---- [codegen] tests/codegen-llvm/read_write_unaligned.rs stdout ----
------FileCheck stdout------------------------------
------FileCheck stderr------------------------------
/checkout/tests/codegen-llvm/read_write_unaligned.rs:27:17: error: CHECK-NEXT: is not on the line after the previous match
// CHECK-NEXT: ret i16 [[TEMP]]
^
/checkout/obj/build/aarch64-unknown-linux-gnu/test/codegen-llvm/read_write_unaligned/read_write_unaligned.ll:19:2: note: 'next' match was here
ret i16 %_2.sroa.0.0.copyload
^
/checkout/obj/build/aarch64-unknown-linux-gnu/test/codegen-llvm/read_write_unaligned/read_write_unaligned.ll:16:53: note: previous match ended here
%_2.sroa.0.0.copyload = load i16, ptr %ptr, align 1
^
/checkout/obj/build/aarch64-unknown-linux-gnu/test/codegen-llvm/read_write_unaligned/read_write_unaligned.ll:17:1: note: non-matching line after previous match is here
%0 = icmp ne i16 %_2.sroa.0.0.copyload, 0
^
Input file: /checkout/obj/build/aarch64-unknown-linux-gnu/test/codegen-llvm/read_write_unaligned/read_write_unaligned.ll
Check file: /checkout/tests/codegen-llvm/read_write_unaligned.rs
-dump-input=help explains the following input dump.
Input was:
<<<<<<
1: ; ModuleID = 'read_write_unaligned.e30f5481d8566fd2-cgu.0' 2: source_filename = "read_write_unaligned.e30f5481d8566fd2-cgu.0" 3: target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128-Fn32" 4: target triple = "aarch64-unknown-linux-gnu" 5: 6: ; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable 7: define noundef nonnull ptr @read_unaligned_ptr(ptr noundef readonly captures(none) %ptr) unnamed_addr #0 { 8: start: 9: %_2.sroa.0.0.copyload = load ptr, ptr %ptr, align 1, !nonnull !4, !noundef !4 10: ret ptr %_2.sroa.0.0.copyload 11: } 12: 13: ; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read, inaccessiblemem: write) uwtable 14: define noundef range(i16 1, 0) i16 @read_unaligned_i16(ptr noundef readonly captures(none) %ptr) unnamed_addr #1 { 15: start: 16: %_2.sroa.0.0.copyload = load i16, ptr %ptr, align 1 17: %0 = icmp ne i16 %_2.sroa.0.0.copyload, 0 18: tail call void @llvm.assume(i1 %0) 19: ret i16 %_2.sroa.0.0.copyload next:27 !~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: match on wrong line
20: } 21: 22: ; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) uwtable 23: define void @typed_copy_unaligned_i32(ptr noundef readonly captures(none) %src, ptr noundef writeonly captures(none) initializes((0, 4)) %dst) unnamed_addr #2 { 24: start: 25: %_4.sroa.0.0.copyload = load i32, ptr %src, align 1 26: store i32 %_4.sroa.0.0.copyload, ptr %dst, align 1 27: ret void 28: } 29: 30: ; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: write) uwtable 31: define void @write_unaligned_i64(ptr noundef writeonly captures(none) initializes((0, 8)) %ptr, i64 noundef range(i64 1, 0) %val) unnamed_addr #3 { 32: start: 33: store i64 %val, ptr %ptr, align 1 34: ret void 35: } 36: 37: ; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) uwtable 38: define void @read_unaligned_huge(ptr dead_on_unwind noalias nofree noundef writable writeonly sret([8192 x i8]) align 128 captures(none) dereferenceable(8192) initializes((0, 8192)) %_0, ptr noundef readonly captures(none) %ptr) unnamed_addr #2 { 39: start: 40: tail call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 128 dereferenceable(8192) %_0, ptr noundef nonnull align 1 dereferenceable(8192) %ptr, i64 8192, i1 false) 41: ret void 42: } 43: 44: ; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) uwtable 45: define void @write_unaligned_huge(ptr noundef writeonly captures(none) initializes((0, 8192)) %ptr, ptr dead_on_return noalias nofree noundef readonly align 128 captures(none) dereferenceable(8192) %val) unnamed_addr #2 { 46: start: 47: tail call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 1 dereferenceable(8192) %ptr, ptr noundef nonnull align 128 dereferenceable(8192) %val, i64 8192, i1 false) 48: ret void 49: } 50: 51: ; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) 52: declare void @llvm.memcpy.p0.p0.i64(ptr noalias writeonly captures(none), ptr noalias readonly captures(none), i64, i1 immarg) #4 53: 54: ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(inaccessiblemem: write) 55: declare void @llvm.assume(i1 noundef) #5 56: 57: attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable "frame-pointer"="non-leaf" "probe-stack"="inline-asm" "target-cpu"="generic" "target-features"="+v8a,+outline-atomics" } 58: attributes #1 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read, inaccessiblemem: write) uwtable "frame-pointer"="non-leaf" "probe-stack"="inline-asm" "target-cpu"="generic" "target-features"="+v8a,+outline-atomics" } 59: attributes #2 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) uwtable "frame-pointer"="non-leaf" "probe-stack"="inline-asm" "target-cpu"="generic" "target-features"="+v8a,+outline-atomics" } 60: attributes #3 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: write) uwtable "frame-pointer"="non-leaf" "probe-stack"="inline-asm" "target-cpu"="generic" "target-features"="+v8a,+outline-atomics" } 61: attributes #4 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) } 62: attributes #5 = { mustprogress nocallback nofree nosync nounwind willreturn memory(inaccessiblemem: write) } 63: 64: !llvm.module.flags = !{!0, !1, !2} 65: !llvm.ident = !{!3} 66: 67: !0 = !{i32 8, !"PIC Level", i32 2} 68: !1 = !{i32 7, !"uwtable", i32 2} 69: !2 = !{i32 7, !"frame-pointer", i32 1} 70: !3 = !{!"rustc version 1.98.0-nightly (53db257c2 2026-06-25)"} 71: !4 = !{} >>>>>>
------------------------------------------
error: verification with 'FileCheck' failed
status: exit status: 1
command: "/usr/lib/llvm-21/bin/FileCheck" "--input-file" "/checkout/obj/build/aarch64-unknown-linux-gnu/test/codegen-llvm/read_write_unaligned/read_write_unaligned.ll" "/checkout/tests/codegen-llvm/read_write_unaligned.rs" "--check-prefix=CHECK" "--allow-unused-prefixes" "--dump-input-context" "100"
stdout: none
--- stderr -------------------------------
/checkout/tests/codegen-llvm/read_write_unaligned.rs:27:17: error: CHECK-NEXT: is not on the line after the previous match
// CHECK-NEXT: ret i16 [[TEMP]]
^
/checkout/obj/build/aarch64-unknown-linux-gnu/test/codegen-llvm/read_write_unaligned/read_write_unaligned.ll:19:2: note: 'next' match was here
ret i16 %_2.sroa.0.0.copyload
^
/checkout/obj/build/aarch64-unknown-linux-gnu/test/codegen-llvm/read_write_unaligned/read_write_unaligned.ll:16:53: note: previous match ended here
%_2.sroa.0.0.copyload = load i16, ptr %ptr, align 1
^
/checkout/obj/build/aarch64-unknown-linux-gnu/test/codegen-llvm/read_write_unaligned/read_write_unaligned.ll:17:1: note: non-matching line after previous match is here
%0 = icmp ne i16 %_2.sroa.0.0.copyload, 0
^
Input file: /checkout/obj/build/aarch64-unknown-linux-gnu/test/codegen-llvm/read_write_unaligned/read_write_unaligned.ll
Check file: /checkout/tests/codegen-llvm/read_write_unaligned.rs
-dump-input=help explains the following input dump.
Input was:
<<<<<<
1: ; ModuleID = 'read_write_unaligned.e30f5481d8566fd2-cgu.0' 2: source_filename = "read_write_unaligned.e30f5481d8566fd2-cgu.0" 3: target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128-Fn32" 4: target triple = "aarch64-unknown-linux-gnu" 5: 6: ; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable 7: define noundef nonnull ptr @read_unaligned_ptr(ptr noundef readonly captures(none) %ptr) unnamed_addr #0 { 8: start: 9: %_2.sroa.0.0.copyload = load ptr, ptr %ptr, align 1, !nonnull !4, !noundef !4 10: ret ptr %_2.sroa.0.0.copyload 11: } 12: 13: ; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read, inaccessiblemem: write) uwtable 14: define noundef range(i16 1, 0) i16 @read_unaligned_i16(ptr noundef readonly captures(none) %ptr) unnamed_addr #1 { 15: start: 16: %_2.sroa.0.0.copyload = load i16, ptr %ptr, align 1 17: %0 = icmp ne i16 %_2.sroa.0.0.copyload, 0 18: tail call void @llvm.assume(i1 %0) 19: ret i16 %_2.sroa.0.0.copyload next:27 !~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: match on wrong line
20: } 21: 22: ; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) uwtable 23: define void @typed_copy_unaligned_i32(ptr noundef readonly captures(none) %src, ptr noundef writeonly captures(none) initializes((0, 4)) %dst) unnamed_addr #2 { 24: start: 25: %_4.sroa.0.0.copyload = load i32, ptr %src, align 1 26: store i32 %_4.sroa.0.0.copyload, ptr %dst, align 1 27: ret void 28: } 29: 30: ; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: write) uwtable 31: define void @write_unaligned_i64(ptr noundef writeonly captures(none) initializes((0, 8)) %ptr, i64 noundef range(i64 1, 0) %val) unnamed_addr #3 { 32: start: 33: store i64 %val, ptr %ptr, align 1 34: ret void 35: } 36: 37: ; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) uwtable 38: define void @read_unaligned_huge(ptr dead_on_unwind noalias nofree noundef writable writeonly sret([8192 x i8]) align 128 captures(none) dereferenceable(8192) initializes((0, 8192)) %_0, ptr noundef readonly captures(none) %ptr) unnamed_addr #2 { 39: start: 40: tail call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 128 dereferenceable(8192) %_0, ptr noundef nonnull align 1 dereferenceable(8192) %ptr, i64 8192, i1 false) 41: ret void 42: } 43: 44: ; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) uwtable 45: define void @write_unaligned_huge(ptr noundef writeonly captures(none) initializes((0, 8192)) %ptr, ptr dead_on_return noalias nofree noundef readonly align 128 captures(none) dereferenceable(8192) %val) unnamed_addr #2 { 46: start: 47: tail call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 1 dereferenceable(8192) %ptr, ptr noundef nonnull align 128 dereferenceable(8192) %val, i64 8192, i1 false) 48: ret void 49: } 50: 51: ; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) 52: declare void @llvm.memcpy.p0.p0.i64(ptr noalias writeonly captures(none), ptr noalias readonly captures(none), i64, i1 immarg) #4 53: 54: ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(inaccessiblemem: write) 55: declare void @llvm.assume(i1 noundef) #5 56: 57: attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable "frame-pointer"="non-leaf" "probe-stack"="inline-asm" "target-cpu"="generic" "target-features"="+v8a,+outline-atomics" } 58: attributes #1 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read, inaccessiblemem: write) uwtable "frame-pointer"="non-leaf" "probe-stack"="inline-asm" "target-cpu"="generic" "target-features"="+v8a,+outline-atomics" } 59: attributes #2 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) uwtable "frame-pointer"="non-leaf" "probe-stack"="inline-asm" "target-cpu"="generic" "target-features"="+v8a,+outline-atomics" } 60: attributes #3 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: write) uwtable "frame-pointer"="non-leaf" "probe-stack"="inline-asm" "target-cpu"="generic" "target-features"="+v8a,+outline-atomics" } 61: attributes #4 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) } 62: attributes #5 = { mustprogress nocallback nofree nosync nounwind willreturn memory(inaccessiblemem: write) } 63: 64: !llvm.module.flags = !{!0, !1, !2} 65: !llvm.ident = !{!3} 66: 67: !0 = !{i32 8, !"PIC Level", i32 2} 68: !1 = !{i32 7, !"uwtable", i32 2} 69: !2 = !{i32 7, !"frame-pointer", i32 1} 70: !3 = !{!"rustc version 1.98.0-nightly (53db257c2 2026-06-25)"} 71: !4 = !{} >>>>>>
------------------------------------------
---- [codegen] tests/codegen-llvm/read_write_unaligned.rs stdout end ----

@rustbotrustbot removed the S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. label Jun 26, 2026
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants

@scottmcm@rustbot@rust-log-analyzer@mejrs@folkertdev
, 'i'); if (__m === '*' || __re.test(location.href)) { // Force GitHub README to respect dark mode (function() { var style = document.createElement('style'); style.textContent = ' .markdown-body { color-scheme: dark light; } .markdown-body pre { background: #161b22 !important; } .markdown-body code { background: rgba(110, 118, 129, 0.4) !important; } .markdown-body table th, .markdown-body table td { border-color: #30363d !important; } .markdown-body img { background: #0d1117; } .markdown-body blockquote { border-left-color: #8b949e; } .markdown-body hr { border-color: #30363d; } '; document.head.appendChild(style); })(); } } catch(__e) { console.warn('[Userscript:GitHub Dark Mode README Fix]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + ' [only tests] Add tests for current read/write unaligned behaviour by scottmcm · Pull Request #158341 · rust-lang/rust · GitHub
Skip to content

[only tests] Add tests for current read/write unaligned behaviour - #158341

Closed
scottmcm wants to merge 2 commits into
rust-lang:mainfrom
scottmcm:unaligned-pinning
Closed

[only tests] Add tests for current read/write unaligned behaviour#158341
scottmcm wants to merge 2 commits into
rust-lang:mainfrom
scottmcm:unaligned-pinning

Conversation

@scottmcm

Copy link
Copy Markdown
Member

This adds some tests to record what we're currently doing for read_unaligned and write_unaligned.

I had part of this in #158202, but I'm going to close that in favour of a different approach (#158291 being the first part of that) so figured I'd check in tests showing current behaviour to help make the fix PRs clearer.

@rustbotrustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Jun 24, 2026
@rustbot

Copy link
Copy Markdown
Collaborator

r? @mejrs

rustbot has assigned @mejrs.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

Why was this reviewer chosen?

The reviewer was selected based on:

  • Owners of files modified in this PR: compiler
  • compiler expanded to 73 candidates
  • Random selection from 20 candidates

@rust-log-analyzer

This comment has been minimized.

@mejrs

Copy link
Copy Markdown
Member

I'm not qualified to review this sort of stuff

r? @folkertdev perhaps?

@rustbotrustbot assigned folkertdev and unassigned mejrsJun 24, 2026
@scottmcm
scottmcm marked this pull request as draft June 25, 2026 05:06
@scottmcm

Copy link
Copy Markdown
MemberAuthor

Moving to draft because it'll conflict with #158345

@rustbotrustbot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jun 25, 2026
@rust-log-analyzer

Copy link
Copy Markdown
Collaborator

The job aarch64-gnu-llvm-21-1 failed! Check out the build log: (web)(plain enhanced)(plain)

Click to see the possible cause of the failure (guessed by this bot)

---- [codegen] tests/codegen-llvm/read_write_unaligned.rs stdout ----
------FileCheck stdout------------------------------
------FileCheck stderr------------------------------
/checkout/tests/codegen-llvm/read_write_unaligned.rs:27:17: error: CHECK-NEXT: is not on the line after the previous match
// CHECK-NEXT: ret i16 [[TEMP]]
^
/checkout/obj/build/aarch64-unknown-linux-gnu/test/codegen-llvm/read_write_unaligned/read_write_unaligned.ll:19:2: note: 'next' match was here
ret i16 %_2.sroa.0.0.copyload
^
/checkout/obj/build/aarch64-unknown-linux-gnu/test/codegen-llvm/read_write_unaligned/read_write_unaligned.ll:16:53: note: previous match ended here
%_2.sroa.0.0.copyload = load i16, ptr %ptr, align 1
^
/checkout/obj/build/aarch64-unknown-linux-gnu/test/codegen-llvm/read_write_unaligned/read_write_unaligned.ll:17:1: note: non-matching line after previous match is here
%0 = icmp ne i16 %_2.sroa.0.0.copyload, 0
^
Input file: /checkout/obj/build/aarch64-unknown-linux-gnu/test/codegen-llvm/read_write_unaligned/read_write_unaligned.ll
Check file: /checkout/tests/codegen-llvm/read_write_unaligned.rs
-dump-input=help explains the following input dump.
Input was:
<<<<<<
1: ; ModuleID = 'read_write_unaligned.e30f5481d8566fd2-cgu.0' 2: source_filename = "read_write_unaligned.e30f5481d8566fd2-cgu.0" 3: target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128-Fn32" 4: target triple = "aarch64-unknown-linux-gnu" 5: 6: ; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable 7: define noundef nonnull ptr @read_unaligned_ptr(ptr noundef readonly captures(none) %ptr) unnamed_addr #0 { 8: start: 9: %_2.sroa.0.0.copyload = load ptr, ptr %ptr, align 1, !nonnull !4, !noundef !4 10: ret ptr %_2.sroa.0.0.copyload 11: } 12: 13: ; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read, inaccessiblemem: write) uwtable 14: define noundef range(i16 1, 0) i16 @read_unaligned_i16(ptr noundef readonly captures(none) %ptr) unnamed_addr #1 { 15: start: 16: %_2.sroa.0.0.copyload = load i16, ptr %ptr, align 1 17: %0 = icmp ne i16 %_2.sroa.0.0.copyload, 0 18: tail call void @llvm.assume(i1 %0) 19: ret i16 %_2.sroa.0.0.copyload next:27 !~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: match on wrong line
20: } 21: 22: ; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) uwtable 23: define void @typed_copy_unaligned_i32(ptr noundef readonly captures(none) %src, ptr noundef writeonly captures(none) initializes((0, 4)) %dst) unnamed_addr #2 { 24: start: 25: %_4.sroa.0.0.copyload = load i32, ptr %src, align 1 26: store i32 %_4.sroa.0.0.copyload, ptr %dst, align 1 27: ret void 28: } 29: 30: ; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: write) uwtable 31: define void @write_unaligned_i64(ptr noundef writeonly captures(none) initializes((0, 8)) %ptr, i64 noundef range(i64 1, 0) %val) unnamed_addr #3 { 32: start: 33: store i64 %val, ptr %ptr, align 1 34: ret void 35: } 36: 37: ; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) uwtable 38: define void @read_unaligned_huge(ptr dead_on_unwind noalias nofree noundef writable writeonly sret([8192 x i8]) align 128 captures(none) dereferenceable(8192) initializes((0, 8192)) %_0, ptr noundef readonly captures(none) %ptr) unnamed_addr #2 { 39: start: 40: tail call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 128 dereferenceable(8192) %_0, ptr noundef nonnull align 1 dereferenceable(8192) %ptr, i64 8192, i1 false) 41: ret void 42: } 43: 44: ; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) uwtable 45: define void @write_unaligned_huge(ptr noundef writeonly captures(none) initializes((0, 8192)) %ptr, ptr dead_on_return noalias nofree noundef readonly align 128 captures(none) dereferenceable(8192) %val) unnamed_addr #2 { 46: start: 47: tail call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 1 dereferenceable(8192) %ptr, ptr noundef nonnull align 128 dereferenceable(8192) %val, i64 8192, i1 false) 48: ret void 49: } 50: 51: ; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) 52: declare void @llvm.memcpy.p0.p0.i64(ptr noalias writeonly captures(none), ptr noalias readonly captures(none), i64, i1 immarg) #4 53: 54: ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(inaccessiblemem: write) 55: declare void @llvm.assume(i1 noundef) #5 56: 57: attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable "frame-pointer"="non-leaf" "probe-stack"="inline-asm" "target-cpu"="generic" "target-features"="+v8a,+outline-atomics" } 58: attributes #1 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read, inaccessiblemem: write) uwtable "frame-pointer"="non-leaf" "probe-stack"="inline-asm" "target-cpu"="generic" "target-features"="+v8a,+outline-atomics" } 59: attributes #2 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) uwtable "frame-pointer"="non-leaf" "probe-stack"="inline-asm" "target-cpu"="generic" "target-features"="+v8a,+outline-atomics" } 60: attributes #3 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: write) uwtable "frame-pointer"="non-leaf" "probe-stack"="inline-asm" "target-cpu"="generic" "target-features"="+v8a,+outline-atomics" } 61: attributes #4 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) } 62: attributes #5 = { mustprogress nocallback nofree nosync nounwind willreturn memory(inaccessiblemem: write) } 63: 64: !llvm.module.flags = !{!0, !1, !2} 65: !llvm.ident = !{!3} 66: 67: !0 = !{i32 8, !"PIC Level", i32 2} 68: !1 = !{i32 7, !"uwtable", i32 2} 69: !2 = !{i32 7, !"frame-pointer", i32 1} 70: !3 = !{!"rustc version 1.98.0-nightly (53db257c2 2026-06-25)"} 71: !4 = !{} >>>>>>
------------------------------------------
error: verification with 'FileCheck' failed
status: exit status: 1
command: "/usr/lib/llvm-21/bin/FileCheck" "--input-file" "/checkout/obj/build/aarch64-unknown-linux-gnu/test/codegen-llvm/read_write_unaligned/read_write_unaligned.ll" "/checkout/tests/codegen-llvm/read_write_unaligned.rs" "--check-prefix=CHECK" "--allow-unused-prefixes" "--dump-input-context" "100"
stdout: none
--- stderr -------------------------------
/checkout/tests/codegen-llvm/read_write_unaligned.rs:27:17: error: CHECK-NEXT: is not on the line after the previous match
// CHECK-NEXT: ret i16 [[TEMP]]
^
/checkout/obj/build/aarch64-unknown-linux-gnu/test/codegen-llvm/read_write_unaligned/read_write_unaligned.ll:19:2: note: 'next' match was here
ret i16 %_2.sroa.0.0.copyload
^
/checkout/obj/build/aarch64-unknown-linux-gnu/test/codegen-llvm/read_write_unaligned/read_write_unaligned.ll:16:53: note: previous match ended here
%_2.sroa.0.0.copyload = load i16, ptr %ptr, align 1
^
/checkout/obj/build/aarch64-unknown-linux-gnu/test/codegen-llvm/read_write_unaligned/read_write_unaligned.ll:17:1: note: non-matching line after previous match is here
%0 = icmp ne i16 %_2.sroa.0.0.copyload, 0
^
Input file: /checkout/obj/build/aarch64-unknown-linux-gnu/test/codegen-llvm/read_write_unaligned/read_write_unaligned.ll
Check file: /checkout/tests/codegen-llvm/read_write_unaligned.rs
-dump-input=help explains the following input dump.
Input was:
<<<<<<
1: ; ModuleID = 'read_write_unaligned.e30f5481d8566fd2-cgu.0' 2: source_filename = "read_write_unaligned.e30f5481d8566fd2-cgu.0" 3: target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128-Fn32" 4: target triple = "aarch64-unknown-linux-gnu" 5: 6: ; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable 7: define noundef nonnull ptr @read_unaligned_ptr(ptr noundef readonly captures(none) %ptr) unnamed_addr #0 { 8: start: 9: %_2.sroa.0.0.copyload = load ptr, ptr %ptr, align 1, !nonnull !4, !noundef !4 10: ret ptr %_2.sroa.0.0.copyload 11: } 12: 13: ; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read, inaccessiblemem: write) uwtable 14: define noundef range(i16 1, 0) i16 @read_unaligned_i16(ptr noundef readonly captures(none) %ptr) unnamed_addr #1 { 15: start: 16: %_2.sroa.0.0.copyload = load i16, ptr %ptr, align 1 17: %0 = icmp ne i16 %_2.sroa.0.0.copyload, 0 18: tail call void @llvm.assume(i1 %0) 19: ret i16 %_2.sroa.0.0.copyload next:27 !~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: match on wrong line
20: } 21: 22: ; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) uwtable 23: define void @typed_copy_unaligned_i32(ptr noundef readonly captures(none) %src, ptr noundef writeonly captures(none) initializes((0, 4)) %dst) unnamed_addr #2 { 24: start: 25: %_4.sroa.0.0.copyload = load i32, ptr %src, align 1 26: store i32 %_4.sroa.0.0.copyload, ptr %dst, align 1 27: ret void 28: } 29: 30: ; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: write) uwtable 31: define void @write_unaligned_i64(ptr noundef writeonly captures(none) initializes((0, 8)) %ptr, i64 noundef range(i64 1, 0) %val) unnamed_addr #3 { 32: start: 33: store i64 %val, ptr %ptr, align 1 34: ret void 35: } 36: 37: ; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) uwtable 38: define void @read_unaligned_huge(ptr dead_on_unwind noalias nofree noundef writable writeonly sret([8192 x i8]) align 128 captures(none) dereferenceable(8192) initializes((0, 8192)) %_0, ptr noundef readonly captures(none) %ptr) unnamed_addr #2 { 39: start: 40: tail call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 128 dereferenceable(8192) %_0, ptr noundef nonnull align 1 dereferenceable(8192) %ptr, i64 8192, i1 false) 41: ret void 42: } 43: 44: ; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) uwtable 45: define void @write_unaligned_huge(ptr noundef writeonly captures(none) initializes((0, 8192)) %ptr, ptr dead_on_return noalias nofree noundef readonly align 128 captures(none) dereferenceable(8192) %val) unnamed_addr #2 { 46: start: 47: tail call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 1 dereferenceable(8192) %ptr, ptr noundef nonnull align 128 dereferenceable(8192) %val, i64 8192, i1 false) 48: ret void 49: } 50: 51: ; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) 52: declare void @llvm.memcpy.p0.p0.i64(ptr noalias writeonly captures(none), ptr noalias readonly captures(none), i64, i1 immarg) #4 53: 54: ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(inaccessiblemem: write) 55: declare void @llvm.assume(i1 noundef) #5 56: 57: attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable "frame-pointer"="non-leaf" "probe-stack"="inline-asm" "target-cpu"="generic" "target-features"="+v8a,+outline-atomics" } 58: attributes #1 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read, inaccessiblemem: write) uwtable "frame-pointer"="non-leaf" "probe-stack"="inline-asm" "target-cpu"="generic" "target-features"="+v8a,+outline-atomics" } 59: attributes #2 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) uwtable "frame-pointer"="non-leaf" "probe-stack"="inline-asm" "target-cpu"="generic" "target-features"="+v8a,+outline-atomics" } 60: attributes #3 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: write) uwtable "frame-pointer"="non-leaf" "probe-stack"="inline-asm" "target-cpu"="generic" "target-features"="+v8a,+outline-atomics" } 61: attributes #4 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) } 62: attributes #5 = { mustprogress nocallback nofree nosync nounwind willreturn memory(inaccessiblemem: write) } 63: 64: !llvm.module.flags = !{!0, !1, !2} 65: !llvm.ident = !{!3} 66: 67: !0 = !{i32 8, !"PIC Level", i32 2} 68: !1 = !{i32 7, !"uwtable", i32 2} 69: !2 = !{i32 7, !"frame-pointer", i32 1} 70: !3 = !{!"rustc version 1.98.0-nightly (53db257c2 2026-06-25)"} 71: !4 = !{} >>>>>>
------------------------------------------
---- [codegen] tests/codegen-llvm/read_write_unaligned.rs stdout end ----

@rustbotrustbot removed the S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. label Jun 26, 2026
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants

@scottmcm@rustbot@rust-log-analyzer@mejrs@folkertdev
, 'i'); if (__m === '*' || __re.test(location.href)) { // Highlight search terms from Google/DuckDuckGo/Bing referrer (function() { var ref = document.referrer; var terms = []; if (ref.includes('google.com') || ref.includes('duckduckgo.com') || ref.includes('bing.com')) { var url = new URL(ref); var q = url.searchParams.get('q') || url.searchParams.get('p'); if (q) { terms = q.split(/\s+/).filter(function(t) { return t.length > 2; }); } } if (terms.length === 0) return; var style = document.createElement('style'); style.textContent = '.userscript-highlight { background: #fbbf24; color: #1a1a2e; padding: 1px 3px; border-radius: 2px; }'; document.head.appendChild(style); function highlight(node) { if (node.nodeType === 3) { // text node var text = node.textContent; var found = false; terms.forEach(function(term) { var regex = new RegExp('(' + term.replace(/[.*+?^${}()|[\]\\]/g, '\\') + ')', 'gi'); if (regex.test(text)) { found = true; var frag = document.createDocumentFragment(); var parts = text.split(regex); parts.forEach(function(part, i) { if (i % 2 === 0) { frag.appendChild(document.createTextNode(part)); } else { var span = document.createElement('span'); span.className = 'userscript-highlight'; span.textContent = part; frag.appendChild(span); } }); node.parentNode.replaceChild(frag, node); } }); } else if (node.nodeType === 1 && node.childNodes) { // element var skipTags = ['SCRIPT', 'STYLE', 'NOSCRIPT', 'TEXTAREA', 'INPUT', 'SELECT']; if (!skipTags.includes(node.tagName)) { Array.from(node.childNodes).forEach(highlight); } } } highlight(document.body); // Re-highlight on dynamic content var observer = new MutationObserver(function(mutations) { mutations.forEach(function(m) { m.addedNodes.forEach(function(node) { if (node.nodeType === 1 || node.nodeType === 3) highlight(node); }); }); }); observer.observe(document.body, { childList: true, subtree: true }); })(); } } catch(__e) { console.warn('[Userscript:Highlight Search Terms]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + ' [only tests] Add tests for current read/write unaligned behaviour by scottmcm · Pull Request #158341 · rust-lang/rust · GitHub
Skip to content

[only tests] Add tests for current read/write unaligned behaviour - #158341

Closed
scottmcm wants to merge 2 commits into
rust-lang:mainfrom
scottmcm:unaligned-pinning
Closed

[only tests] Add tests for current read/write unaligned behaviour#158341
scottmcm wants to merge 2 commits into
rust-lang:mainfrom
scottmcm:unaligned-pinning

Conversation

@scottmcm

Copy link
Copy Markdown
Member

This adds some tests to record what we're currently doing for read_unaligned and write_unaligned.

I had part of this in #158202, but I'm going to close that in favour of a different approach (#158291 being the first part of that) so figured I'd check in tests showing current behaviour to help make the fix PRs clearer.

@rustbotrustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Jun 24, 2026
@rustbot

Copy link
Copy Markdown
Collaborator

r? @mejrs

rustbot has assigned @mejrs.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

Why was this reviewer chosen?

The reviewer was selected based on:

  • Owners of files modified in this PR: compiler
  • compiler expanded to 73 candidates
  • Random selection from 20 candidates

@rust-log-analyzer

This comment has been minimized.

@mejrs

Copy link
Copy Markdown
Member

I'm not qualified to review this sort of stuff

r? @folkertdev perhaps?

@rustbotrustbot assigned folkertdev and unassigned mejrsJun 24, 2026
@scottmcm
scottmcm marked this pull request as draft June 25, 2026 05:06
@scottmcm

Copy link
Copy Markdown
MemberAuthor

Moving to draft because it'll conflict with #158345

@rustbotrustbot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jun 25, 2026
@rust-log-analyzer

Copy link
Copy Markdown
Collaborator

The job aarch64-gnu-llvm-21-1 failed! Check out the build log: (web)(plain enhanced)(plain)

Click to see the possible cause of the failure (guessed by this bot)

---- [codegen] tests/codegen-llvm/read_write_unaligned.rs stdout ----
------FileCheck stdout------------------------------
------FileCheck stderr------------------------------
/checkout/tests/codegen-llvm/read_write_unaligned.rs:27:17: error: CHECK-NEXT: is not on the line after the previous match
// CHECK-NEXT: ret i16 [[TEMP]]
^
/checkout/obj/build/aarch64-unknown-linux-gnu/test/codegen-llvm/read_write_unaligned/read_write_unaligned.ll:19:2: note: 'next' match was here
ret i16 %_2.sroa.0.0.copyload
^
/checkout/obj/build/aarch64-unknown-linux-gnu/test/codegen-llvm/read_write_unaligned/read_write_unaligned.ll:16:53: note: previous match ended here
%_2.sroa.0.0.copyload = load i16, ptr %ptr, align 1
^
/checkout/obj/build/aarch64-unknown-linux-gnu/test/codegen-llvm/read_write_unaligned/read_write_unaligned.ll:17:1: note: non-matching line after previous match is here
%0 = icmp ne i16 %_2.sroa.0.0.copyload, 0
^
Input file: /checkout/obj/build/aarch64-unknown-linux-gnu/test/codegen-llvm/read_write_unaligned/read_write_unaligned.ll
Check file: /checkout/tests/codegen-llvm/read_write_unaligned.rs
-dump-input=help explains the following input dump.
Input was:
<<<<<<
1: ; ModuleID = 'read_write_unaligned.e30f5481d8566fd2-cgu.0' 2: source_filename = "read_write_unaligned.e30f5481d8566fd2-cgu.0" 3: target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128-Fn32" 4: target triple = "aarch64-unknown-linux-gnu" 5: 6: ; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable 7: define noundef nonnull ptr @read_unaligned_ptr(ptr noundef readonly captures(none) %ptr) unnamed_addr #0 { 8: start: 9: %_2.sroa.0.0.copyload = load ptr, ptr %ptr, align 1, !nonnull !4, !noundef !4 10: ret ptr %_2.sroa.0.0.copyload 11: } 12: 13: ; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read, inaccessiblemem: write) uwtable 14: define noundef range(i16 1, 0) i16 @read_unaligned_i16(ptr noundef readonly captures(none) %ptr) unnamed_addr #1 { 15: start: 16: %_2.sroa.0.0.copyload = load i16, ptr %ptr, align 1 17: %0 = icmp ne i16 %_2.sroa.0.0.copyload, 0 18: tail call void @llvm.assume(i1 %0) 19: ret i16 %_2.sroa.0.0.copyload next:27 !~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: match on wrong line
20: } 21: 22: ; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) uwtable 23: define void @typed_copy_unaligned_i32(ptr noundef readonly captures(none) %src, ptr noundef writeonly captures(none) initializes((0, 4)) %dst) unnamed_addr #2 { 24: start: 25: %_4.sroa.0.0.copyload = load i32, ptr %src, align 1 26: store i32 %_4.sroa.0.0.copyload, ptr %dst, align 1 27: ret void 28: } 29: 30: ; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: write) uwtable 31: define void @write_unaligned_i64(ptr noundef writeonly captures(none) initializes((0, 8)) %ptr, i64 noundef range(i64 1, 0) %val) unnamed_addr #3 { 32: start: 33: store i64 %val, ptr %ptr, align 1 34: ret void 35: } 36: 37: ; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) uwtable 38: define void @read_unaligned_huge(ptr dead_on_unwind noalias nofree noundef writable writeonly sret([8192 x i8]) align 128 captures(none) dereferenceable(8192) initializes((0, 8192)) %_0, ptr noundef readonly captures(none) %ptr) unnamed_addr #2 { 39: start: 40: tail call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 128 dereferenceable(8192) %_0, ptr noundef nonnull align 1 dereferenceable(8192) %ptr, i64 8192, i1 false) 41: ret void 42: } 43: 44: ; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) uwtable 45: define void @write_unaligned_huge(ptr noundef writeonly captures(none) initializes((0, 8192)) %ptr, ptr dead_on_return noalias nofree noundef readonly align 128 captures(none) dereferenceable(8192) %val) unnamed_addr #2 { 46: start: 47: tail call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 1 dereferenceable(8192) %ptr, ptr noundef nonnull align 128 dereferenceable(8192) %val, i64 8192, i1 false) 48: ret void 49: } 50: 51: ; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) 52: declare void @llvm.memcpy.p0.p0.i64(ptr noalias writeonly captures(none), ptr noalias readonly captures(none), i64, i1 immarg) #4 53: 54: ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(inaccessiblemem: write) 55: declare void @llvm.assume(i1 noundef) #5 56: 57: attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable "frame-pointer"="non-leaf" "probe-stack"="inline-asm" "target-cpu"="generic" "target-features"="+v8a,+outline-atomics" } 58: attributes #1 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read, inaccessiblemem: write) uwtable "frame-pointer"="non-leaf" "probe-stack"="inline-asm" "target-cpu"="generic" "target-features"="+v8a,+outline-atomics" } 59: attributes #2 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) uwtable "frame-pointer"="non-leaf" "probe-stack"="inline-asm" "target-cpu"="generic" "target-features"="+v8a,+outline-atomics" } 60: attributes #3 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: write) uwtable "frame-pointer"="non-leaf" "probe-stack"="inline-asm" "target-cpu"="generic" "target-features"="+v8a,+outline-atomics" } 61: attributes #4 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) } 62: attributes #5 = { mustprogress nocallback nofree nosync nounwind willreturn memory(inaccessiblemem: write) } 63: 64: !llvm.module.flags = !{!0, !1, !2} 65: !llvm.ident = !{!3} 66: 67: !0 = !{i32 8, !"PIC Level", i32 2} 68: !1 = !{i32 7, !"uwtable", i32 2} 69: !2 = !{i32 7, !"frame-pointer", i32 1} 70: !3 = !{!"rustc version 1.98.0-nightly (53db257c2 2026-06-25)"} 71: !4 = !{} >>>>>>
------------------------------------------
error: verification with 'FileCheck' failed
status: exit status: 1
command: "/usr/lib/llvm-21/bin/FileCheck" "--input-file" "/checkout/obj/build/aarch64-unknown-linux-gnu/test/codegen-llvm/read_write_unaligned/read_write_unaligned.ll" "/checkout/tests/codegen-llvm/read_write_unaligned.rs" "--check-prefix=CHECK" "--allow-unused-prefixes" "--dump-input-context" "100"
stdout: none
--- stderr -------------------------------
/checkout/tests/codegen-llvm/read_write_unaligned.rs:27:17: error: CHECK-NEXT: is not on the line after the previous match
// CHECK-NEXT: ret i16 [[TEMP]]
^
/checkout/obj/build/aarch64-unknown-linux-gnu/test/codegen-llvm/read_write_unaligned/read_write_unaligned.ll:19:2: note: 'next' match was here
ret i16 %_2.sroa.0.0.copyload
^
/checkout/obj/build/aarch64-unknown-linux-gnu/test/codegen-llvm/read_write_unaligned/read_write_unaligned.ll:16:53: note: previous match ended here
%_2.sroa.0.0.copyload = load i16, ptr %ptr, align 1
^
/checkout/obj/build/aarch64-unknown-linux-gnu/test/codegen-llvm/read_write_unaligned/read_write_unaligned.ll:17:1: note: non-matching line after previous match is here
%0 = icmp ne i16 %_2.sroa.0.0.copyload, 0
^
Input file: /checkout/obj/build/aarch64-unknown-linux-gnu/test/codegen-llvm/read_write_unaligned/read_write_unaligned.ll
Check file: /checkout/tests/codegen-llvm/read_write_unaligned.rs
-dump-input=help explains the following input dump.
Input was:
<<<<<<
1: ; ModuleID = 'read_write_unaligned.e30f5481d8566fd2-cgu.0' 2: source_filename = "read_write_unaligned.e30f5481d8566fd2-cgu.0" 3: target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128-Fn32" 4: target triple = "aarch64-unknown-linux-gnu" 5: 6: ; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable 7: define noundef nonnull ptr @read_unaligned_ptr(ptr noundef readonly captures(none) %ptr) unnamed_addr #0 { 8: start: 9: %_2.sroa.0.0.copyload = load ptr, ptr %ptr, align 1, !nonnull !4, !noundef !4 10: ret ptr %_2.sroa.0.0.copyload 11: } 12: 13: ; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read, inaccessiblemem: write) uwtable 14: define noundef range(i16 1, 0) i16 @read_unaligned_i16(ptr noundef readonly captures(none) %ptr) unnamed_addr #1 { 15: start: 16: %_2.sroa.0.0.copyload = load i16, ptr %ptr, align 1 17: %0 = icmp ne i16 %_2.sroa.0.0.copyload, 0 18: tail call void @llvm.assume(i1 %0) 19: ret i16 %_2.sroa.0.0.copyload next:27 !~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: match on wrong line
20: } 21: 22: ; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) uwtable 23: define void @typed_copy_unaligned_i32(ptr noundef readonly captures(none) %src, ptr noundef writeonly captures(none) initializes((0, 4)) %dst) unnamed_addr #2 { 24: start: 25: %_4.sroa.0.0.copyload = load i32, ptr %src, align 1 26: store i32 %_4.sroa.0.0.copyload, ptr %dst, align 1 27: ret void 28: } 29: 30: ; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: write) uwtable 31: define void @write_unaligned_i64(ptr noundef writeonly captures(none) initializes((0, 8)) %ptr, i64 noundef range(i64 1, 0) %val) unnamed_addr #3 { 32: start: 33: store i64 %val, ptr %ptr, align 1 34: ret void 35: } 36: 37: ; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) uwtable 38: define void @read_unaligned_huge(ptr dead_on_unwind noalias nofree noundef writable writeonly sret([8192 x i8]) align 128 captures(none) dereferenceable(8192) initializes((0, 8192)) %_0, ptr noundef readonly captures(none) %ptr) unnamed_addr #2 { 39: start: 40: tail call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 128 dereferenceable(8192) %_0, ptr noundef nonnull align 1 dereferenceable(8192) %ptr, i64 8192, i1 false) 41: ret void 42: } 43: 44: ; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) uwtable 45: define void @write_unaligned_huge(ptr noundef writeonly captures(none) initializes((0, 8192)) %ptr, ptr dead_on_return noalias nofree noundef readonly align 128 captures(none) dereferenceable(8192) %val) unnamed_addr #2 { 46: start: 47: tail call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 1 dereferenceable(8192) %ptr, ptr noundef nonnull align 128 dereferenceable(8192) %val, i64 8192, i1 false) 48: ret void 49: } 50: 51: ; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) 52: declare void @llvm.memcpy.p0.p0.i64(ptr noalias writeonly captures(none), ptr noalias readonly captures(none), i64, i1 immarg) #4 53: 54: ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(inaccessiblemem: write) 55: declare void @llvm.assume(i1 noundef) #5 56: 57: attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable "frame-pointer"="non-leaf" "probe-stack"="inline-asm" "target-cpu"="generic" "target-features"="+v8a,+outline-atomics" } 58: attributes #1 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read, inaccessiblemem: write) uwtable "frame-pointer"="non-leaf" "probe-stack"="inline-asm" "target-cpu"="generic" "target-features"="+v8a,+outline-atomics" } 59: attributes #2 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) uwtable "frame-pointer"="non-leaf" "probe-stack"="inline-asm" "target-cpu"="generic" "target-features"="+v8a,+outline-atomics" } 60: attributes #3 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: write) uwtable "frame-pointer"="non-leaf" "probe-stack"="inline-asm" "target-cpu"="generic" "target-features"="+v8a,+outline-atomics" } 61: attributes #4 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) } 62: attributes #5 = { mustprogress nocallback nofree nosync nounwind willreturn memory(inaccessiblemem: write) } 63: 64: !llvm.module.flags = !{!0, !1, !2} 65: !llvm.ident = !{!3} 66: 67: !0 = !{i32 8, !"PIC Level", i32 2} 68: !1 = !{i32 7, !"uwtable", i32 2} 69: !2 = !{i32 7, !"frame-pointer", i32 1} 70: !3 = !{!"rustc version 1.98.0-nightly (53db257c2 2026-06-25)"} 71: !4 = !{} >>>>>>
------------------------------------------
---- [codegen] tests/codegen-llvm/read_write_unaligned.rs stdout end ----

@rustbotrustbot removed the S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. label Jun 26, 2026
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants

@scottmcm@rustbot@rust-log-analyzer@mejrs@folkertdev
, 'i'); if (__m === '*' || __re.test(location.href)) { // Strip utm_, fbclid, gclid, etc. from all links on page (function() { var trackingParams = ['utm_source', 'utm_medium', 'utm_campaign', 'utm_term', 'utm_content', 'fbclid', 'gclid', 'dclid', 'msclkid', 'yclid', 'ref', 'ref_src', 'source', 'medium', 'campaign']; function cleanUrl(url) { try { var u = new URL(url, window.location.origin); var changed = false; trackingParams.forEach(function(p) { if (u.searchParams.has(p)) { u.searchParams.delete(p); changed = true; } }); return changed ? u.toString() : url; } catch (e) { return url; } } function cleanLinks() { document.querySelectorAll('a[href]').forEach(function(a) { var clean = cleanUrl(a.href); if (clean !== a.href) a.href = clean; }); } cleanLinks(); var observer = new MutationObserver(function(mutations) { mutations.forEach(function(m) { m.addedNodes.forEach(function(node) { if (node.nodeType === 1) { if (node.tagName === 'A') cleanLinks(); node.querySelectorAll('a[href]').forEach(function(a) { var clean = cleanUrl(a.href); if (clean !== a.href) a.href = clean; }); } }); }); }); observer.observe(document.body, { childList: true, subtree: true }); })(); } } catch(__e) { console.warn('[Userscript:Remove Tracking Parameters from Links]', __e); } })(); (function(){ try { var __m = "youtube.com"; var __re = new RegExp('^' + "youtube\\.com" + ' [only tests] Add tests for current read/write unaligned behaviour by scottmcm · Pull Request #158341 · rust-lang/rust · GitHub
Skip to content

[only tests] Add tests for current read/write unaligned behaviour - #158341

Closed
scottmcm wants to merge 2 commits into
rust-lang:mainfrom
scottmcm:unaligned-pinning
Closed

[only tests] Add tests for current read/write unaligned behaviour#158341
scottmcm wants to merge 2 commits into
rust-lang:mainfrom
scottmcm:unaligned-pinning

Conversation

@scottmcm

Copy link
Copy Markdown
Member

This adds some tests to record what we're currently doing for read_unaligned and write_unaligned.

I had part of this in #158202, but I'm going to close that in favour of a different approach (#158291 being the first part of that) so figured I'd check in tests showing current behaviour to help make the fix PRs clearer.

@rustbotrustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Jun 24, 2026
@rustbot

Copy link
Copy Markdown
Collaborator

r? @mejrs

rustbot has assigned @mejrs.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

Why was this reviewer chosen?

The reviewer was selected based on:

  • Owners of files modified in this PR: compiler
  • compiler expanded to 73 candidates
  • Random selection from 20 candidates

@rust-log-analyzer

This comment has been minimized.

@mejrs

Copy link
Copy Markdown
Member

I'm not qualified to review this sort of stuff

r? @folkertdev perhaps?

@rustbotrustbot assigned folkertdev and unassigned mejrsJun 24, 2026
@scottmcm
scottmcm marked this pull request as draft June 25, 2026 05:06
@scottmcm

Copy link
Copy Markdown
MemberAuthor

Moving to draft because it'll conflict with #158345

@rustbotrustbot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jun 25, 2026
@rust-log-analyzer

Copy link
Copy Markdown
Collaborator

The job aarch64-gnu-llvm-21-1 failed! Check out the build log: (web)(plain enhanced)(plain)

Click to see the possible cause of the failure (guessed by this bot)

---- [codegen] tests/codegen-llvm/read_write_unaligned.rs stdout ----
------FileCheck stdout------------------------------
------FileCheck stderr------------------------------
/checkout/tests/codegen-llvm/read_write_unaligned.rs:27:17: error: CHECK-NEXT: is not on the line after the previous match
// CHECK-NEXT: ret i16 [[TEMP]]
^
/checkout/obj/build/aarch64-unknown-linux-gnu/test/codegen-llvm/read_write_unaligned/read_write_unaligned.ll:19:2: note: 'next' match was here
ret i16 %_2.sroa.0.0.copyload
^
/checkout/obj/build/aarch64-unknown-linux-gnu/test/codegen-llvm/read_write_unaligned/read_write_unaligned.ll:16:53: note: previous match ended here
%_2.sroa.0.0.copyload = load i16, ptr %ptr, align 1
^
/checkout/obj/build/aarch64-unknown-linux-gnu/test/codegen-llvm/read_write_unaligned/read_write_unaligned.ll:17:1: note: non-matching line after previous match is here
%0 = icmp ne i16 %_2.sroa.0.0.copyload, 0
^
Input file: /checkout/obj/build/aarch64-unknown-linux-gnu/test/codegen-llvm/read_write_unaligned/read_write_unaligned.ll
Check file: /checkout/tests/codegen-llvm/read_write_unaligned.rs
-dump-input=help explains the following input dump.
Input was:
<<<<<<
1: ; ModuleID = 'read_write_unaligned.e30f5481d8566fd2-cgu.0' 2: source_filename = "read_write_unaligned.e30f5481d8566fd2-cgu.0" 3: target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128-Fn32" 4: target triple = "aarch64-unknown-linux-gnu" 5: 6: ; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable 7: define noundef nonnull ptr @read_unaligned_ptr(ptr noundef readonly captures(none) %ptr) unnamed_addr #0 { 8: start: 9: %_2.sroa.0.0.copyload = load ptr, ptr %ptr, align 1, !nonnull !4, !noundef !4 10: ret ptr %_2.sroa.0.0.copyload 11: } 12: 13: ; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read, inaccessiblemem: write) uwtable 14: define noundef range(i16 1, 0) i16 @read_unaligned_i16(ptr noundef readonly captures(none) %ptr) unnamed_addr #1 { 15: start: 16: %_2.sroa.0.0.copyload = load i16, ptr %ptr, align 1 17: %0 = icmp ne i16 %_2.sroa.0.0.copyload, 0 18: tail call void @llvm.assume(i1 %0) 19: ret i16 %_2.sroa.0.0.copyload next:27 !~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: match on wrong line
20: } 21: 22: ; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) uwtable 23: define void @typed_copy_unaligned_i32(ptr noundef readonly captures(none) %src, ptr noundef writeonly captures(none) initializes((0, 4)) %dst) unnamed_addr #2 { 24: start: 25: %_4.sroa.0.0.copyload = load i32, ptr %src, align 1 26: store i32 %_4.sroa.0.0.copyload, ptr %dst, align 1 27: ret void 28: } 29: 30: ; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: write) uwtable 31: define void @write_unaligned_i64(ptr noundef writeonly captures(none) initializes((0, 8)) %ptr, i64 noundef range(i64 1, 0) %val) unnamed_addr #3 { 32: start: 33: store i64 %val, ptr %ptr, align 1 34: ret void 35: } 36: 37: ; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) uwtable 38: define void @read_unaligned_huge(ptr dead_on_unwind noalias nofree noundef writable writeonly sret([8192 x i8]) align 128 captures(none) dereferenceable(8192) initializes((0, 8192)) %_0, ptr noundef readonly captures(none) %ptr) unnamed_addr #2 { 39: start: 40: tail call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 128 dereferenceable(8192) %_0, ptr noundef nonnull align 1 dereferenceable(8192) %ptr, i64 8192, i1 false) 41: ret void 42: } 43: 44: ; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) uwtable 45: define void @write_unaligned_huge(ptr noundef writeonly captures(none) initializes((0, 8192)) %ptr, ptr dead_on_return noalias nofree noundef readonly align 128 captures(none) dereferenceable(8192) %val) unnamed_addr #2 { 46: start: 47: tail call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 1 dereferenceable(8192) %ptr, ptr noundef nonnull align 128 dereferenceable(8192) %val, i64 8192, i1 false) 48: ret void 49: } 50: 51: ; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) 52: declare void @llvm.memcpy.p0.p0.i64(ptr noalias writeonly captures(none), ptr noalias readonly captures(none), i64, i1 immarg) #4 53: 54: ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(inaccessiblemem: write) 55: declare void @llvm.assume(i1 noundef) #5 56: 57: attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable "frame-pointer"="non-leaf" "probe-stack"="inline-asm" "target-cpu"="generic" "target-features"="+v8a,+outline-atomics" } 58: attributes #1 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read, inaccessiblemem: write) uwtable "frame-pointer"="non-leaf" "probe-stack"="inline-asm" "target-cpu"="generic" "target-features"="+v8a,+outline-atomics" } 59: attributes #2 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) uwtable "frame-pointer"="non-leaf" "probe-stack"="inline-asm" "target-cpu"="generic" "target-features"="+v8a,+outline-atomics" } 60: attributes #3 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: write) uwtable "frame-pointer"="non-leaf" "probe-stack"="inline-asm" "target-cpu"="generic" "target-features"="+v8a,+outline-atomics" } 61: attributes #4 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) } 62: attributes #5 = { mustprogress nocallback nofree nosync nounwind willreturn memory(inaccessiblemem: write) } 63: 64: !llvm.module.flags = !{!0, !1, !2} 65: !llvm.ident = !{!3} 66: 67: !0 = !{i32 8, !"PIC Level", i32 2} 68: !1 = !{i32 7, !"uwtable", i32 2} 69: !2 = !{i32 7, !"frame-pointer", i32 1} 70: !3 = !{!"rustc version 1.98.0-nightly (53db257c2 2026-06-25)"} 71: !4 = !{} >>>>>>
------------------------------------------
error: verification with 'FileCheck' failed
status: exit status: 1
command: "/usr/lib/llvm-21/bin/FileCheck" "--input-file" "/checkout/obj/build/aarch64-unknown-linux-gnu/test/codegen-llvm/read_write_unaligned/read_write_unaligned.ll" "/checkout/tests/codegen-llvm/read_write_unaligned.rs" "--check-prefix=CHECK" "--allow-unused-prefixes" "--dump-input-context" "100"
stdout: none
--- stderr -------------------------------
/checkout/tests/codegen-llvm/read_write_unaligned.rs:27:17: error: CHECK-NEXT: is not on the line after the previous match
// CHECK-NEXT: ret i16 [[TEMP]]
^
/checkout/obj/build/aarch64-unknown-linux-gnu/test/codegen-llvm/read_write_unaligned/read_write_unaligned.ll:19:2: note: 'next' match was here
ret i16 %_2.sroa.0.0.copyload
^
/checkout/obj/build/aarch64-unknown-linux-gnu/test/codegen-llvm/read_write_unaligned/read_write_unaligned.ll:16:53: note: previous match ended here
%_2.sroa.0.0.copyload = load i16, ptr %ptr, align 1
^
/checkout/obj/build/aarch64-unknown-linux-gnu/test/codegen-llvm/read_write_unaligned/read_write_unaligned.ll:17:1: note: non-matching line after previous match is here
%0 = icmp ne i16 %_2.sroa.0.0.copyload, 0
^
Input file: /checkout/obj/build/aarch64-unknown-linux-gnu/test/codegen-llvm/read_write_unaligned/read_write_unaligned.ll
Check file: /checkout/tests/codegen-llvm/read_write_unaligned.rs
-dump-input=help explains the following input dump.
Input was:
<<<<<<
1: ; ModuleID = 'read_write_unaligned.e30f5481d8566fd2-cgu.0' 2: source_filename = "read_write_unaligned.e30f5481d8566fd2-cgu.0" 3: target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128-Fn32" 4: target triple = "aarch64-unknown-linux-gnu" 5: 6: ; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable 7: define noundef nonnull ptr @read_unaligned_ptr(ptr noundef readonly captures(none) %ptr) unnamed_addr #0 { 8: start: 9: %_2.sroa.0.0.copyload = load ptr, ptr %ptr, align 1, !nonnull !4, !noundef !4 10: ret ptr %_2.sroa.0.0.copyload 11: } 12: 13: ; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read, inaccessiblemem: write) uwtable 14: define noundef range(i16 1, 0) i16 @read_unaligned_i16(ptr noundef readonly captures(none) %ptr) unnamed_addr #1 { 15: start: 16: %_2.sroa.0.0.copyload = load i16, ptr %ptr, align 1 17: %0 = icmp ne i16 %_2.sroa.0.0.copyload, 0 18: tail call void @llvm.assume(i1 %0) 19: ret i16 %_2.sroa.0.0.copyload next:27 !~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: match on wrong line
20: } 21: 22: ; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) uwtable 23: define void @typed_copy_unaligned_i32(ptr noundef readonly captures(none) %src, ptr noundef writeonly captures(none) initializes((0, 4)) %dst) unnamed_addr #2 { 24: start: 25: %_4.sroa.0.0.copyload = load i32, ptr %src, align 1 26: store i32 %_4.sroa.0.0.copyload, ptr %dst, align 1 27: ret void 28: } 29: 30: ; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: write) uwtable 31: define void @write_unaligned_i64(ptr noundef writeonly captures(none) initializes((0, 8)) %ptr, i64 noundef range(i64 1, 0) %val) unnamed_addr #3 { 32: start: 33: store i64 %val, ptr %ptr, align 1 34: ret void 35: } 36: 37: ; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) uwtable 38: define void @read_unaligned_huge(ptr dead_on_unwind noalias nofree noundef writable writeonly sret([8192 x i8]) align 128 captures(none) dereferenceable(8192) initializes((0, 8192)) %_0, ptr noundef readonly captures(none) %ptr) unnamed_addr #2 { 39: start: 40: tail call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 128 dereferenceable(8192) %_0, ptr noundef nonnull align 1 dereferenceable(8192) %ptr, i64 8192, i1 false) 41: ret void 42: } 43: 44: ; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) uwtable 45: define void @write_unaligned_huge(ptr noundef writeonly captures(none) initializes((0, 8192)) %ptr, ptr dead_on_return noalias nofree noundef readonly align 128 captures(none) dereferenceable(8192) %val) unnamed_addr #2 { 46: start: 47: tail call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 1 dereferenceable(8192) %ptr, ptr noundef nonnull align 128 dereferenceable(8192) %val, i64 8192, i1 false) 48: ret void 49: } 50: 51: ; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) 52: declare void @llvm.memcpy.p0.p0.i64(ptr noalias writeonly captures(none), ptr noalias readonly captures(none), i64, i1 immarg) #4 53: 54: ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(inaccessiblemem: write) 55: declare void @llvm.assume(i1 noundef) #5 56: 57: attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable "frame-pointer"="non-leaf" "probe-stack"="inline-asm" "target-cpu"="generic" "target-features"="+v8a,+outline-atomics" } 58: attributes #1 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read, inaccessiblemem: write) uwtable "frame-pointer"="non-leaf" "probe-stack"="inline-asm" "target-cpu"="generic" "target-features"="+v8a,+outline-atomics" } 59: attributes #2 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) uwtable "frame-pointer"="non-leaf" "probe-stack"="inline-asm" "target-cpu"="generic" "target-features"="+v8a,+outline-atomics" } 60: attributes #3 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: write) uwtable "frame-pointer"="non-leaf" "probe-stack"="inline-asm" "target-cpu"="generic" "target-features"="+v8a,+outline-atomics" } 61: attributes #4 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) } 62: attributes #5 = { mustprogress nocallback nofree nosync nounwind willreturn memory(inaccessiblemem: write) } 63: 64: !llvm.module.flags = !{!0, !1, !2} 65: !llvm.ident = !{!3} 66: 67: !0 = !{i32 8, !"PIC Level", i32 2} 68: !1 = !{i32 7, !"uwtable", i32 2} 69: !2 = !{i32 7, !"frame-pointer", i32 1} 70: !3 = !{!"rustc version 1.98.0-nightly (53db257c2 2026-06-25)"} 71: !4 = !{} >>>>>>
------------------------------------------
---- [codegen] tests/codegen-llvm/read_write_unaligned.rs stdout end ----

@rustbotrustbot removed the S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. label Jun 26, 2026
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants

@scottmcm@rustbot@rust-log-analyzer@mejrs@folkertdev
, 'i'); if (__m === '*' || __re.test(location.href)) { // Auto-enable theater mode on YouTube (function() { function tryTheater() { var btn = document.querySelector('button[aria-label="Theater mode"], ytd-player #player button[title="Theater mode"]'); if (btn && !btn.classList.contains('activated')) { btn.click(); } } // Try immediately tryTheater(); // Try after navigation (SPA) var lastUrl = location.href; setInterval(function() { if (location.href !== lastUrl) { lastUrl = location.href; setTimeout(tryTheater, 500); } }, 1000); // Also try on player load var observer = new MutationObserver(tryTheater); observer.observe(document.body, { childList: true, subtree: true }); })(); } } catch(__e) { console.warn('[Userscript:YouTube Theater Mode Default]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + ' [only tests] Add tests for current read/write unaligned behaviour by scottmcm · Pull Request #158341 · rust-lang/rust · GitHub
Skip to content

[only tests] Add tests for current read/write unaligned behaviour - #158341

Closed
scottmcm wants to merge 2 commits into
rust-lang:mainfrom
scottmcm:unaligned-pinning
Closed

[only tests] Add tests for current read/write unaligned behaviour#158341
scottmcm wants to merge 2 commits into
rust-lang:mainfrom
scottmcm:unaligned-pinning

Conversation

@scottmcm

Copy link
Copy Markdown
Member

This adds some tests to record what we're currently doing for read_unaligned and write_unaligned.

I had part of this in #158202, but I'm going to close that in favour of a different approach (#158291 being the first part of that) so figured I'd check in tests showing current behaviour to help make the fix PRs clearer.

@rustbotrustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Jun 24, 2026
@rustbot

Copy link
Copy Markdown
Collaborator

r? @mejrs

rustbot has assigned @mejrs.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

Why was this reviewer chosen?

The reviewer was selected based on:

  • Owners of files modified in this PR: compiler
  • compiler expanded to 73 candidates
  • Random selection from 20 candidates

@rust-log-analyzer

This comment has been minimized.

@mejrs

Copy link
Copy Markdown
Member

I'm not qualified to review this sort of stuff

r? @folkertdev perhaps?

@rustbotrustbot assigned folkertdev and unassigned mejrsJun 24, 2026
@scottmcm
scottmcm marked this pull request as draft June 25, 2026 05:06
@scottmcm

Copy link
Copy Markdown
MemberAuthor

Moving to draft because it'll conflict with #158345

@rustbotrustbot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jun 25, 2026
@rust-log-analyzer

Copy link
Copy Markdown
Collaborator

The job aarch64-gnu-llvm-21-1 failed! Check out the build log: (web)(plain enhanced)(plain)

Click to see the possible cause of the failure (guessed by this bot)

---- [codegen] tests/codegen-llvm/read_write_unaligned.rs stdout ----
------FileCheck stdout------------------------------
------FileCheck stderr------------------------------
/checkout/tests/codegen-llvm/read_write_unaligned.rs:27:17: error: CHECK-NEXT: is not on the line after the previous match
// CHECK-NEXT: ret i16 [[TEMP]]
^
/checkout/obj/build/aarch64-unknown-linux-gnu/test/codegen-llvm/read_write_unaligned/read_write_unaligned.ll:19:2: note: 'next' match was here
ret i16 %_2.sroa.0.0.copyload
^
/checkout/obj/build/aarch64-unknown-linux-gnu/test/codegen-llvm/read_write_unaligned/read_write_unaligned.ll:16:53: note: previous match ended here
%_2.sroa.0.0.copyload = load i16, ptr %ptr, align 1
^
/checkout/obj/build/aarch64-unknown-linux-gnu/test/codegen-llvm/read_write_unaligned/read_write_unaligned.ll:17:1: note: non-matching line after previous match is here
%0 = icmp ne i16 %_2.sroa.0.0.copyload, 0
^
Input file: /checkout/obj/build/aarch64-unknown-linux-gnu/test/codegen-llvm/read_write_unaligned/read_write_unaligned.ll
Check file: /checkout/tests/codegen-llvm/read_write_unaligned.rs
-dump-input=help explains the following input dump.
Input was:
<<<<<<
1: ; ModuleID = 'read_write_unaligned.e30f5481d8566fd2-cgu.0' 2: source_filename = "read_write_unaligned.e30f5481d8566fd2-cgu.0" 3: target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128-Fn32" 4: target triple = "aarch64-unknown-linux-gnu" 5: 6: ; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable 7: define noundef nonnull ptr @read_unaligned_ptr(ptr noundef readonly captures(none) %ptr) unnamed_addr #0 { 8: start: 9: %_2.sroa.0.0.copyload = load ptr, ptr %ptr, align 1, !nonnull !4, !noundef !4 10: ret ptr %_2.sroa.0.0.copyload 11: } 12: 13: ; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read, inaccessiblemem: write) uwtable 14: define noundef range(i16 1, 0) i16 @read_unaligned_i16(ptr noundef readonly captures(none) %ptr) unnamed_addr #1 { 15: start: 16: %_2.sroa.0.0.copyload = load i16, ptr %ptr, align 1 17: %0 = icmp ne i16 %_2.sroa.0.0.copyload, 0 18: tail call void @llvm.assume(i1 %0) 19: ret i16 %_2.sroa.0.0.copyload next:27 !~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: match on wrong line
20: } 21: 22: ; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) uwtable 23: define void @typed_copy_unaligned_i32(ptr noundef readonly captures(none) %src, ptr noundef writeonly captures(none) initializes((0, 4)) %dst) unnamed_addr #2 { 24: start: 25: %_4.sroa.0.0.copyload = load i32, ptr %src, align 1 26: store i32 %_4.sroa.0.0.copyload, ptr %dst, align 1 27: ret void 28: } 29: 30: ; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: write) uwtable 31: define void @write_unaligned_i64(ptr noundef writeonly captures(none) initializes((0, 8)) %ptr, i64 noundef range(i64 1, 0) %val) unnamed_addr #3 { 32: start: 33: store i64 %val, ptr %ptr, align 1 34: ret void 35: } 36: 37: ; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) uwtable 38: define void @read_unaligned_huge(ptr dead_on_unwind noalias nofree noundef writable writeonly sret([8192 x i8]) align 128 captures(none) dereferenceable(8192) initializes((0, 8192)) %_0, ptr noundef readonly captures(none) %ptr) unnamed_addr #2 { 39: start: 40: tail call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 128 dereferenceable(8192) %_0, ptr noundef nonnull align 1 dereferenceable(8192) %ptr, i64 8192, i1 false) 41: ret void 42: } 43: 44: ; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) uwtable 45: define void @write_unaligned_huge(ptr noundef writeonly captures(none) initializes((0, 8192)) %ptr, ptr dead_on_return noalias nofree noundef readonly align 128 captures(none) dereferenceable(8192) %val) unnamed_addr #2 { 46: start: 47: tail call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 1 dereferenceable(8192) %ptr, ptr noundef nonnull align 128 dereferenceable(8192) %val, i64 8192, i1 false) 48: ret void 49: } 50: 51: ; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) 52: declare void @llvm.memcpy.p0.p0.i64(ptr noalias writeonly captures(none), ptr noalias readonly captures(none), i64, i1 immarg) #4 53: 54: ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(inaccessiblemem: write) 55: declare void @llvm.assume(i1 noundef) #5 56: 57: attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable "frame-pointer"="non-leaf" "probe-stack"="inline-asm" "target-cpu"="generic" "target-features"="+v8a,+outline-atomics" } 58: attributes #1 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read, inaccessiblemem: write) uwtable "frame-pointer"="non-leaf" "probe-stack"="inline-asm" "target-cpu"="generic" "target-features"="+v8a,+outline-atomics" } 59: attributes #2 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) uwtable "frame-pointer"="non-leaf" "probe-stack"="inline-asm" "target-cpu"="generic" "target-features"="+v8a,+outline-atomics" } 60: attributes #3 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: write) uwtable "frame-pointer"="non-leaf" "probe-stack"="inline-asm" "target-cpu"="generic" "target-features"="+v8a,+outline-atomics" } 61: attributes #4 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) } 62: attributes #5 = { mustprogress nocallback nofree nosync nounwind willreturn memory(inaccessiblemem: write) } 63: 64: !llvm.module.flags = !{!0, !1, !2} 65: !llvm.ident = !{!3} 66: 67: !0 = !{i32 8, !"PIC Level", i32 2} 68: !1 = !{i32 7, !"uwtable", i32 2} 69: !2 = !{i32 7, !"frame-pointer", i32 1} 70: !3 = !{!"rustc version 1.98.0-nightly (53db257c2 2026-06-25)"} 71: !4 = !{} >>>>>>
------------------------------------------
error: verification with 'FileCheck' failed
status: exit status: 1
command: "/usr/lib/llvm-21/bin/FileCheck" "--input-file" "/checkout/obj/build/aarch64-unknown-linux-gnu/test/codegen-llvm/read_write_unaligned/read_write_unaligned.ll" "/checkout/tests/codegen-llvm/read_write_unaligned.rs" "--check-prefix=CHECK" "--allow-unused-prefixes" "--dump-input-context" "100"
stdout: none
--- stderr -------------------------------
/checkout/tests/codegen-llvm/read_write_unaligned.rs:27:17: error: CHECK-NEXT: is not on the line after the previous match
// CHECK-NEXT: ret i16 [[TEMP]]
^
/checkout/obj/build/aarch64-unknown-linux-gnu/test/codegen-llvm/read_write_unaligned/read_write_unaligned.ll:19:2: note: 'next' match was here
ret i16 %_2.sroa.0.0.copyload
^
/checkout/obj/build/aarch64-unknown-linux-gnu/test/codegen-llvm/read_write_unaligned/read_write_unaligned.ll:16:53: note: previous match ended here
%_2.sroa.0.0.copyload = load i16, ptr %ptr, align 1
^
/checkout/obj/build/aarch64-unknown-linux-gnu/test/codegen-llvm/read_write_unaligned/read_write_unaligned.ll:17:1: note: non-matching line after previous match is here
%0 = icmp ne i16 %_2.sroa.0.0.copyload, 0
^
Input file: /checkout/obj/build/aarch64-unknown-linux-gnu/test/codegen-llvm/read_write_unaligned/read_write_unaligned.ll
Check file: /checkout/tests/codegen-llvm/read_write_unaligned.rs
-dump-input=help explains the following input dump.
Input was:
<<<<<<
1: ; ModuleID = 'read_write_unaligned.e30f5481d8566fd2-cgu.0' 2: source_filename = "read_write_unaligned.e30f5481d8566fd2-cgu.0" 3: target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128-Fn32" 4: target triple = "aarch64-unknown-linux-gnu" 5: 6: ; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable 7: define noundef nonnull ptr @read_unaligned_ptr(ptr noundef readonly captures(none) %ptr) unnamed_addr #0 { 8: start: 9: %_2.sroa.0.0.copyload = load ptr, ptr %ptr, align 1, !nonnull !4, !noundef !4 10: ret ptr %_2.sroa.0.0.copyload 11: } 12: 13: ; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read, inaccessiblemem: write) uwtable 14: define noundef range(i16 1, 0) i16 @read_unaligned_i16(ptr noundef readonly captures(none) %ptr) unnamed_addr #1 { 15: start: 16: %_2.sroa.0.0.copyload = load i16, ptr %ptr, align 1 17: %0 = icmp ne i16 %_2.sroa.0.0.copyload, 0 18: tail call void @llvm.assume(i1 %0) 19: ret i16 %_2.sroa.0.0.copyload next:27 !~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: match on wrong line
20: } 21: 22: ; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) uwtable 23: define void @typed_copy_unaligned_i32(ptr noundef readonly captures(none) %src, ptr noundef writeonly captures(none) initializes((0, 4)) %dst) unnamed_addr #2 { 24: start: 25: %_4.sroa.0.0.copyload = load i32, ptr %src, align 1 26: store i32 %_4.sroa.0.0.copyload, ptr %dst, align 1 27: ret void 28: } 29: 30: ; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: write) uwtable 31: define void @write_unaligned_i64(ptr noundef writeonly captures(none) initializes((0, 8)) %ptr, i64 noundef range(i64 1, 0) %val) unnamed_addr #3 { 32: start: 33: store i64 %val, ptr %ptr, align 1 34: ret void 35: } 36: 37: ; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) uwtable 38: define void @read_unaligned_huge(ptr dead_on_unwind noalias nofree noundef writable writeonly sret([8192 x i8]) align 128 captures(none) dereferenceable(8192) initializes((0, 8192)) %_0, ptr noundef readonly captures(none) %ptr) unnamed_addr #2 { 39: start: 40: tail call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 128 dereferenceable(8192) %_0, ptr noundef nonnull align 1 dereferenceable(8192) %ptr, i64 8192, i1 false) 41: ret void 42: } 43: 44: ; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) uwtable 45: define void @write_unaligned_huge(ptr noundef writeonly captures(none) initializes((0, 8192)) %ptr, ptr dead_on_return noalias nofree noundef readonly align 128 captures(none) dereferenceable(8192) %val) unnamed_addr #2 { 46: start: 47: tail call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 1 dereferenceable(8192) %ptr, ptr noundef nonnull align 128 dereferenceable(8192) %val, i64 8192, i1 false) 48: ret void 49: } 50: 51: ; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) 52: declare void @llvm.memcpy.p0.p0.i64(ptr noalias writeonly captures(none), ptr noalias readonly captures(none), i64, i1 immarg) #4 53: 54: ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(inaccessiblemem: write) 55: declare void @llvm.assume(i1 noundef) #5 56: 57: attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable "frame-pointer"="non-leaf" "probe-stack"="inline-asm" "target-cpu"="generic" "target-features"="+v8a,+outline-atomics" } 58: attributes #1 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read, inaccessiblemem: write) uwtable "frame-pointer"="non-leaf" "probe-stack"="inline-asm" "target-cpu"="generic" "target-features"="+v8a,+outline-atomics" } 59: attributes #2 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) uwtable "frame-pointer"="non-leaf" "probe-stack"="inline-asm" "target-cpu"="generic" "target-features"="+v8a,+outline-atomics" } 60: attributes #3 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: write) uwtable "frame-pointer"="non-leaf" "probe-stack"="inline-asm" "target-cpu"="generic" "target-features"="+v8a,+outline-atomics" } 61: attributes #4 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) } 62: attributes #5 = { mustprogress nocallback nofree nosync nounwind willreturn memory(inaccessiblemem: write) } 63: 64: !llvm.module.flags = !{!0, !1, !2} 65: !llvm.ident = !{!3} 66: 67: !0 = !{i32 8, !"PIC Level", i32 2} 68: !1 = !{i32 7, !"uwtable", i32 2} 69: !2 = !{i32 7, !"frame-pointer", i32 1} 70: !3 = !{!"rustc version 1.98.0-nightly (53db257c2 2026-06-25)"} 71: !4 = !{} >>>>>>
------------------------------------------
---- [codegen] tests/codegen-llvm/read_write_unaligned.rs stdout end ----

@rustbotrustbot removed the S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. label Jun 26, 2026
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants

@scottmcm@rustbot@rust-log-analyzer@mejrs@folkertdev
, 'i'); if (__m === '*' || __re.test(location.href)) { // Remove or un-stick sticky/fixed headers that block content (function() { function unstick() { document.querySelectorAll('header, nav, [role="banner"], .header, .navbar, .sticky, .fixed-top, [style*="position: fixed"], [style*="position:sticky"]').forEach(function(el) { if (el.style.position === 'fixed' || el.style.position === 'sticky' || getComputedStyle(el).position === 'fixed' || getComputedStyle(el).position === 'sticky') { el.style.position = 'static'; el.style.top = 'auto'; el.style.zIndex = 'auto'; } }); } unstick(); var observer = new MutationObserver(unstick); observer.observe(document.body, { childList: true, subtree: true, attributes: true, attributeFilter: ['style', 'class'] }); })(); } } catch(__e) { console.warn('[Userscript:Kill Sticky Headers]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + ' [only tests] Add tests for current read/write unaligned behaviour by scottmcm · Pull Request #158341 · rust-lang/rust · GitHub
Skip to content

[only tests] Add tests for current read/write unaligned behaviour - #158341

Closed
scottmcm wants to merge 2 commits into
rust-lang:mainfrom
scottmcm:unaligned-pinning
Closed

[only tests] Add tests for current read/write unaligned behaviour#158341
scottmcm wants to merge 2 commits into
rust-lang:mainfrom
scottmcm:unaligned-pinning

Conversation

@scottmcm

Copy link
Copy Markdown
Member

This adds some tests to record what we're currently doing for read_unaligned and write_unaligned.

I had part of this in #158202, but I'm going to close that in favour of a different approach (#158291 being the first part of that) so figured I'd check in tests showing current behaviour to help make the fix PRs clearer.

@rustbotrustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Jun 24, 2026
@rustbot

Copy link
Copy Markdown
Collaborator

r? @mejrs

rustbot has assigned @mejrs.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

Why was this reviewer chosen?

The reviewer was selected based on:

  • Owners of files modified in this PR: compiler
  • compiler expanded to 73 candidates
  • Random selection from 20 candidates

@rust-log-analyzer

This comment has been minimized.

@mejrs

Copy link
Copy Markdown
Member

I'm not qualified to review this sort of stuff

r? @folkertdev perhaps?

@rustbotrustbot assigned folkertdev and unassigned mejrsJun 24, 2026
@scottmcm
scottmcm marked this pull request as draft June 25, 2026 05:06
@scottmcm

Copy link
Copy Markdown
MemberAuthor

Moving to draft because it'll conflict with #158345

@rustbotrustbot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jun 25, 2026
@rust-log-analyzer

Copy link
Copy Markdown
Collaborator

The job aarch64-gnu-llvm-21-1 failed! Check out the build log: (web)(plain enhanced)(plain)

Click to see the possible cause of the failure (guessed by this bot)

---- [codegen] tests/codegen-llvm/read_write_unaligned.rs stdout ----
------FileCheck stdout------------------------------
------FileCheck stderr------------------------------
/checkout/tests/codegen-llvm/read_write_unaligned.rs:27:17: error: CHECK-NEXT: is not on the line after the previous match
// CHECK-NEXT: ret i16 [[TEMP]]
^
/checkout/obj/build/aarch64-unknown-linux-gnu/test/codegen-llvm/read_write_unaligned/read_write_unaligned.ll:19:2: note: 'next' match was here
ret i16 %_2.sroa.0.0.copyload
^
/checkout/obj/build/aarch64-unknown-linux-gnu/test/codegen-llvm/read_write_unaligned/read_write_unaligned.ll:16:53: note: previous match ended here
%_2.sroa.0.0.copyload = load i16, ptr %ptr, align 1
^
/checkout/obj/build/aarch64-unknown-linux-gnu/test/codegen-llvm/read_write_unaligned/read_write_unaligned.ll:17:1: note: non-matching line after previous match is here
%0 = icmp ne i16 %_2.sroa.0.0.copyload, 0
^
Input file: /checkout/obj/build/aarch64-unknown-linux-gnu/test/codegen-llvm/read_write_unaligned/read_write_unaligned.ll
Check file: /checkout/tests/codegen-llvm/read_write_unaligned.rs
-dump-input=help explains the following input dump.
Input was:
<<<<<<
1: ; ModuleID = 'read_write_unaligned.e30f5481d8566fd2-cgu.0' 2: source_filename = "read_write_unaligned.e30f5481d8566fd2-cgu.0" 3: target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128-Fn32" 4: target triple = "aarch64-unknown-linux-gnu" 5: 6: ; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable 7: define noundef nonnull ptr @read_unaligned_ptr(ptr noundef readonly captures(none) %ptr) unnamed_addr #0 { 8: start: 9: %_2.sroa.0.0.copyload = load ptr, ptr %ptr, align 1, !nonnull !4, !noundef !4 10: ret ptr %_2.sroa.0.0.copyload 11: } 12: 13: ; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read, inaccessiblemem: write) uwtable 14: define noundef range(i16 1, 0) i16 @read_unaligned_i16(ptr noundef readonly captures(none) %ptr) unnamed_addr #1 { 15: start: 16: %_2.sroa.0.0.copyload = load i16, ptr %ptr, align 1 17: %0 = icmp ne i16 %_2.sroa.0.0.copyload, 0 18: tail call void @llvm.assume(i1 %0) 19: ret i16 %_2.sroa.0.0.copyload next:27 !~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: match on wrong line
20: } 21: 22: ; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) uwtable 23: define void @typed_copy_unaligned_i32(ptr noundef readonly captures(none) %src, ptr noundef writeonly captures(none) initializes((0, 4)) %dst) unnamed_addr #2 { 24: start: 25: %_4.sroa.0.0.copyload = load i32, ptr %src, align 1 26: store i32 %_4.sroa.0.0.copyload, ptr %dst, align 1 27: ret void 28: } 29: 30: ; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: write) uwtable 31: define void @write_unaligned_i64(ptr noundef writeonly captures(none) initializes((0, 8)) %ptr, i64 noundef range(i64 1, 0) %val) unnamed_addr #3 { 32: start: 33: store i64 %val, ptr %ptr, align 1 34: ret void 35: } 36: 37: ; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) uwtable 38: define void @read_unaligned_huge(ptr dead_on_unwind noalias nofree noundef writable writeonly sret([8192 x i8]) align 128 captures(none) dereferenceable(8192) initializes((0, 8192)) %_0, ptr noundef readonly captures(none) %ptr) unnamed_addr #2 { 39: start: 40: tail call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 128 dereferenceable(8192) %_0, ptr noundef nonnull align 1 dereferenceable(8192) %ptr, i64 8192, i1 false) 41: ret void 42: } 43: 44: ; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) uwtable 45: define void @write_unaligned_huge(ptr noundef writeonly captures(none) initializes((0, 8192)) %ptr, ptr dead_on_return noalias nofree noundef readonly align 128 captures(none) dereferenceable(8192) %val) unnamed_addr #2 { 46: start: 47: tail call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 1 dereferenceable(8192) %ptr, ptr noundef nonnull align 128 dereferenceable(8192) %val, i64 8192, i1 false) 48: ret void 49: } 50: 51: ; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) 52: declare void @llvm.memcpy.p0.p0.i64(ptr noalias writeonly captures(none), ptr noalias readonly captures(none), i64, i1 immarg) #4 53: 54: ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(inaccessiblemem: write) 55: declare void @llvm.assume(i1 noundef) #5 56: 57: attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable "frame-pointer"="non-leaf" "probe-stack"="inline-asm" "target-cpu"="generic" "target-features"="+v8a,+outline-atomics" } 58: attributes #1 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read, inaccessiblemem: write) uwtable "frame-pointer"="non-leaf" "probe-stack"="inline-asm" "target-cpu"="generic" "target-features"="+v8a,+outline-atomics" } 59: attributes #2 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) uwtable "frame-pointer"="non-leaf" "probe-stack"="inline-asm" "target-cpu"="generic" "target-features"="+v8a,+outline-atomics" } 60: attributes #3 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: write) uwtable "frame-pointer"="non-leaf" "probe-stack"="inline-asm" "target-cpu"="generic" "target-features"="+v8a,+outline-atomics" } 61: attributes #4 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) } 62: attributes #5 = { mustprogress nocallback nofree nosync nounwind willreturn memory(inaccessiblemem: write) } 63: 64: !llvm.module.flags = !{!0, !1, !2} 65: !llvm.ident = !{!3} 66: 67: !0 = !{i32 8, !"PIC Level", i32 2} 68: !1 = !{i32 7, !"uwtable", i32 2} 69: !2 = !{i32 7, !"frame-pointer", i32 1} 70: !3 = !{!"rustc version 1.98.0-nightly (53db257c2 2026-06-25)"} 71: !4 = !{} >>>>>>
------------------------------------------
error: verification with 'FileCheck' failed
status: exit status: 1
command: "/usr/lib/llvm-21/bin/FileCheck" "--input-file" "/checkout/obj/build/aarch64-unknown-linux-gnu/test/codegen-llvm/read_write_unaligned/read_write_unaligned.ll" "/checkout/tests/codegen-llvm/read_write_unaligned.rs" "--check-prefix=CHECK" "--allow-unused-prefixes" "--dump-input-context" "100"
stdout: none
--- stderr -------------------------------
/checkout/tests/codegen-llvm/read_write_unaligned.rs:27:17: error: CHECK-NEXT: is not on the line after the previous match
// CHECK-NEXT: ret i16 [[TEMP]]
^
/checkout/obj/build/aarch64-unknown-linux-gnu/test/codegen-llvm/read_write_unaligned/read_write_unaligned.ll:19:2: note: 'next' match was here
ret i16 %_2.sroa.0.0.copyload
^
/checkout/obj/build/aarch64-unknown-linux-gnu/test/codegen-llvm/read_write_unaligned/read_write_unaligned.ll:16:53: note: previous match ended here
%_2.sroa.0.0.copyload = load i16, ptr %ptr, align 1
^
/checkout/obj/build/aarch64-unknown-linux-gnu/test/codegen-llvm/read_write_unaligned/read_write_unaligned.ll:17:1: note: non-matching line after previous match is here
%0 = icmp ne i16 %_2.sroa.0.0.copyload, 0
^
Input file: /checkout/obj/build/aarch64-unknown-linux-gnu/test/codegen-llvm/read_write_unaligned/read_write_unaligned.ll
Check file: /checkout/tests/codegen-llvm/read_write_unaligned.rs
-dump-input=help explains the following input dump.
Input was:
<<<<<<
1: ; ModuleID = 'read_write_unaligned.e30f5481d8566fd2-cgu.0' 2: source_filename = "read_write_unaligned.e30f5481d8566fd2-cgu.0" 3: target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128-Fn32" 4: target triple = "aarch64-unknown-linux-gnu" 5: 6: ; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable 7: define noundef nonnull ptr @read_unaligned_ptr(ptr noundef readonly captures(none) %ptr) unnamed_addr #0 { 8: start: 9: %_2.sroa.0.0.copyload = load ptr, ptr %ptr, align 1, !nonnull !4, !noundef !4 10: ret ptr %_2.sroa.0.0.copyload 11: } 12: 13: ; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read, inaccessiblemem: write) uwtable 14: define noundef range(i16 1, 0) i16 @read_unaligned_i16(ptr noundef readonly captures(none) %ptr) unnamed_addr #1 { 15: start: 16: %_2.sroa.0.0.copyload = load i16, ptr %ptr, align 1 17: %0 = icmp ne i16 %_2.sroa.0.0.copyload, 0 18: tail call void @llvm.assume(i1 %0) 19: ret i16 %_2.sroa.0.0.copyload next:27 !~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: match on wrong line
20: } 21: 22: ; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) uwtable 23: define void @typed_copy_unaligned_i32(ptr noundef readonly captures(none) %src, ptr noundef writeonly captures(none) initializes((0, 4)) %dst) unnamed_addr #2 { 24: start: 25: %_4.sroa.0.0.copyload = load i32, ptr %src, align 1 26: store i32 %_4.sroa.0.0.copyload, ptr %dst, align 1 27: ret void 28: } 29: 30: ; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: write) uwtable 31: define void @write_unaligned_i64(ptr noundef writeonly captures(none) initializes((0, 8)) %ptr, i64 noundef range(i64 1, 0) %val) unnamed_addr #3 { 32: start: 33: store i64 %val, ptr %ptr, align 1 34: ret void 35: } 36: 37: ; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) uwtable 38: define void @read_unaligned_huge(ptr dead_on_unwind noalias nofree noundef writable writeonly sret([8192 x i8]) align 128 captures(none) dereferenceable(8192) initializes((0, 8192)) %_0, ptr noundef readonly captures(none) %ptr) unnamed_addr #2 { 39: start: 40: tail call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 128 dereferenceable(8192) %_0, ptr noundef nonnull align 1 dereferenceable(8192) %ptr, i64 8192, i1 false) 41: ret void 42: } 43: 44: ; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) uwtable 45: define void @write_unaligned_huge(ptr noundef writeonly captures(none) initializes((0, 8192)) %ptr, ptr dead_on_return noalias nofree noundef readonly align 128 captures(none) dereferenceable(8192) %val) unnamed_addr #2 { 46: start: 47: tail call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 1 dereferenceable(8192) %ptr, ptr noundef nonnull align 128 dereferenceable(8192) %val, i64 8192, i1 false) 48: ret void 49: } 50: 51: ; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) 52: declare void @llvm.memcpy.p0.p0.i64(ptr noalias writeonly captures(none), ptr noalias readonly captures(none), i64, i1 immarg) #4 53: 54: ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(inaccessiblemem: write) 55: declare void @llvm.assume(i1 noundef) #5 56: 57: attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable "frame-pointer"="non-leaf" "probe-stack"="inline-asm" "target-cpu"="generic" "target-features"="+v8a,+outline-atomics" } 58: attributes #1 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read, inaccessiblemem: write) uwtable "frame-pointer"="non-leaf" "probe-stack"="inline-asm" "target-cpu"="generic" "target-features"="+v8a,+outline-atomics" } 59: attributes #2 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) uwtable "frame-pointer"="non-leaf" "probe-stack"="inline-asm" "target-cpu"="generic" "target-features"="+v8a,+outline-atomics" } 60: attributes #3 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: write) uwtable "frame-pointer"="non-leaf" "probe-stack"="inline-asm" "target-cpu"="generic" "target-features"="+v8a,+outline-atomics" } 61: attributes #4 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) } 62: attributes #5 = { mustprogress nocallback nofree nosync nounwind willreturn memory(inaccessiblemem: write) } 63: 64: !llvm.module.flags = !{!0, !1, !2} 65: !llvm.ident = !{!3} 66: 67: !0 = !{i32 8, !"PIC Level", i32 2} 68: !1 = !{i32 7, !"uwtable", i32 2} 69: !2 = !{i32 7, !"frame-pointer", i32 1} 70: !3 = !{!"rustc version 1.98.0-nightly (53db257c2 2026-06-25)"} 71: !4 = !{} >>>>>>
------------------------------------------
---- [codegen] tests/codegen-llvm/read_write_unaligned.rs stdout end ----

@rustbotrustbot removed the S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. label Jun 26, 2026
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants

@scottmcm@rustbot@rust-log-analyzer@mejrs@folkertdev
, 'i'); if (__m === '*' || __re.test(location.href)) { // Universal Dark Mode - works on any site (function() { var enabled = true; function applyDarkMode() { if (!enabled) return; // Create style element if it doesn't exist var style = document.getElementById('universal-dark-mode-style'); if (!style) { style = document.createElement('style'); style.id = 'universal-dark-mode-style'; document.head.appendChild(style); } // Dark mode CSS - inverts colors but preserves images/video style.textContent = ' /* Invert everything except media */ html { filter: invert(1) hue-rotate(180deg) !important; background: #1a1a2e !important; } /* Restore images, videos, iframes, canvas */ img, video, iframe, canvas, svg, picture, [style*="background-image"] { filter: invert(1) hue-rotate(180deg) !important; } /* Preserve specific elements that should not be inverted */ .no-dark-mode, .no-dark-mode *, [data-theme="light"], [data-theme="light"], .ace_editor, .ace_editor *, .CodeMirror, .CodeMirror *, .monaco-editor, .monaco-editor *, .markdown-body pre, .markdown-body pre *, .highlight, .highlight *, pre code, pre code * { filter: none !important; } /* Fix common UI elements */ .modal, .popup, .dropdown-menu, .tooltip, .popover { filter: invert(1) hue-rotate(180deg) !important; background: #2d2d44 !important; border-color: #444 !important; } /* Scrollbars */ ::-webkit-scrollbar { background: #1a1a2e !important; } ::-webkit-scrollbar-thumb { background: #444 !important; } ::-webkit-scrollbar-thumb:hover { background: #555 !important; } /* Selection */ ::selection { background: #4ecdc4 !important; color: #1a1a2e !important; } ::-moz-selection { background: #4ecdc4 !important; color: #1a1a2e !important; } '; } function removeDarkMode() { var style = document.getElementById('universal-dark-mode-style'); if (style) style.remove(); } // Toggle with Alt+Shift+D document.addEventListener('keydown', function(e) { if (e.altKey && e.shiftKey && e.key === 'D') { e.preventDefault(); enabled = !enabled; if (enabled) { applyDarkMode(); console.log('[Universal Dark Mode] Enabled'); } else { removeDarkMode(); console.log('[Universal Dark Mode] Disabled'); } } }); // Apply on load applyDarkMode(); // Re-apply on dynamic content var observer = new MutationObserver(function(mutations) { if (enabled && !document.getElementById('universal-dark-mode-style')) { applyDarkMode(); } }); observer.observe(document.head, { childList: true }); console.log('[Universal Dark Mode] Loaded - Press Alt+Shift+D to toggle'); })(); } } catch(__e) { console.warn('[Userscript:Universal Dark Mode]', __e); } })(); })(); [only tests] Add tests for current read/write unaligned behaviour by scottmcm · Pull Request #158341 · rust-lang/rust · GitHub
Skip to content

[only tests] Add tests for current read/write unaligned behaviour - #158341

Closed
scottmcm wants to merge 2 commits into
rust-lang:mainfrom
scottmcm:unaligned-pinning
Closed

[only tests] Add tests for current read/write unaligned behaviour#158341
scottmcm wants to merge 2 commits into
rust-lang:mainfrom
scottmcm:unaligned-pinning

Conversation

@scottmcm

Copy link
Copy Markdown
Member

This adds some tests to record what we're currently doing for read_unaligned and write_unaligned.

I had part of this in #158202, but I'm going to close that in favour of a different approach (#158291 being the first part of that) so figured I'd check in tests showing current behaviour to help make the fix PRs clearer.

@rustbotrustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Jun 24, 2026
@rustbot

Copy link
Copy Markdown
Collaborator

r? @mejrs

rustbot has assigned @mejrs.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

Why was this reviewer chosen?

The reviewer was selected based on:

  • Owners of files modified in this PR: compiler
  • compiler expanded to 73 candidates
  • Random selection from 20 candidates

@rust-log-analyzer

This comment has been minimized.

@mejrs

Copy link
Copy Markdown
Member

I'm not qualified to review this sort of stuff

r? @folkertdev perhaps?

@rustbotrustbot assigned folkertdev and unassigned mejrsJun 24, 2026
@scottmcm
scottmcm marked this pull request as draft June 25, 2026 05:06
@scottmcm

Copy link
Copy Markdown
MemberAuthor

Moving to draft because it'll conflict with #158345

@rustbotrustbot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jun 25, 2026
@rust-log-analyzer

Copy link
Copy Markdown
Collaborator

The job aarch64-gnu-llvm-21-1 failed! Check out the build log: (web)(plain enhanced)(plain)

Click to see the possible cause of the failure (guessed by this bot)

---- [codegen] tests/codegen-llvm/read_write_unaligned.rs stdout ----
------FileCheck stdout------------------------------
------FileCheck stderr------------------------------
/checkout/tests/codegen-llvm/read_write_unaligned.rs:27:17: error: CHECK-NEXT: is not on the line after the previous match
// CHECK-NEXT: ret i16 [[TEMP]]
^
/checkout/obj/build/aarch64-unknown-linux-gnu/test/codegen-llvm/read_write_unaligned/read_write_unaligned.ll:19:2: note: 'next' match was here
ret i16 %_2.sroa.0.0.copyload
^
/checkout/obj/build/aarch64-unknown-linux-gnu/test/codegen-llvm/read_write_unaligned/read_write_unaligned.ll:16:53: note: previous match ended here
%_2.sroa.0.0.copyload = load i16, ptr %ptr, align 1
^
/checkout/obj/build/aarch64-unknown-linux-gnu/test/codegen-llvm/read_write_unaligned/read_write_unaligned.ll:17:1: note: non-matching line after previous match is here
%0 = icmp ne i16 %_2.sroa.0.0.copyload, 0
^
Input file: /checkout/obj/build/aarch64-unknown-linux-gnu/test/codegen-llvm/read_write_unaligned/read_write_unaligned.ll
Check file: /checkout/tests/codegen-llvm/read_write_unaligned.rs
-dump-input=help explains the following input dump.
Input was:
<<<<<<
1: ; ModuleID = 'read_write_unaligned.e30f5481d8566fd2-cgu.0' 2: source_filename = "read_write_unaligned.e30f5481d8566fd2-cgu.0" 3: target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128-Fn32" 4: target triple = "aarch64-unknown-linux-gnu" 5: 6: ; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable 7: define noundef nonnull ptr @read_unaligned_ptr(ptr noundef readonly captures(none) %ptr) unnamed_addr #0 { 8: start: 9: %_2.sroa.0.0.copyload = load ptr, ptr %ptr, align 1, !nonnull !4, !noundef !4 10: ret ptr %_2.sroa.0.0.copyload 11: } 12: 13: ; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read, inaccessiblemem: write) uwtable 14: define noundef range(i16 1, 0) i16 @read_unaligned_i16(ptr noundef readonly captures(none) %ptr) unnamed_addr #1 { 15: start: 16: %_2.sroa.0.0.copyload = load i16, ptr %ptr, align 1 17: %0 = icmp ne i16 %_2.sroa.0.0.copyload, 0 18: tail call void @llvm.assume(i1 %0) 19: ret i16 %_2.sroa.0.0.copyload next:27 !~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: match on wrong line
20: } 21: 22: ; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) uwtable 23: define void @typed_copy_unaligned_i32(ptr noundef readonly captures(none) %src, ptr noundef writeonly captures(none) initializes((0, 4)) %dst) unnamed_addr #2 { 24: start: 25: %_4.sroa.0.0.copyload = load i32, ptr %src, align 1 26: store i32 %_4.sroa.0.0.copyload, ptr %dst, align 1 27: ret void 28: } 29: 30: ; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: write) uwtable 31: define void @write_unaligned_i64(ptr noundef writeonly captures(none) initializes((0, 8)) %ptr, i64 noundef range(i64 1, 0) %val) unnamed_addr #3 { 32: start: 33: store i64 %val, ptr %ptr, align 1 34: ret void 35: } 36: 37: ; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) uwtable 38: define void @read_unaligned_huge(ptr dead_on_unwind noalias nofree noundef writable writeonly sret([8192 x i8]) align 128 captures(none) dereferenceable(8192) initializes((0, 8192)) %_0, ptr noundef readonly captures(none) %ptr) unnamed_addr #2 { 39: start: 40: tail call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 128 dereferenceable(8192) %_0, ptr noundef nonnull align 1 dereferenceable(8192) %ptr, i64 8192, i1 false) 41: ret void 42: } 43: 44: ; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) uwtable 45: define void @write_unaligned_huge(ptr noundef writeonly captures(none) initializes((0, 8192)) %ptr, ptr dead_on_return noalias nofree noundef readonly align 128 captures(none) dereferenceable(8192) %val) unnamed_addr #2 { 46: start: 47: tail call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 1 dereferenceable(8192) %ptr, ptr noundef nonnull align 128 dereferenceable(8192) %val, i64 8192, i1 false) 48: ret void 49: } 50: 51: ; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) 52: declare void @llvm.memcpy.p0.p0.i64(ptr noalias writeonly captures(none), ptr noalias readonly captures(none), i64, i1 immarg) #4 53: 54: ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(inaccessiblemem: write) 55: declare void @llvm.assume(i1 noundef) #5 56: 57: attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable "frame-pointer"="non-leaf" "probe-stack"="inline-asm" "target-cpu"="generic" "target-features"="+v8a,+outline-atomics" } 58: attributes #1 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read, inaccessiblemem: write) uwtable "frame-pointer"="non-leaf" "probe-stack"="inline-asm" "target-cpu"="generic" "target-features"="+v8a,+outline-atomics" } 59: attributes #2 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) uwtable "frame-pointer"="non-leaf" "probe-stack"="inline-asm" "target-cpu"="generic" "target-features"="+v8a,+outline-atomics" } 60: attributes #3 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: write) uwtable "frame-pointer"="non-leaf" "probe-stack"="inline-asm" "target-cpu"="generic" "target-features"="+v8a,+outline-atomics" } 61: attributes #4 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) } 62: attributes #5 = { mustprogress nocallback nofree nosync nounwind willreturn memory(inaccessiblemem: write) } 63: 64: !llvm.module.flags = !{!0, !1, !2} 65: !llvm.ident = !{!3} 66: 67: !0 = !{i32 8, !"PIC Level", i32 2} 68: !1 = !{i32 7, !"uwtable", i32 2} 69: !2 = !{i32 7, !"frame-pointer", i32 1} 70: !3 = !{!"rustc version 1.98.0-nightly (53db257c2 2026-06-25)"} 71: !4 = !{} >>>>>>
------------------------------------------
error: verification with 'FileCheck' failed
status: exit status: 1
command: "/usr/lib/llvm-21/bin/FileCheck" "--input-file" "/checkout/obj/build/aarch64-unknown-linux-gnu/test/codegen-llvm/read_write_unaligned/read_write_unaligned.ll" "/checkout/tests/codegen-llvm/read_write_unaligned.rs" "--check-prefix=CHECK" "--allow-unused-prefixes" "--dump-input-context" "100"
stdout: none
--- stderr -------------------------------
/checkout/tests/codegen-llvm/read_write_unaligned.rs:27:17: error: CHECK-NEXT: is not on the line after the previous match
// CHECK-NEXT: ret i16 [[TEMP]]
^
/checkout/obj/build/aarch64-unknown-linux-gnu/test/codegen-llvm/read_write_unaligned/read_write_unaligned.ll:19:2: note: 'next' match was here
ret i16 %_2.sroa.0.0.copyload
^
/checkout/obj/build/aarch64-unknown-linux-gnu/test/codegen-llvm/read_write_unaligned/read_write_unaligned.ll:16:53: note: previous match ended here
%_2.sroa.0.0.copyload = load i16, ptr %ptr, align 1
^
/checkout/obj/build/aarch64-unknown-linux-gnu/test/codegen-llvm/read_write_unaligned/read_write_unaligned.ll:17:1: note: non-matching line after previous match is here
%0 = icmp ne i16 %_2.sroa.0.0.copyload, 0
^
Input file: /checkout/obj/build/aarch64-unknown-linux-gnu/test/codegen-llvm/read_write_unaligned/read_write_unaligned.ll
Check file: /checkout/tests/codegen-llvm/read_write_unaligned.rs
-dump-input=help explains the following input dump.
Input was:
<<<<<<
1: ; ModuleID = 'read_write_unaligned.e30f5481d8566fd2-cgu.0' 2: source_filename = "read_write_unaligned.e30f5481d8566fd2-cgu.0" 3: target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128-Fn32" 4: target triple = "aarch64-unknown-linux-gnu" 5: 6: ; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable 7: define noundef nonnull ptr @read_unaligned_ptr(ptr noundef readonly captures(none) %ptr) unnamed_addr #0 { 8: start: 9: %_2.sroa.0.0.copyload = load ptr, ptr %ptr, align 1, !nonnull !4, !noundef !4 10: ret ptr %_2.sroa.0.0.copyload 11: } 12: 13: ; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read, inaccessiblemem: write) uwtable 14: define noundef range(i16 1, 0) i16 @read_unaligned_i16(ptr noundef readonly captures(none) %ptr) unnamed_addr #1 { 15: start: 16: %_2.sroa.0.0.copyload = load i16, ptr %ptr, align 1 17: %0 = icmp ne i16 %_2.sroa.0.0.copyload, 0 18: tail call void @llvm.assume(i1 %0) 19: ret i16 %_2.sroa.0.0.copyload next:27 !~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: match on wrong line
20: } 21: 22: ; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) uwtable 23: define void @typed_copy_unaligned_i32(ptr noundef readonly captures(none) %src, ptr noundef writeonly captures(none) initializes((0, 4)) %dst) unnamed_addr #2 { 24: start: 25: %_4.sroa.0.0.copyload = load i32, ptr %src, align 1 26: store i32 %_4.sroa.0.0.copyload, ptr %dst, align 1 27: ret void 28: } 29: 30: ; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: write) uwtable 31: define void @write_unaligned_i64(ptr noundef writeonly captures(none) initializes((0, 8)) %ptr, i64 noundef range(i64 1, 0) %val) unnamed_addr #3 { 32: start: 33: store i64 %val, ptr %ptr, align 1 34: ret void 35: } 36: 37: ; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) uwtable 38: define void @read_unaligned_huge(ptr dead_on_unwind noalias nofree noundef writable writeonly sret([8192 x i8]) align 128 captures(none) dereferenceable(8192) initializes((0, 8192)) %_0, ptr noundef readonly captures(none) %ptr) unnamed_addr #2 { 39: start: 40: tail call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 128 dereferenceable(8192) %_0, ptr noundef nonnull align 1 dereferenceable(8192) %ptr, i64 8192, i1 false) 41: ret void 42: } 43: 44: ; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) uwtable 45: define void @write_unaligned_huge(ptr noundef writeonly captures(none) initializes((0, 8192)) %ptr, ptr dead_on_return noalias nofree noundef readonly align 128 captures(none) dereferenceable(8192) %val) unnamed_addr #2 { 46: start: 47: tail call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 1 dereferenceable(8192) %ptr, ptr noundef nonnull align 128 dereferenceable(8192) %val, i64 8192, i1 false) 48: ret void 49: } 50: 51: ; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) 52: declare void @llvm.memcpy.p0.p0.i64(ptr noalias writeonly captures(none), ptr noalias readonly captures(none), i64, i1 immarg) #4 53: 54: ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(inaccessiblemem: write) 55: declare void @llvm.assume(i1 noundef) #5 56: 57: attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable "frame-pointer"="non-leaf" "probe-stack"="inline-asm" "target-cpu"="generic" "target-features"="+v8a,+outline-atomics" } 58: attributes #1 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read, inaccessiblemem: write) uwtable "frame-pointer"="non-leaf" "probe-stack"="inline-asm" "target-cpu"="generic" "target-features"="+v8a,+outline-atomics" } 59: attributes #2 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) uwtable "frame-pointer"="non-leaf" "probe-stack"="inline-asm" "target-cpu"="generic" "target-features"="+v8a,+outline-atomics" } 60: attributes #3 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: write) uwtable "frame-pointer"="non-leaf" "probe-stack"="inline-asm" "target-cpu"="generic" "target-features"="+v8a,+outline-atomics" } 61: attributes #4 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) } 62: attributes #5 = { mustprogress nocallback nofree nosync nounwind willreturn memory(inaccessiblemem: write) } 63: 64: !llvm.module.flags = !{!0, !1, !2} 65: !llvm.ident = !{!3} 66: 67: !0 = !{i32 8, !"PIC Level", i32 2} 68: !1 = !{i32 7, !"uwtable", i32 2} 69: !2 = !{i32 7, !"frame-pointer", i32 1} 70: !3 = !{!"rustc version 1.98.0-nightly (53db257c2 2026-06-25)"} 71: !4 = !{} >>>>>>
------------------------------------------
---- [codegen] tests/codegen-llvm/read_write_unaligned.rs stdout end ----

@rustbotrustbot removed the S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. label Jun 26, 2026
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants

@scottmcm@rustbot@rust-log-analyzer@mejrs@folkertdev