-
Notifications
You must be signed in to change notification settings - Fork 15.2k
[InstCombine] Remove redundant align 1 assumptions. #160695
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
Conversation
@llvm/pr-subscribers-llvm-transforms Author: Florian Hahn (fhahn) ChangesIt seems like we have a bunch of align 1 assumptions in practice and unless I am missing something they should not add any value. See https://github.com/dtcxzyw/llvm-opt-benchmark/pull/2861/files Full diff: https://github.com/llvm/llvm-project/pull/160695.diff 1 Files Affected:
diff --git a/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp b/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp
index 6ad493772d170..896548ddd9931 100644
--- a/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp
+++ b/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp
@@ -3412,6 +3412,9 @@ Instruction *InstCombinerImpl::visitCallInst(CallInst &CI) {
!isPowerOf2_64(RK.ArgValue) || !isa<ConstantInt>(RK.IRArgValue))
continue;
+ if (RK.ArgValue == 1)
+ return CallBase::removeOperandBundle(II, OBU.getTagID());
+
// 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.
|
It seems like we have a bunch of align 1 assumptions in practice and unless I am missing something they should not add any value. See https://github.com/dtcxzyw/llvm-opt-benchmark/pull/2861/files
2ba5b8a
to
861c9a7
Compare
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.
Missing test?
Woops stripped the update by accident. Should be back now |
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.
LGTM
|
||
// Remove align 1 bundles; they don't add any useful information. | ||
if (RK.ArgValue == 1) | ||
return CallBase::removeOperandBundle(II, OBU.getTagID()); |
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.
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.
It seems like we have a bunch of align 1 assumptions in practice and unless I am missing something they should not add any value. See https://github.com/dtcxzyw/llvm-opt-benchmark/pull/2861/files PR: llvm/llvm-project#160695
It seems like we have a bunch of align 1 assumptions in practice and unless I am missing something they should not add any value. See https://github.com/dtcxzyw/llvm-opt-benchmark/pull/2861/files PR: llvm#160695
It seems like we have a bunch of align 1 assumptions in practice and unless I am missing something they should not add any value.
See https://github.com/dtcxzyw/llvm-opt-benchmark/pull/2861/files