-
Notifications
You must be signed in to change notification settings - Fork 15.5k
[LoopPeel] Check for onlyAccessesInaccessibleMemory instead of llvm.assume in peelToTurnInvariantLoadsDereferenceable. #171910
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: Craig Topper (topperc) ChangesonlyAccessesInaccessibleMemory can't alias with a load. This allows us to ignore more intrinsics than llvm.assume. Follow up from #171547 Full diff: https://github.com/llvm/llvm-project/pull/171910.diff 1 Files Affected:
diff --git a/llvm/lib/Transforms/Utils/LoopPeel.cpp b/llvm/lib/Transforms/Utils/LoopPeel.cpp
index 635b90020f625..960ec9d4c7d6e 100644
--- a/llvm/lib/Transforms/Utils/LoopPeel.cpp
+++ b/llvm/lib/Transforms/Utils/LoopPeel.cpp
@@ -447,10 +447,10 @@ static unsigned peelToTurnInvariantLoadsDereferenceable(Loop &L,
const DataLayout &DL = L.getHeader()->getDataLayout();
for (BasicBlock *BB : L.blocks()) {
for (Instruction &I : *BB) {
- // Don't consider llvm.assume as writing to memory.
+ // Calls that only access inaccessible memory can never alias with loads.
if (I.mayWriteToMemory() &&
- !(isa<IntrinsicInst>(I) &&
- cast<IntrinsicInst>(I).getIntrinsicID() == Intrinsic::assume))
+ !(isa<CallBase>(I) &&
+ cast<CallBase>(I).onlyAccessesInaccessibleMemory()))
return 0;
if (LoadUsers.contains(&I))
|
nikic
left a comment
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
fhahn
left a comment
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, thanks.
Can you add a test with a different call that is supported now?
Sure. Do you have a good suggestion? |
…ssume in peelToTurnInvariantLoadsDereferenceable. onlyAccessesInaccessibleMemory can't alias with a load. This allows us to ignore more intrinsics than llvm.assume. Follow up from llvm#171547
039e8fa to
9b4fa08
Compare
I used llvm.sideeffect. |
|
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/129/builds/34928 Here is the relevant piece of the build log for the reference |
…ssume in peelToTurnInvariantLoadsDereferenceable. (llvm#171910) onlyAccessesInaccessibleMemory can't alias with a load. This allows us to ignore more intrinsics than llvm.assume. Follow up from llvm#171547
onlyAccessesInaccessibleMemory can't alias with a load. This allows us to ignore more intrinsics than llvm.assume.
Follow up from #171547