-
Notifications
You must be signed in to change notification settings - Fork 14.9k
[InstCombine] Remove redundant alignment assumptions. #123348
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
f4b20e4
b507b93
520b119
ceb8200
bf73b92
697bdf2
7794806
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -175,7 +175,6 @@ define ptr @dont_fold_assume_align_zero_of_loaded_pointer_into_align_metadata(pt | |
define ptr @redundant_assume_align_1(ptr %p) { | ||
; CHECK-LABEL: @redundant_assume_align_1( | ||
; CHECK-NEXT: [[P2:%.*]] = load ptr, ptr [[P:%.*]], align 8 | ||
; CHECK-NEXT: call void @llvm.assume(i1 true) [ "align"(ptr [[P2]], i32 1) ] | ||
; CHECK-NEXT: call void @foo(ptr [[P2]]) | ||
; CHECK-NEXT: ret ptr [[P2]] | ||
; | ||
|
@@ -189,7 +188,6 @@ define ptr @redundant_assume_align_1(ptr %p) { | |
define ptr @redundant_assume_align_8_via_align_metadata(ptr %p) { | ||
; CHECK-LABEL: @redundant_assume_align_8_via_align_metadata( | ||
; CHECK-NEXT: [[P2:%.*]] = load ptr, ptr [[P:%.*]], align 8, !align [[META0:![0-9]+]] | ||
; CHECK-NEXT: call void @llvm.assume(i1 true) [ "align"(ptr [[P2]], i32 8) ] | ||
; CHECK-NEXT: call void @foo(ptr [[P2]]) | ||
; CHECK-NEXT: ret ptr [[P2]] | ||
; | ||
|
@@ -250,6 +248,19 @@ define ptr @redundant_assume_align_8_via_asume(ptr %p) { | |
} | ||
|
||
declare void @foo(ptr) | ||
|
||
; !align must have a constant integer alignment. | ||
define ptr @assume_load_pointer_result(ptr %p, i64 %align) { | ||
; CHECK-LABEL: @assume_load_pointer_result( | ||
; CHECK-NEXT: [[P2:%.*]] = load ptr, ptr [[P:%.*]], align 8 | ||
; CHECK-NEXT: call void @llvm.assume(i1 true) [ "align"(ptr [[P2]], i64 [[ALIGN:%.*]]) ] | ||
; CHECK-NEXT: ret ptr [[P2]] | ||
; | ||
%p2 = load ptr, ptr %p | ||
call void @llvm.assume(i1 true) [ "align"(ptr %p2, i64 %align) ] | ||
|
||
ret ptr %p2 | ||
} | ||
|
||
;. | ||
; CHECK: [[META0]] = !{i64 8} | ||
;. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As we emit a bunch of alignment assumptions, can we turn the tag name
align
into a tag IDOB_align
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep, put up #158078