From f0372d03e5d9c9968c3272e6cb1438412ba8c72a Mon Sep 17 00:00:00 2001 From: Kazu Hirata Date: Sun, 15 Oct 2023 00:31:48 -0700 Subject: [PATCH] [Scalar] Use LLVMContext::MD_mem_parallel_loop_access directly (NFC) This patch "constant propagates" LLVMContext::MD_mem_parallel_loop_access into wherever ParallelLoopAccessMDKind is used. --- llvm/lib/Transforms/Scalar/Scalarizer.cpp | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/llvm/lib/Transforms/Scalar/Scalarizer.cpp b/llvm/lib/Transforms/Scalar/Scalarizer.cpp index 111c477337535f..f5e480ae36bf42 100644 --- a/llvm/lib/Transforms/Scalar/Scalarizer.cpp +++ b/llvm/lib/Transforms/Scalar/Scalarizer.cpp @@ -282,12 +282,10 @@ T getWithDefaultOverride(const cl::opt &ClOption, class ScalarizerVisitor : public InstVisitor { public: - ScalarizerVisitor(unsigned ParallelLoopAccessMDKind, DominatorTree *DT, - ScalarizerPassOptions Options) - : ParallelLoopAccessMDKind(ParallelLoopAccessMDKind), DT(DT), - ScalarizeVariableInsertExtract( - getWithDefaultOverride(ClScalarizeVariableInsertExtract, - Options.ScalarizeVariableInsertExtract)), + ScalarizerVisitor(DominatorTree *DT, ScalarizerPassOptions Options) + : DT(DT), ScalarizeVariableInsertExtract(getWithDefaultOverride( + ClScalarizeVariableInsertExtract, + Options.ScalarizeVariableInsertExtract)), ScalarizeLoadStore(getWithDefaultOverride(ClScalarizeLoadStore, Options.ScalarizeLoadStore)), ScalarizeMinBits(getWithDefaultOverride(ClScalarizeMinBits, @@ -337,8 +335,6 @@ class ScalarizerVisitor : public InstVisitor { SmallVector PotentiallyDeadInstrs; - unsigned ParallelLoopAccessMDKind; - DominatorTree *DT; const bool ScalarizeVariableInsertExtract; @@ -448,8 +444,7 @@ bool ScalarizerLegacyPass::runOnFunction(Function &F) { return false; DominatorTree *DT = &getAnalysis().getDomTree(); - ScalarizerVisitor Impl(LLVMContext::MD_mem_parallel_loop_access, DT, - ScalarizerPassOptions()); + ScalarizerVisitor Impl(DT, ScalarizerPassOptions()); return Impl.visit(F); } @@ -556,7 +551,7 @@ bool ScalarizerVisitor::canTransferMetadata(unsigned Tag) { || Tag == LLVMContext::MD_invariant_load || Tag == LLVMContext::MD_alias_scope || Tag == LLVMContext::MD_noalias - || Tag == ParallelLoopAccessMDKind + || Tag == LLVMContext::MD_mem_parallel_loop_access || Tag == LLVMContext::MD_access_group); } @@ -1253,7 +1248,7 @@ bool ScalarizerVisitor::finish() { PreservedAnalyses ScalarizerPass::run(Function &F, FunctionAnalysisManager &AM) { DominatorTree *DT = &AM.getResult(F); - ScalarizerVisitor Impl(LLVMContext::MD_mem_parallel_loop_access, DT, Options); + ScalarizerVisitor Impl(DT, Options); bool Changed = Impl.visit(F); PreservedAnalyses PA; PA.preserve();