llvm.org GIT mirror llvm / c0c43ac
Revert "New pass manager for LICM." Summary: This reverts commit r275118. Subscribers: sanjoy, mehdi_amini Differential Revision: http://reviews.llvm.org/D22259 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@275156 91177308-0d34-0410-b5e6-96231b3b80d8 Vitaly Buka 4 years ago
31 changed file(s) with 70 addition(s) and 178 deletion(s). Raw diff Collapse all Expand all
158158 void initializeIntervalPartitionPass(PassRegistry&);
159159 void initializeJumpThreadingPass(PassRegistry&);
160160 void initializeLCSSAWrapperPassPass(PassRegistry &);
161 void initializeLegacyLICMPassPass(PassRegistry&);
161 void initializeLICMPass(PassRegistry&);
162162 void initializeLazyValueInfoWrapperPassPass(PassRegistry&);
163163 void initializeLintPass(PassRegistry&);
164164 void initializeLiveDebugValuesPass(PassRegistry&);
+0
-48
include/llvm/Transforms/Scalar/LICM.h less more
None //===- LICM.h - Loop Invariant Code Motion Pass -------*- C++ -*-===//
1 //
2 // The LLVM Compiler Infrastructure
3 //
4 // This file is distributed under the University of Illinois Open Source
5 // License. See LICENSE.TXT for details.
6 //
7 //===----------------------------------------------------------------------===//
8 //
9 // This pass performs loop invariant code motion, attempting to remove as much
10 // code from the body of a loop as possible. It does this by either hoisting
11 // code into the preheader block, or by sinking code to the exit blocks if it is
12 // safe. This pass also promotes must-aliased memory locations in the loop to
13 // live in registers, thus hoisting and sinking "invariant" loads and stores.
14 //
15 // This pass uses alias analysis for two purposes:
16 //
17 // 1. Moving loop invariant loads and calls out of loops. If we can determine
18 // that a load or call inside of a loop never aliases anything stored to,
19 // we can hoist it or sink it like any other instruction.
20 // 2. Scalar Promotion of Memory - If there is a store instruction inside of
21 // the loop, we try to move the store to happen AFTER the loop instead of
22 // inside of the loop. This can only happen if a few conditions are true:
23 // A. The pointer stored through is loop invariant
24 // B. There are no stores or loads in the loop which _may_ alias the
25 // pointer. There are no calls in the loop which mod/ref the pointer.
26 // If these conditions are true, we can promote the loads and stores in the
27 // loop of the pointer to use a temporary alloca'd variable. We then use
28 // the SSAUpdater to construct the appropriate SSA form for the value.
29 //
30 //===----------------------------------------------------------------------===//
31
32 #ifndef LLVM_TRANSFORMS_SCALAR_LICM_H
33 #define LLVM_TRANSFORMS_SCALAR_LICM_H
34
35 #include "llvm/Analysis/LoopInfo.h"
36 #include "llvm/IR/PassManager.h"
37
38 namespace llvm {
39
40 /// Performs Loop Invariant Code Motion Pass.
41 class LICMPass : public PassInfoMixin {
42 public:
43 PreservedAnalyses run(Loop &L, AnalysisManager &AM);
44 };
45 } // end namespace llvm
46
47 #endif // LLVM_TRANSFORMS_SCALAR_LICM_H
121121 initializePostOrderFunctionAttrsLegacyPassPass(R);
122122 initializeReversePostOrderFunctionAttrsLegacyPassPass(R);
123123 initializeGlobalsAAWrapperPassPass(R);
124 initializeLegacyLICMPassPass(R);
124 initializeLICMPass(R);
125125 initializeMergedLoadStoreMotionLegacyPassPass(R);
126126 initializeGVNLegacyPassPass(R);
127127 initializeMemCpyOptLegacyPassPass(R);
8787 #include "llvm/Transforms/Scalar/GuardWidening.h"
8888 #include "llvm/Transforms/Scalar/IndVarSimplify.h"
8989 #include "llvm/Transforms/Scalar/JumpThreading.h"
90 #include "llvm/Transforms/Scalar/LICM.h"
9190 #include "llvm/Transforms/Scalar/LoopRotation.h"
9291 #include "llvm/Transforms/Scalar/LoopSimplifyCFG.h"
9392 #include "llvm/Transforms/Scalar/LowerAtomic.h"
186186 #define LOOP_PASS(NAME, CREATE_PASS)
187187 #endif
188188 LOOP_PASS("invalidate", InvalidateAllAnalysesPass())
189 LOOP_PASS("licm", LICMPass())
190189 LOOP_PASS("rotate", LoopRotatePass())
191190 LOOP_PASS("no-op-loop", NoOpLoopPass())
192191 LOOP_PASS("print", PrintLoopPass(dbgs()))
2929 //
3030 //===----------------------------------------------------------------------===//
3131
32 #include "llvm/Transforms/Scalar/LICM.h"
3332 #include "llvm/ADT/Statistic.h"
3433 #include "llvm/Analysis/AliasAnalysis.h"
3534 #include "llvm/Analysis/AliasSetTracker.h"
4039 #include "llvm/Analysis/Loads.h"
4140 #include "llvm/Analysis/LoopInfo.h"
4241 #include "llvm/Analysis/LoopPass.h"
43 #include "llvm/Analysis/LoopPassManager.h"
4442 #include "llvm/Analysis/MemoryBuiltins.h"
4543 #include "llvm/Analysis/ScalarEvolution.h"
4644 #include "llvm/Analysis/ScalarEvolutionAliasAnalysis.h"
105103 LoopSafetyInfo *SafetyInfo);
106104
107105 namespace {
108 struct LoopInvariantCodeMotion {
109 bool runOnLoop(Loop *L, AliasAnalysis *AA, LoopInfo *LI, DominatorTree *DT,
110 TargetLibraryInfo *TLI, ScalarEvolution *SE);
111
112 DenseMap &getLoopToAliasSetMap() {
113 return LoopToAliasSetMap;
114 }
115
116 private:
117 DenseMap LoopToAliasSetMap;
118
119 AliasSetTracker *collectAliasInfoForLoop(Loop *L, LoopInfo *LI,
120 AliasAnalysis *AA);
121 };
122
123 struct LegacyLICMPass : public LoopPass {
106 struct LICM : public LoopPass {
124107 static char ID; // Pass identification, replacement for typeid
125 LegacyLICMPass() : LoopPass(ID) {
126 initializeLegacyLICMPassPass(*PassRegistry::getPassRegistry());
127 }
128
129 bool runOnLoop(Loop *L, LPPassManager &LPM) override {
130 if (skipLoop(L))
131 return false;
132
133 auto *SE = getAnalysisIfAvailable();
134 return LICM.runOnLoop(L,
135 &getAnalysis().getAAResults(),
136 &getAnalysis().getLoopInfo(),
137 &getAnalysis().getDomTree(),
138 &getAnalysis().getTLI(),
139 SE ? &SE->getSE() : nullptr);
140 }
108 LICM() : LoopPass(ID) {
109 initializeLICMPass(*PassRegistry::getPassRegistry());
110 }
111
112 bool runOnLoop(Loop *L, LPPassManager &LPM) override;
141113
142114 /// This transformation requires natural loop information & requires that
143115 /// loop preheaders be inserted into the CFG...
151123 using llvm::Pass::doFinalization;
152124
153125 bool doFinalization() override {
154 assert(LICM.getLoopToAliasSetMap().empty() &&
155 "Didn't free loop alias sets");
126 assert(LoopToAliasSetMap.empty() && "Didn't free loop alias sets");
156127 return false;
157128 }
158129
159130 private:
160 LoopInvariantCodeMotion LICM;
131 AliasAnalysis *AA; // Current AliasAnalysis information
132 LoopInfo *LI; // Current LoopInfo
133 DominatorTree *DT; // Dominator Tree for the current Loop.
134
135 TargetLibraryInfo *TLI; // TargetLibraryInfo for constant folding.
136
137 // State that is updated as we process loops.
138 bool Changed; // Set to true when we change anything.
139 BasicBlock *Preheader; // The preheader block of the current loop...
140 Loop *CurLoop; // The current loop we are working on...
141 AliasSetTracker *CurAST; // AliasSet information for the current loop...
142 DenseMap LoopToAliasSetMap;
161143
162144 /// cloneBasicBlockAnalysis - Simple Analysis hook. Clone alias set info.
163145 void cloneBasicBlockAnalysis(BasicBlock *From, BasicBlock *To,
169151
170152 /// Simple Analysis hook. Delete loop L from alias set map.
171153 void deleteAnalysisLoop(Loop *L) override;
154
155 AliasSetTracker *collectAliasInfoForLoop(Loop *L);
172156 };
173157 }
174158
175 PreservedAnalyses LICMPass::run(Loop &L, AnalysisManager &AM) {
176 // FIXME: Check if loop should be skipped.
177
178 const auto &FAM =
179 AM.getResult(L).getManager();
180 Function *F = L.getHeader()->getParent();
181
182 auto *AA = FAM.getCachedResult(*F);
183 auto *LI = FAM.getCachedResult(*F);
184 auto *DT = FAM.getCachedResult(*F);
185 auto *TLI = FAM.getCachedResult(*F);
186 auto *SE = FAM.getCachedResult(*F);
187 assert((AA && LI && DT && TLI && SE) && "Analyses for LICM not available");
188
189 LoopInvariantCodeMotion LICM;
190
191 if (!LICM.runOnLoop(&L, AA, LI, DT, TLI, SE))
192 return PreservedAnalyses::all();
193
194 // FIXME: There is no setPreservesCFG in the new PM. When that becomes
195 // available, it should be used here.
196 return getLoopPassPreservedAnalyses();
197 }
198
199 char LegacyLICMPass::ID = 0;
200 INITIALIZE_PASS_BEGIN(LegacyLICMPass, "licm", "Loop Invariant Code Motion",
201 false, false)
159 char LICM::ID = 0;
160 INITIALIZE_PASS_BEGIN(LICM, "licm", "Loop Invariant Code Motion", false, false)
202161 INITIALIZE_PASS_DEPENDENCY(LoopPass)
203162 INITIALIZE_PASS_DEPENDENCY(TargetLibraryInfoWrapperPass)
204 INITIALIZE_PASS_END(LegacyLICMPass, "licm", "Loop Invariant Code Motion", false,
205 false)
206
207 Pass *llvm::createLICMPass() { return new LegacyLICMPass(); }
163 INITIALIZE_PASS_END(LICM, "licm", "Loop Invariant Code Motion", false, false)
164
165 Pass *llvm::createLICMPass() { return new LICM(); }
208166
209167 /// Hoist expressions out of the specified loop. Note, alias info for inner
210168 /// loop is not preserved so it is not a good idea to run LICM multiple
211169 /// times on one loop.
212170 ///
213 bool LoopInvariantCodeMotion::runOnLoop(Loop *L, AliasAnalysis *AA,
214 LoopInfo *LI, DominatorTree *DT,
215 TargetLibraryInfo *TLI,
216 ScalarEvolution *SE) {
217 bool Changed = false;
171 bool LICM::runOnLoop(Loop *L, LPPassManager &LPM) {
172 if (skipLoop(L))
173 return false;
174
175 Changed = false;
176
177 // Get our Loop and Alias Analysis information...
178 LI = &getAnalysis().getLoopInfo();
179 AA = &getAnalysis().getAAResults();
180 DT = &getAnalysis().getDomTree();
181
182 TLI = &getAnalysis().getTLI();
218183
219184 assert(L->isLCSSAForm(*DT) && "Loop is not in LCSSA form.");
220185
221 AliasSetTracker *CurAST = collectAliasInfoForLoop(L, LI, AA);
186 CurAST = collectAliasInfoForLoop(L);
187
188 CurLoop = L;
222189
223190 // Get the preheader block to move instructions into...
224 BasicBlock *Preheader = L->getLoopPreheader();
191 Preheader = L->getLoopPreheader();
225192
226193 // Compute loop safety information.
227194 LoopSafetyInfo SafetyInfo;
228 computeLoopSafetyInfo(&SafetyInfo, L);
195 computeLoopSafetyInfo(&SafetyInfo, CurLoop);
229196
230197 // We want to visit all of the instructions in this loop... that are not parts
231198 // of our subloops (they have already had their invariants hoisted out of
238205 // instructions, we perform another pass to hoist them out of the loop.
239206 //
240207 if (L->hasDedicatedExits())
241 Changed |= sinkRegion(DT->getNode(L->getHeader()), AA, LI, DT, TLI, L,
208 Changed |= sinkRegion(DT->getNode(L->getHeader()), AA, LI, DT, TLI, CurLoop,
242209 CurAST, &SafetyInfo);
243210 if (Preheader)
244 Changed |= hoistRegion(DT->getNode(L->getHeader()), AA, LI, DT, TLI, L,
245 CurAST, &SafetyInfo);
211 Changed |= hoistRegion(DT->getNode(L->getHeader()), AA, LI, DT, TLI,
212 CurLoop, CurAST, &SafetyInfo);
246213
247214 // Now that all loop invariants have been removed from the loop, promote any
248215 // memory references to scalars that we can.
253220
254221 // Loop over all of the alias sets in the tracker object.
255222 for (AliasSet &AS : *CurAST)
256 Changed |= promoteLoopAccessesToScalars(
257 AS, ExitBlocks, InsertPts, PIC, LI, DT, TLI, L, CurAST, &SafetyInfo);
223 Changed |=
224 promoteLoopAccessesToScalars(AS, ExitBlocks, InsertPts, PIC, LI, DT,
225 TLI, CurLoop, CurAST, &SafetyInfo);
258226
259227 // Once we have promoted values across the loop body we have to recursively
260228 // reform LCSSA as any nested loop may now have values defined within the
263231 // SSAUpdater strategy during promotion that was LCSSA aware and reformed
264232 // it as it went.
265233 if (Changed) {
266 formLCSSARecursively(*L, *DT, LI, SE);
234 auto *SEWP = getAnalysisIfAvailable();
235 formLCSSARecursively(*L, *DT, LI, SEWP ? &SEWP->getSE() : nullptr);
267236 }
268237 }
269238
274243 assert((!L->getParentLoop() || L->getParentLoop()->isLCSSAForm(*DT)) &&
275244 "Parent loop not left in LCSSA form after LICM!");
276245
246 // Clear out loops state information for the next iteration
247 CurLoop = nullptr;
248 Preheader = nullptr;
249
277250 // If this loop is nested inside of another one, save the alias information
278251 // for when we process the outer loop.
279252 if (L->getParentLoop())
281254 else
282255 delete CurAST;
283256
284 if (Changed && SE)
285 SE->forgetLoopDispositions(L);
257 if (Changed)
258 if (auto *SEWP = getAnalysisIfAvailable())
259 SEWP->getSE().forgetLoopDispositions(L);
286260 return Changed;
287261 }
288262
412386 // Iterate over header and compute safety info.
413387 for (BasicBlock::iterator I = Header->begin(), E = Header->end();
414388 (I != E) && !SafetyInfo->HeaderMayThrow; ++I)
415 SafetyInfo->HeaderMayThrow |=
416 !isGuaranteedToTransferExecutionToSuccessor(&*I);
389 SafetyInfo->HeaderMayThrow |= !isGuaranteedToTransferExecutionToSuccessor(&*I);
417390
418391 SafetyInfo->MayThrow = SafetyInfo->HeaderMayThrow;
419392 // Iterate over loop instructions and compute safety info.
10681041
10691042 /// Returns an owning pointer to an alias set which incorporates aliasing info
10701043 /// from L and all subloops of L.
1071 /// FIXME: In new pass manager, there is no helper functions to handle loop
1072 /// analysis such as cloneBasicBlockAnalysis. So the AST needs to be recompute
1073 /// from scratch for every loop. Hook up with the helper functions when
1074 /// available in the new pass manager to avoid redundant computation.
1075 AliasSetTracker *
1076 LoopInvariantCodeMotion::collectAliasInfoForLoop(Loop *L, LoopInfo *LI,
1077 AliasAnalysis *AA) {
1044 AliasSetTracker *LICM::collectAliasInfoForLoop(Loop *L) {
10781045 AliasSetTracker *CurAST = nullptr;
10791046 SmallVector RecomputeLoops;
10801047 for (Loop *InnerL : L->getSubLoops()) {
11241091
11251092 /// Simple analysis hook. Clone alias set info.
11261093 ///
1127 void LegacyLICMPass::cloneBasicBlockAnalysis(BasicBlock *From, BasicBlock *To,
1128 Loop *L) {
1129 AliasSetTracker *AST = LICM.getLoopToAliasSetMap().lookup(L);
1094 void LICM::cloneBasicBlockAnalysis(BasicBlock *From, BasicBlock *To, Loop *L) {
1095 AliasSetTracker *AST = LoopToAliasSetMap.lookup(L);
11301096 if (!AST)
11311097 return;
11321098
11351101
11361102 /// Simple Analysis hook. Delete value V from alias set
11371103 ///
1138 void LegacyLICMPass::deleteAnalysisValue(Value *V, Loop *L) {
1139 AliasSetTracker *AST = LICM.getLoopToAliasSetMap().lookup(L);
1104 void LICM::deleteAnalysisValue(Value *V, Loop *L) {
1105 AliasSetTracker *AST = LoopToAliasSetMap.lookup(L);
11401106 if (!AST)
11411107 return;
11421108
11451111
11461112 /// Simple Analysis hook. Delete value L from alias set map.
11471113 ///
1148 void LegacyLICMPass::deleteAnalysisLoop(Loop *L) {
1149 AliasSetTracker *AST = LICM.getLoopToAliasSetMap().lookup(L);
1114 void LICM::deleteAnalysisLoop(Loop *L) {
1115 AliasSetTracker *AST = LoopToAliasSetMap.lookup(L);
11501116 if (!AST)
11511117 return;
11521118
11531119 delete AST;
1154 LICM.getLoopToAliasSetMap().erase(L);
1120 LoopToAliasSetMap.erase(L);
11551121 }
11561122
11571123 /// Return true if the body of this loop may store into the memory
4747 initializeInductiveRangeCheckEliminationPass(Registry);
4848 initializeIndVarSimplifyLegacyPassPass(Registry);
4949 initializeJumpThreadingPass(Registry);
50 initializeLegacyLICMPassPass(Registry);
50 initializeLICMPass(Registry);
5151 initializeLoopDataPrefetchPass(Registry);
5252 initializeLoopDeletionPass(Registry);
5353 initializeLoopAccessLegacyAnalysisPass(Registry);
0 ; RUN: opt -S -basicaa -licm %s | FileCheck %s
1 ; RUN: opt -aa-pipeline=basic-aa -passes='require,require,require,loop(licm)' < %s -S | FileCheck %s
21 declare i32 @foo() readonly argmemonly nounwind
32 declare i32 @foo2() readonly nounwind
43 declare i32 @bar(i32* %loc2) readonly argmemonly nounwind
0 ; RUN: opt -licm -basicaa < %s -S | FileCheck %s
1 ; RUN: opt -aa-pipeline=basic-aa -passes='require,require,require,loop(licm)' < %s -S | FileCheck %s
21
32 define void @f_0(i1 %p) nounwind ssp {
43 ; CHECK-LABEL: @f_0(
0 ; RUN: opt < %s -S -basicaa -licm | FileCheck %s
1 ; RUN: opt -aa-pipeline=basic-aa -passes='lcssa,require,require,require,loop(licm)' < %s -S | FileCheck %s
21
32 ; Check that we can hoist unordered loads
43 define i32 @test1(i32* nocapture %y) nounwind uwtable ssp {
0 ; RUN: opt < %s -licm | llvm-dis
1 ; RUN: opt -aa-pipeline=basic-aa -passes='require,require,require,loop(licm)' < %s | llvm-dis
21
32 define void @testfunc(i32 %i) {
43 ;
0 ; RUN: opt < %s -S -basicaa -licm | FileCheck %s
1 ; RUN: opt -aa-pipeline=basic-aa -passes='lcssa,require,require,require,loop(licm)' < %s -S | FileCheck %s
21 ; This fixes PR22460
32
43 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
0 ; RUN: opt -licm -disable-output < %s
1 ; RUN: opt -aa-pipeline=basic-aa -passes='require,require,require,loop(licm)' -disable-output < %s
21
32 target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64"
43 target triple = "x86_64-apple-darwin10.0.0"
0 ; RUN: opt -licm -basicaa < %s -S | FileCheck %s
1 ; RUN: opt -aa-pipeline=basic-aa -passes='require,require,require,loop(licm)' < %s -S | FileCheck %s
21
32 define void @dgefa() nounwind ssp {
43 entry:
0 ; RUN: opt < %s -licm -S | FileCheck %s
1 ; RUN: opt -passes='require,require,require,loop(licm)' < %s -S | FileCheck %s
21 ; PR19835
32 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
43 target triple = "x86_64-unknown-linux-gnu"
0 ; RUN: opt < %s -licm -S | FileCheck %s
1 ; RUN: opt -aa-pipeline=basic-aa -passes='require,require,require,loop(licm)' < %s -S | FileCheck %s
21
32 target datalayout = "e-m:x-p:32:32-i64:64-f80:32-n8:16:32-a:0:32-S32"
43 target triple = "i386-pc-windows-msvc18.0.0"
0 ; RUN: opt -S -basicaa -licm < %s | FileCheck %s
1 ; RUN: opt -aa-pipeline=basic-aa -passes='loop-simplify,require,require,require,loop(simplify-cfg,licm)' -S < %s | FileCheck %s
21 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
32 target triple = "x86_64-unknown-linux-gnu"
43
0 ; RUN: opt -S -basicaa -licm < %s | FileCheck %s
1 ; RUN: opt -aa-pipeline=basic-aa -passes='loop-simplify,require,require,require,loop(simplify-cfg,licm)' -S < %s | FileCheck %s
21 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
32 target triple = "x86_64-unknown-linux-gnu"
43
0 ; RUN: opt -S -basicaa -licm < %s | FileCheck %s
1 ; RUN: opt -aa-pipeline=basic-aa -passes='lcssa,require,require,require,loop(licm)' -S %s | FileCheck %s
21 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
32 target triple = "x86_64-unknown-linux-gnu"
43
0 ; RUN: opt -S -licm < %s | FileCheck %s
1 ; RUN: opt -aa-pipeline=basic-aa -passes='require,require,require,loop(licm)' -S %s | FileCheck %s
21
32 target datalayout = "E-m:e-p:32:32-i8:8:8-i16:16:16-i64:32:32-f64:32:32-v64:32:32-v128:32:32-a0:0:32-n32"
43
0 ; RUN: opt < %s -licm -S | FileCheck %s
1 ; RUN: opt -lcssa %s | opt -aa-pipeline=basic-aa -passes='require,require,require,loop(licm)' -S | FileCheck %s
21
32 @X = global i32 0 ; [#uses=1]
43
0 ; RUN: opt -S -basicaa -licm < %s | FileCheck %s
1 ; RUN: opt -aa-pipeline=basic-aa -passes='require,require,require,loop(licm)' -S %s| FileCheck %s
21 ;
32 ; Manually validate LCSSA form is preserved even after SSAUpdater is used to
43 ; promote things in the loop bodies.
0 ; Test that LICM works when there is not a loop-preheader
11 ; RUN: opt < %s -licm | llvm-dis
2 ; RUN: opt -aa-pipeline=basic-aa -passes='require,require,require,loop(licm)' < %s | llvm-dis
32
43 define void @testfunc(i32 %i.s, i1 %ifcond) {
54 br i1 %ifcond, label %Then, label %Else
0 ; RUN: opt -S -licm < %s | FileCheck %s
1 ; RUN: opt -aa-pipeline=basic-aa -passes='require,require,require,loop(licm)' -S %s | FileCheck %s
21
32 declare void @use_nothrow(i64 %a) nounwind
43 declare void @use(i64 %a)
0 ; RUN: opt -tbaa -basicaa -licm -S < %s | FileCheck %s
1 ; RUN: opt -aa-pipeline=type-based-aa,basic-aa -passes='require,require,require,loop(licm)' -S %s | FileCheck %s
21
32 ; LICM should keep the stores in their original order when it sinks/promotes them.
43 ; rdar://12045203
0 ; RUN: opt -tbaa -basicaa -licm -S < %s | FileCheck %s
1 ; RUN: opt -aa-pipeline=type-based-aa,basic-aa -passes='require,require,require,loop(licm)' -S %s | FileCheck %s
21
32 ; If we can prove a local is thread local, we can insert stores during
43 ; promotion which wouldn't be legal otherwise.
0 ; RUN: opt < %s -basicaa -licm -S | FileCheck %s
1 ; RUN: opt -aa-pipeline=type-based-aa,basic-aa -passes='require,require,require,loop(licm)' -S %s | FileCheck %s
21
32 ; Make sure we don't hoist a conditionally-executed store out of the loop;
43 ; it would violate the concurrency memory model
0 ; RUN: opt < %s -basicaa -licm -S | FileCheck %s
1 ; RUN: opt -aa-pipeline=basic-aa -passes='require,require,require,loop(licm)' -S %s | FileCheck %s
21
32 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
43 target triple = "x86_64-unknown-linux-gnu"
0 ; RUN: opt < %s -basicaa -tbaa -licm -S | FileCheck %s
1 ; RUN: opt -aa-pipeline=type-based-aa,basic-aa -passes='require,require,require,loop(licm)' -S %s | FileCheck %s
21 target datalayout = "E-p:64:64:64-a0:0:8-f32:32:32-f64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-v64:64:64-v128:128:128"
32
43 @X = global i32 7 ; [#uses=4]
0 ; RUN: opt -S -licm < %s | FileCheck %s
1 ; RUN: opt -passes='require,require,require,loop(licm)' -S %s | FileCheck %s
21
32 ; UDiv is safe to speculate if the denominator is known non-zero.
43
0 ; RUN: opt -basicaa -sroa -loop-rotate -licm -S < %s | FileCheck %s
1 ; RUN: opt -basicaa -sroa -loop-rotate %s | opt -aa-pipeline=basic-aa -passes='require,require,require,loop(licm)' -S | FileCheck %s
21 ; The objects *p and *q are aliased to each other, but even though *q is
32 ; volatile, *p can be considered invariant in the loop. Check if it is moved
43 ; out of the loop.