-
Notifications
You must be signed in to change notification settings - Fork 15.3k
[AMDGPU] Preserve all analyses if nothing changed #117994
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-backend-amdgpu Author: Jay Foad (jayfoad) ChangesFull diff: https://github.com/llvm/llvm-project/pull/117994.diff 4 Files Affected:
diff --git a/llvm/lib/Target/AMDGPU/AMDGPUAnnotateUniformValues.cpp b/llvm/lib/Target/AMDGPU/AMDGPUAnnotateUniformValues.cpp
index 5feb35a2b553a5..9da0d93341ddfd 100644
--- a/llvm/lib/Target/AMDGPU/AMDGPUAnnotateUniformValues.cpp
+++ b/llvm/lib/Target/AMDGPU/AMDGPUAnnotateUniformValues.cpp
@@ -92,10 +92,10 @@ AMDGPUAnnotateUniformValuesPass::run(Function &F,
AMDGPUAnnotateUniformValues Impl(UI, MSSA, AA, F);
Impl.visit(F);
- PreservedAnalyses PA = PreservedAnalyses::none();
if (!Impl.changed())
- return PA;
+ return PreservedAnalyses::all();
+ PreservedAnalyses PA = PreservedAnalyses::none();
// TODO: Should preserve nearly everything
PA.preserveSet<CFGAnalyses>();
return PA;
diff --git a/llvm/lib/Target/AMDGPU/AMDGPUCodeGenPrepare.cpp b/llvm/lib/Target/AMDGPU/AMDGPUCodeGenPrepare.cpp
index c49aab823b44a4..7257b53afe69d0 100644
--- a/llvm/lib/Target/AMDGPU/AMDGPUCodeGenPrepare.cpp
+++ b/llvm/lib/Target/AMDGPU/AMDGPUCodeGenPrepare.cpp
@@ -2303,10 +2303,12 @@ PreservedAnalyses AMDGPUCodeGenPreparePass::run(Function &F,
SIModeRegisterDefaults Mode(F, *Impl.ST);
Impl.HasFP32DenormalFlush =
Mode.FP32Denormals == DenormalMode::getPreserveSign();
+ if (!Impl.run(F))
+ return PreservedAnalyses::all();
PreservedAnalyses PA = PreservedAnalyses::none();
if (!Impl.FlowChanged)
PA.preserveSet<CFGAnalyses>();
- return Impl.run(F) ? PA : PreservedAnalyses::all();
+ return PA;
}
INITIALIZE_PASS_BEGIN(AMDGPUCodeGenPrepare, DEBUG_TYPE,
diff --git a/llvm/lib/Target/AMDGPU/AMDGPULateCodeGenPrepare.cpp b/llvm/lib/Target/AMDGPU/AMDGPULateCodeGenPrepare.cpp
index 30ef390faab8bd..86ed29acb09abc 100644
--- a/llvm/lib/Target/AMDGPU/AMDGPULateCodeGenPrepare.cpp
+++ b/llvm/lib/Target/AMDGPU/AMDGPULateCodeGenPrepare.cpp
@@ -484,9 +484,9 @@ AMDGPULateCodeGenPreparePass::run(Function &F, FunctionAnalysisManager &FAM) {
bool Changed = Impl.run(F);
- PreservedAnalyses PA = PreservedAnalyses::none();
if (!Changed)
- return PA;
+ return PreservedAnalyses::all();
+ PreservedAnalyses PA = PreservedAnalyses::none();
PA.preserveSet<CFGAnalyses>();
return PA;
}
diff --git a/llvm/lib/Target/AMDGPU/SIAnnotateControlFlow.cpp b/llvm/lib/Target/AMDGPU/SIAnnotateControlFlow.cpp
index ea653490f1bf37..67012669a6df0c 100644
--- a/llvm/lib/Target/AMDGPU/SIAnnotateControlFlow.cpp
+++ b/llvm/lib/Target/AMDGPU/SIAnnotateControlFlow.cpp
@@ -391,7 +391,7 @@ PreservedAnalyses SIAnnotateControlFlowPass::run(Function &F,
// FIXME: We introduce dead declarations of intrinsics even if never used.
bool Changed = Impl.run(F);
if (!Changed)
- return PreservedAnalyses::none();
+ return PreservedAnalyses::all();
// TODO: Is LoopInfo preserved?
PreservedAnalyses PA = PreservedAnalyses::none();
|
jayfoad
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.
Found by code inspection.
| SIModeRegisterDefaults Mode(F, *Impl.ST); | ||
| Impl.HasFP32DenormalFlush = | ||
| Mode.FP32Denormals == DenormalMode::getPreserveSign(); | ||
| if (!Impl.run(F)) |
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.
The old code was checking Impl.FlowChanged before calling Impl.run which seems completely wrong.
No description provided.