Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3412,6 +3412,10 @@ Instruction *InstCombinerImpl::visitCallInst(CallInst &CI) {
!isPowerOf2_64(RK.ArgValue) || !isa<ConstantInt>(RK.IRArgValue))
continue;

// Remove align 1 bundles; they don't add any useful information.
if (RK.ArgValue == 1)
return CallBase::removeOperandBundle(II, OBU.getTagID());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Side note (as this is not the only place with this problem), but this API doesn't do the right thing if there are multiple assume operand bundles with the same name. No idea whether that's supposed to be allowed or only permitted by accident.


// Don't try to remove align assumptions for pointers derived from
// arguments. We might lose information if the function gets inline and
// the align argument attribute disappears.
Expand Down
3 changes: 1 addition & 2 deletions llvm/test/Transforms/InstCombine/assume-align.ll
Original file line number Diff line number Diff line change
Expand Up @@ -249,8 +249,7 @@ define ptr @redundant_assume_align_8_via_asume(ptr %p) {

define ptr @assume_align_1(ptr %p) {
; CHECK-LABEL: @assume_align_1(
; CHECK-NEXT: call void @llvm.assume(i1 true) [ "align"(ptr [[P:%.*]], i32 1) ]
; CHECK-NEXT: call void @foo(ptr [[P]])
; CHECK-NEXT: call void @foo(ptr [[P:%.*]])
; CHECK-NEXT: ret ptr [[P]]
;
call void @llvm.assume(i1 true) [ "align"(ptr %p, i32 1) ]
Expand Down