From b6171c529670e5c240aaf9c08f5f1b6dba9d16fc Mon Sep 17 00:00:00 2001 From: Arnold Schwaighofer Date: Tue, 13 Aug 2013 15:51:25 +0000 Subject: Remove logic that decides whether to vectorize or not depending on O-levels I have moved this logic into clang and opt. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@188281 91177308-0d34-0410-b5e6-96231b3b80d8 --- tools/opt/opt.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'tools/opt') diff --git a/tools/opt/opt.cpp b/tools/opt/opt.cpp index 37637ca..ca82061 100644 --- a/tools/opt/opt.cpp +++ b/tools/opt/opt.cpp @@ -451,6 +451,8 @@ static void AddOptimizationPasses(PassManagerBase &MPM,FunctionPassManager &FPM, Builder.populateFunctionPassManager(FPM); Builder.populateModulePassManager(MPM); + + Builder.LoopVectorize = OptLevel > 1 && SizeLevel < 2; } static void AddStandardCompilePasses(PassManagerBase &PM) { -- cgit v1.1 From 435798e96a64738b55a01055dde1bc9a88a15191 Mon Sep 17 00:00:00 2001 From: Hal Finkel Date: Wed, 28 Aug 2013 18:33:10 +0000 Subject: Disable unrolling in the loop vectorizer when disabled in the pass manager When unrolling is disabled in the pass manager, the loop vectorizer should also not unroll loops. This will allow the -fno-unroll-loops option in Clang to behave as expected (even for vectorizable loops). The loop vectorizer's -force-vector-unroll option will (continue to) override the pass-manager setting (including -force-vector-unroll=0 to force use of the internal auto-selection logic). In order to test this, I added a flag to opt (-disable-loop-unrolling) to force disable unrolling through opt (the analog of -fno-unroll-loops in Clang). Also, this fixes a small bug in opt where the loop vectorizer was enabled only after the pass manager populated the queue of passes (the global_alias.ll test needed a slight update to the RUN line as a result of this fix). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@189499 91177308-0d34-0410-b5e6-96231b3b80d8 --- tools/opt/opt.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'tools/opt') diff --git a/tools/opt/opt.cpp b/tools/opt/opt.cpp index ca82061..691080a 100644 --- a/tools/opt/opt.cpp +++ b/tools/opt/opt.cpp @@ -136,6 +136,11 @@ UnitAtATime("funit-at-a-time", cl::init(true)); static cl::opt +DisableLoopUnrolling("disable-loop-unrolling", + cl::desc("Disable loop unrolling in all relevant passes"), + cl::init(false)); + +static cl::opt DisableSimplifyLibCalls("disable-simplify-libcalls", cl::desc("Disable simplify-libcalls")); @@ -447,12 +452,13 @@ static void AddOptimizationPasses(PassManagerBase &MPM,FunctionPassManager &FPM, Builder.Inliner = createAlwaysInlinerPass(); } Builder.DisableUnitAtATime = !UnitAtATime; - Builder.DisableUnrollLoops = OptLevel == 0; + Builder.DisableUnrollLoops = (DisableLoopUnrolling.getNumOccurrences() > 0) ? + DisableLoopUnrolling : OptLevel == 0; + Builder.LoopVectorize = OptLevel > 1 && SizeLevel < 2; + Builder.populateFunctionPassManager(FPM); Builder.populateModulePassManager(MPM); - - Builder.LoopVectorize = OptLevel > 1 && SizeLevel < 2; } static void AddStandardCompilePasses(PassManagerBase &PM) { -- cgit v1.1 From 2c9905a1f3bcf22cc2f93332cc8411d11798ba07 Mon Sep 17 00:00:00 2001 From: Manman Ren Date: Mon, 9 Sep 2013 19:47:11 +0000 Subject: Debug Info: Use DIScopeRef for DIType::getContext. In DIBuilder, the context field of a TAG_member is updated to use the scope reference. Verifier is updated accordingly. DebugInfoFinder now needs to generate a type identifier map to have access to the actual scope. Same applies for BreakpointPrinter. processModule of DebugInfoFinder is called during initialization phase of the verifier to make sure the type identifier map is constructed early enough. We are now able to unique a simple class as demonstrated by the added testing case. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@190334 91177308-0d34-0410-b5e6-96231b3b80d8 --- tools/opt/opt.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'tools/opt') diff --git a/tools/opt/opt.cpp b/tools/opt/opt.cpp index 691080a..94f4cca 100644 --- a/tools/opt/opt.cpp +++ b/tools/opt/opt.cpp @@ -367,6 +367,7 @@ char BasicBlockPassPrinter::ID = 0; struct BreakpointPrinter : public ModulePass { raw_ostream &Out; static char ID; + DITypeIdentifierMap TypeIdentifierMap; BreakpointPrinter(raw_ostream &out) : ModulePass(ID), Out(out) { @@ -382,13 +383,18 @@ struct BreakpointPrinter : public ModulePass { } else if (Context.isType()) { DIType TY(Context); if (!TY.getName().empty()) { - getContextName(TY.getContext(), N); + getContextName(TY.getContext().resolve(TypeIdentifierMap), N); N = N + TY.getName().str() + "::"; } } } virtual bool runOnModule(Module &M) { + TypeIdentifierMap.clear(); + NamedMDNode *CU_Nodes = M.getNamedMetadata("llvm.dbg.cu"); + if (CU_Nodes) + TypeIdentifierMap = generateDITypeIdentifierMap(CU_Nodes); + StringSet<> Processed; if (NamedMDNode *NMD = M.getNamedMetadata("llvm.dbg.sp")) for (unsigned i = 0, e = NMD->getNumOperands(); i != e; ++i) { -- cgit v1.1 From 4acd20a20be9f7d91ed35c1c6a501cec1605e854 Mon Sep 17 00:00:00 2001 From: Craig Topper Date: Wed, 18 Sep 2013 03:55:53 +0000 Subject: Lift alignment restrictions for load/store folding on VINSERTF128/VEXTRACTF128. Fixes PR17268. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@190916 91177308-0d34-0410-b5e6-96231b3b80d8 --- tools/opt/opt.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'tools/opt') diff --git a/tools/opt/opt.cpp b/tools/opt/opt.cpp index 94f4cca..71a9c02 100644 --- a/tools/opt/opt.cpp +++ b/tools/opt/opt.cpp @@ -462,6 +462,7 @@ static void AddOptimizationPasses(PassManagerBase &MPM,FunctionPassManager &FPM, DisableLoopUnrolling : OptLevel == 0; Builder.LoopVectorize = OptLevel > 1 && SizeLevel < 2; + Builder.SLPVectorize = true; Builder.populateFunctionPassManager(FPM); Builder.populateModulePassManager(MPM); -- cgit v1.1 From 0568ba6e3af7ae7eb3ad7871ad0581c926150c8d Mon Sep 17 00:00:00 2001 From: Greg Bedwell Date: Wed, 9 Oct 2013 08:55:27 +0000 Subject: Test commit. Remove whitespace from otherwise empty lines. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@192284 91177308-0d34-0410-b5e6-96231b3b80d8 --- tools/opt/opt.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'tools/opt') diff --git a/tools/opt/opt.cpp b/tools/opt/opt.cpp index 71a9c02..0055bb0 100644 --- a/tools/opt/opt.cpp +++ b/tools/opt/opt.cpp @@ -417,7 +417,7 @@ struct BreakpointPrinter : public ModulePass { AU.setPreservesAll(); } }; - + } // anonymous namespace char BreakpointPrinter::ID = 0; @@ -460,7 +460,7 @@ static void AddOptimizationPasses(PassManagerBase &MPM,FunctionPassManager &FPM, Builder.DisableUnitAtATime = !UnitAtATime; Builder.DisableUnrollLoops = (DisableLoopUnrolling.getNumOccurrences() > 0) ? DisableLoopUnrolling : OptLevel == 0; - + Builder.LoopVectorize = OptLevel > 1 && SizeLevel < 2; Builder.SLPVectorize = true; -- cgit v1.1 From b8e48a636e7ee6c13140382eb93d9695a65b0624 Mon Sep 17 00:00:00 2001 From: Manman Ren Date: Thu, 10 Oct 2013 18:40:01 +0000 Subject: Debug Info: In DIBuilder, the context field of subprogram is updated to use DIScopeRef. A paired commit at clang is required due to changes to DIBuilder. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@192378 91177308-0d34-0410-b5e6-96231b3b80d8 --- tools/opt/opt.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tools/opt') diff --git a/tools/opt/opt.cpp b/tools/opt/opt.cpp index 0055bb0..8a8da01 100644 --- a/tools/opt/opt.cpp +++ b/tools/opt/opt.cpp @@ -404,7 +404,7 @@ struct BreakpointPrinter : public ModulePass { "A MDNode in llvm.dbg.sp should be null or a DISubprogram."); if (!SP) continue; - getContextName(SP.getContext(), Name); + getContextName(SP.getContext().resolve(TypeIdentifierMap), Name); Name = Name + SP.getDisplayName().str(); if (!Name.empty() && Processed.insert(Name)) { Out << Name << "\n"; -- cgit v1.1 From b84d18f57604b86ce2cae5a2447a5f879153bc0f Mon Sep 17 00:00:00 2001 From: Bill Wendling Date: Sat, 7 Dec 2013 09:31:26 +0000 Subject: Merging r196294: ------------------------------------------------------------------------ r196294 | arnolds | 2013-12-03 08:33:06 -0800 (Tue, 03 Dec 2013) | 7 lines opt: Mirror vectorization presets of clang clang enables vectorization at optimization levels > 1 and size level < 2. opt should behave similarily. Loop vectorization and SLP vectorization can be disabled with the flags -disable-(loop/slp)-vectorization. ------------------------------------------------------------------------ git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_34@196649 91177308-0d34-0410-b5e6-96231b3b80d8 --- tools/opt/opt.cpp | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'tools/opt') diff --git a/tools/opt/opt.cpp b/tools/opt/opt.cpp index 8a8da01..dba16f7 100644 --- a/tools/opt/opt.cpp +++ b/tools/opt/opt.cpp @@ -139,6 +139,16 @@ static cl::opt DisableLoopUnrolling("disable-loop-unrolling", cl::desc("Disable loop unrolling in all relevant passes"), cl::init(false)); +static cl::opt +DisableLoopVectorization("disable-loop-vectorization", + cl::desc("Disable the loop vectorization pass"), + cl::init(false)); + +static cl::opt +DisableSLPVectorization("disable-slp-vectorization", + cl::desc("Disable the slp vectorization pass"), + cl::init(false)); + static cl::opt DisableSimplifyLibCalls("disable-simplify-libcalls", @@ -461,8 +471,10 @@ static void AddOptimizationPasses(PassManagerBase &MPM,FunctionPassManager &FPM, Builder.DisableUnrollLoops = (DisableLoopUnrolling.getNumOccurrences() > 0) ? DisableLoopUnrolling : OptLevel == 0; - Builder.LoopVectorize = OptLevel > 1 && SizeLevel < 2; - Builder.SLPVectorize = true; + Builder.LoopVectorize = + DisableLoopVectorization ? false : OptLevel > 1 && SizeLevel < 2; + Builder.SLPVectorize = + DisableSLPVectorization ? false : OptLevel > 1 && SizeLevel < 2; Builder.populateFunctionPassManager(FPM); Builder.populateModulePassManager(MPM); -- cgit v1.1