-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[Sink][NFC] Move all checks for unsafe instructions into one function #137398
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
Signed-off-by: John Lu <John.Lu@amd.com>
@llvm/pr-subscribers-llvm-transforms Author: None (LU-JOHN) ChangesMove check for instruction that is unsafe to sink into isSafeToMove function. Full diff: https://github.com/llvm/llvm-project/pull/137398.diff 1 Files Affected:
diff --git a/llvm/lib/Transforms/Scalar/Sink.cpp b/llvm/lib/Transforms/Scalar/Sink.cpp
index 1a48a59c4189e..0865d20f9d990 100644
--- a/llvm/lib/Transforms/Scalar/Sink.cpp
+++ b/llvm/lib/Transforms/Scalar/Sink.cpp
@@ -35,6 +35,12 @@ static bool isSafeToMove(Instruction *Inst, AliasAnalysis &AA,
return false;
}
+ // Don't sink static alloca instructions. CodeGen assumes allocas outside the
+ // entry block are dynamically sized stack objects.
+ if (AllocaInst *AI = dyn_cast<AllocaInst>(Inst))
+ if (AI->isStaticAlloca())
+ return false;
+
if (LoadInst *L = dyn_cast<LoadInst>(Inst)) {
MemoryLocation Loc = MemoryLocation::get(L);
for (Instruction *S : Stores)
@@ -103,12 +109,6 @@ static bool SinkInstruction(Instruction *Inst,
SmallPtrSetImpl<Instruction *> &Stores,
DominatorTree &DT, LoopInfo &LI, AAResults &AA) {
- // Don't sink static alloca instructions. CodeGen assumes allocas outside the
- // entry block are dynamically sized stack objects.
- if (AllocaInst *AI = dyn_cast<AllocaInst>(Inst))
- if (AI->isStaticAlloca())
- return false;
-
// Check if it's safe to move the instruction.
if (!isSafeToMove(Inst, AA, Stores))
return false;
|
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/174/builds/16819 Here is the relevant piece of the build log for the reference
|
…llvm#137398) Move check for instruction that is unsafe to sink into isSafeToMove function. Signed-off-by: John Lu <John.Lu@amd.com>
…llvm#137398) Move check for instruction that is unsafe to sink into isSafeToMove function. Signed-off-by: John Lu <John.Lu@amd.com>
…llvm#137398) Move check for instruction that is unsafe to sink into isSafeToMove function. Signed-off-by: John Lu <John.Lu@amd.com>
…llvm#137398) Move check for instruction that is unsafe to sink into isSafeToMove function. Signed-off-by: John Lu <John.Lu@amd.com>
…llvm#137398) Move check for instruction that is unsafe to sink into isSafeToMove function. Signed-off-by: John Lu <John.Lu@amd.com>
Move check for instruction that is unsafe to sink into isSafeToMove function.