[llvm] 3923e04 - [AMDGPU] Preserve all analyses if nothing changed (#117994)
via llvm-commits
llvm-commits at lists.llvm.org
Thu Nov 28 06:33:09 PST 2024
Author: Jay Foad
Date: 2024-11-28T14:33:05Z
New Revision: 3923e0451a4b02c4fe7c394e0f0ec90708ebca7a
URL: https://github.com/llvm/llvm-project/commit/3923e0451a4b02c4fe7c394e0f0ec90708ebca7a
DIFF: https://github.com/llvm/llvm-project/commit/3923e0451a4b02c4fe7c394e0f0ec90708ebca7a.diff
LOG: [AMDGPU] Preserve all analyses if nothing changed (#117994)
Added:
Modified:
llvm/lib/Target/AMDGPU/AMDGPUAnnotateUniformValues.cpp
llvm/lib/Target/AMDGPU/AMDGPUCodeGenPrepare.cpp
llvm/lib/Target/AMDGPU/AMDGPULateCodeGenPrepare.cpp
llvm/lib/Target/AMDGPU/SIAnnotateControlFlow.cpp
Removed:
################################################################################
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();
More information about the llvm-commits
mailing list