llvm.org GIT mirror llvm / e1d0bc8
New pass manager for LICM. Summary: Port LICM to the new pass manager. Reviewers: davidxl, silvas Subscribers: krasin, vitalybuka, silvas, davide, sanjoy, llvm-commits, mehdi_amini Differential Revision: http://reviews.llvm.org/D21772 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@275222 91177308-0d34-0410-b5e6-96231b3b80d8 Dehao Chen 3 years ago
29 changed file(s) with 178 addition(s) and 72 deletion(s). Raw diff Collapse all Expand all
158158 void initializeIntervalPartitionPass(PassRegistry&);
159159 void initializeJumpThreadingPass(PassRegistry&);
160160 void initializeLCSSAWrapperPassPass(PassRegistry &);
161 void initializeLICMPass(PassRegistry&);
161 void initializeLegacyLICMPassPass(PassRegistry&);
162162 void initializeLazyValueInfoWrapperPassPass(PassRegistry&);
163163 void initializeLintPass(PassRegistry&);
164164 void initializeLiveDebugValuesPass(PassRegistry&);
0 //===- 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 initializeLICMPass(R);
124 initializeLegacyLICMPassPass(R);
125125 initializeMergedLoadStoreMotionLegacyPassPass(R);
126126 initializeGVNLegacyPassPass(R);
127127 initializeMemCpyOptLegacyPassPass(R);
2929 //
3030 //===----------------------------------------------------------------------===//
3131
32 #include "llvm/Transforms/Scalar/LICM.h"
3233 #include "llvm/ADT/Statistic.h"
3334 #include "llvm/Analysis/AliasAnalysis.h"
3435 #include "llvm/Analysis/AliasSetTracker.h"
3940 #include "llvm/Analysis/Loads.h"
4041 #include "llvm/Analysis/LoopInfo.h"
4142 #include "llvm/Analysis/LoopPass.h"
43 #include "llvm/Analysis/LoopPassManager.h"
4244 #include "llvm/Analysis/MemoryBuiltins.h"
4345 #include "llvm/Analysis/ScalarEvolution.h"
4446 #include "llvm/Analysis/ScalarEvolutionAliasAnalysis.h"
103105 LoopSafetyInfo *SafetyInfo);
104106
105107 namespace {
106 struct LICM : public LoopPass {
108 struct LoopInvariantCodeMotion {
109 bool runOnLoop(Loop *L, AliasAnalysis *AA, LoopInfo *LI, DominatorTree *DT,
110 TargetLibraryInfo *TLI, ScalarEvolution *SE, bool DeleteAST);
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 {
107124 static char ID; // Pass identification, replacement for typeid
108 LICM() : LoopPass(ID) {
109 initializeLICMPass(*PassRegistry::getPassRegistry());
110 }
111
112 bool runOnLoop(Loop *L, LPPassManager &LPM) override;
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, false);
140 }
113141
114142 /// This transformation requires natural loop information & requires that
115143 /// loop preheaders be inserted into the CFG...
123151 using llvm::Pass::doFinalization;
124152
125153 bool doFinalization() override {
126 assert(LoopToAliasSetMap.empty() && "Didn't free loop alias sets");
154 assert(LICM.getLoopToAliasSetMap().empty() &&
155 "Didn't free loop alias sets");
127156 return false;
128157 }
129158
130159 private:
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;
160 LoopInvariantCodeMotion LICM;
143161
144162 /// cloneBasicBlockAnalysis - Simple Analysis hook. Clone alias set info.
145163 void cloneBasicBlockAnalysis(BasicBlock *From, BasicBlock *To,
151169
152170 /// Simple Analysis hook. Delete loop L from alias set map.
153171 void deleteAnalysisLoop(Loop *L) override;
154
155 AliasSetTracker *collectAliasInfoForLoop(Loop *L);
156172 };
157173 }
158174
159 char LICM::ID = 0;
160 INITIALIZE_PASS_BEGIN(LICM, "licm", "Loop Invariant Code Motion", false, false)
175 PreservedAnalyses LICMPass::run(Loop &L, AnalysisManager &AM) {
176 const auto &FAM =
177 AM.getResult(L).getManager();
178 Function *F = L.getHeader()->getParent();
179
180 auto *AA = FAM.getCachedResult(*F);
181 auto *LI = FAM.getCachedResult(*F);
182 auto *DT = FAM.getCachedResult(*F);
183 auto *TLI = FAM.getCachedResult(*F);
184 auto *SE = FAM.getCachedResult(*F);
185 assert((AA && LI && DT && TLI && SE) && "Analyses for LICM not available");
186
187 LoopInvariantCodeMotion LICM;
188
189 if (!LICM.runOnLoop(&L, AA, LI, DT, TLI, SE, true))
190 return PreservedAnalyses::all();
191
192 // FIXME: There is no setPreservesCFG in the new PM. When that becomes
193 // available, it should be used here.
194 return getLoopPassPreservedAnalyses();
195 }
196
197 char LegacyLICMPass::ID = 0;
198 INITIALIZE_PASS_BEGIN(LegacyLICMPass, "licm", "Loop Invariant Code Motion",
199 false, false)
161200 INITIALIZE_PASS_DEPENDENCY(LoopPass)
162201 INITIALIZE_PASS_DEPENDENCY(TargetLibraryInfoWrapperPass)
163 INITIALIZE_PASS_END(LICM, "licm", "Loop Invariant Code Motion", false, false)
164
165 Pass *llvm::createLICMPass() { return new LICM(); }
202 INITIALIZE_PASS_END(LegacyLICMPass, "licm", "Loop Invariant Code Motion", false,
203 false)
204
205 Pass *llvm::createLICMPass() { return new LegacyLICMPass(); }
166206
167207 /// Hoist expressions out of the specified loop. Note, alias info for inner
168208 /// loop is not preserved so it is not a good idea to run LICM multiple
169209 /// times on one loop.
170 ///
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();
210 /// We should delete AST for inner loops in the new pass manager to avoid
211 /// memory leak.
212 ///
213 bool LoopInvariantCodeMotion::runOnLoop(Loop *L, AliasAnalysis *AA,
214 LoopInfo *LI, DominatorTree *DT,
215 TargetLibraryInfo *TLI,
216 ScalarEvolution *SE, bool DeleteAST) {
217 bool Changed = false;
183218
184219 assert(L->isLCSSAForm(*DT) && "Loop is not in LCSSA form.");
185220
186 CurAST = collectAliasInfoForLoop(L);
187
188 CurLoop = L;
221 AliasSetTracker *CurAST = collectAliasInfoForLoop(L, LI, AA);
189222
190223 // Get the preheader block to move instructions into...
191 Preheader = L->getLoopPreheader();
224 BasicBlock *Preheader = L->getLoopPreheader();
192225
193226 // Compute loop safety information.
194227 LoopSafetyInfo SafetyInfo;
195 computeLoopSafetyInfo(&SafetyInfo, CurLoop);
228 computeLoopSafetyInfo(&SafetyInfo, L);
196229
197230 // We want to visit all of the instructions in this loop... that are not parts
198231 // of our subloops (they have already had their invariants hoisted out of
205238 // instructions, we perform another pass to hoist them out of the loop.
206239 //
207240 if (L->hasDedicatedExits())
208 Changed |= sinkRegion(DT->getNode(L->getHeader()), AA, LI, DT, TLI, CurLoop,
241 Changed |= sinkRegion(DT->getNode(L->getHeader()), AA, LI, DT, TLI, L,
209242 CurAST, &SafetyInfo);
210243 if (Preheader)
211 Changed |= hoistRegion(DT->getNode(L->getHeader()), AA, LI, DT, TLI,
212 CurLoop, CurAST, &SafetyInfo);
244 Changed |= hoistRegion(DT->getNode(L->getHeader()), AA, LI, DT, TLI, L,
245 CurAST, &SafetyInfo);
213246
214247 // Now that all loop invariants have been removed from the loop, promote any
215248 // memory references to scalars that we can.
220253
221254 // Loop over all of the alias sets in the tracker object.
222255 for (AliasSet &AS : *CurAST)
223 Changed |=
224 promoteLoopAccessesToScalars(AS, ExitBlocks, InsertPts, PIC, LI, DT,
225 TLI, CurLoop, CurAST, &SafetyInfo);
256 Changed |= promoteLoopAccessesToScalars(
257 AS, ExitBlocks, InsertPts, PIC, LI, DT, TLI, L, CurAST, &SafetyInfo);
226258
227259 // Once we have promoted values across the loop body we have to recursively
228260 // reform LCSSA as any nested loop may now have values defined within the
231263 // SSAUpdater strategy during promotion that was LCSSA aware and reformed
232264 // it as it went.
233265 if (Changed) {
234 auto *SEWP = getAnalysisIfAvailable();
235 formLCSSARecursively(*L, *DT, LI, SEWP ? &SEWP->getSE() : nullptr);
266 formLCSSARecursively(*L, *DT, LI, SE);
236267 }
237268 }
238269
243274 assert((!L->getParentLoop() || L->getParentLoop()->isLCSSAForm(*DT)) &&
244275 "Parent loop not left in LCSSA form after LICM!");
245276
246 // Clear out loops state information for the next iteration
247 CurLoop = nullptr;
248 Preheader = nullptr;
249
250277 // If this loop is nested inside of another one, save the alias information
251278 // for when we process the outer loop.
252 if (L->getParentLoop())
279 if (L->getParentLoop() && !DeleteAST)
253280 LoopToAliasSetMap[L] = CurAST;
254281 else
255282 delete CurAST;
256283
257 if (Changed)
258 if (auto *SEWP = getAnalysisIfAvailable())
259 SEWP->getSE().forgetLoopDispositions(L);
284 if (Changed && SE)
285 SE->forgetLoopDispositions(L);
260286 return Changed;
261287 }
262288
386412 // Iterate over header and compute safety info.
387413 for (BasicBlock::iterator I = Header->begin(), E = Header->end();
388414 (I != E) && !SafetyInfo->HeaderMayThrow; ++I)
389 SafetyInfo->HeaderMayThrow |= !isGuaranteedToTransferExecutionToSuccessor(&*I);
415 SafetyInfo->HeaderMayThrow |=
416 !isGuaranteedToTransferExecutionToSuccessor(&*I);
390417
391418 SafetyInfo->MayThrow = SafetyInfo->HeaderMayThrow;
392419 // Iterate over loop instructions and compute safety info.
10411068
10421069 /// Returns an owning pointer to an alias set which incorporates aliasing info
10431070 /// from L and all subloops of L.
1044 AliasSetTracker *LICM::collectAliasInfoForLoop(Loop *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) {
10451078 AliasSetTracker *CurAST = nullptr;
10461079 SmallVector RecomputeLoops;
10471080 for (Loop *InnerL : L->getSubLoops()) {
10911124
10921125 /// Simple analysis hook. Clone alias set info.
10931126 ///
1094 void LICM::cloneBasicBlockAnalysis(BasicBlock *From, BasicBlock *To, Loop *L) {
1095 AliasSetTracker *AST = LoopToAliasSetMap.lookup(L);
1127 void LegacyLICMPass::cloneBasicBlockAnalysis(BasicBlock *From, BasicBlock *To,
1128 Loop *L) {
1129 AliasSetTracker *AST = LICM.getLoopToAliasSetMap().lookup(L);
10961130 if (!AST)
10971131 return;
10981132
11011135
11021136 /// Simple Analysis hook. Delete value V from alias set
11031137 ///
1104 void LICM::deleteAnalysisValue(Value *V, Loop *L) {
1105 AliasSetTracker *AST = LoopToAliasSetMap.lookup(L);
1138 void LegacyLICMPass::deleteAnalysisValue(Value *V, Loop *L) {
1139 AliasSetTracker *AST = LICM.getLoopToAliasSetMap().lookup(L);
11061140 if (!AST)
11071141 return;
11081142
11111145
11121146 /// Simple Analysis hook. Delete value L from alias set map.
11131147 ///
1114 void LICM::deleteAnalysisLoop(Loop *L) {
1115 AliasSetTracker *AST = LoopToAliasSetMap.lookup(L);
1148 void LegacyLICMPass::deleteAnalysisLoop(Loop *L) {
1149 AliasSetTracker *AST = LICM.getLoopToAliasSetMap().lookup(L);
11161150 if (!AST)
11171151 return;
11181152
11191153 delete AST;
1120 LoopToAliasSetMap.erase(L);
1154 LICM.getLoopToAliasSetMap().erase(L);
11211155 }
11221156
11231157 /// Return true if the body of this loop may store into the memory
4747 initializeInductiveRangeCheckEliminationPass(Registry);
4848 initializeIndVarSimplifyLegacyPassPass(Registry);
4949 initializeJumpThreadingPass(Registry);
50 initializeLICMPass(Registry);
50 initializeLegacyLICMPassPass(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
12 declare i32 @foo() readonly argmemonly nounwind
23 declare i32 @foo2() readonly nounwind
34 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
12
23 define void @f_0(i1 %p) nounwind ssp {
34 ; 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
12
23 ; Check that we can hoist unordered loads
34 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
12
23 define void @testfunc(i32 %i) {
34 ;
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
12 ; This fixes PR22460
23
34 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
12
23 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"
34 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
12
23 define void @dgefa() nounwind ssp {
34 entry:
0 ; RUN: opt < %s -licm -S | FileCheck %s
1 ; RUN: opt -passes='require,require,require,loop(licm)' < %s -S | FileCheck %s
12 ; PR19835
23 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
34 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
12
23 target datalayout = "e-m:x-p:32:32-i64:64-f80:32-n8:16:32-a:0:32-S32"
34 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
12 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
23 target triple = "x86_64-unknown-linux-gnu"
34
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
12 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
23 target triple = "x86_64-unknown-linux-gnu"
34
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
12 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
23 target triple = "x86_64-unknown-linux-gnu"
34
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
12
23 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"
34
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
12
23 @X = global i32 0 ; [#uses=1]
34
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
12 ;
23 ; Manually validate LCSSA form is preserved even after SSAUpdater is used to
34 ; 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
23
34 define void @testfunc(i32 %i.s, i1 %ifcond) {
45 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
12
23 declare void @use_nothrow(i64 %a) nounwind
34 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
12
23 ; LICM should keep the stores in their original order when it sinks/promotes them.
34 ; 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
12
23 ; If we can prove a local is thread local, we can insert stores during
34 ; 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
12
23 ; Make sure we don't hoist a conditionally-executed store out of the loop;
34 ; 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
12
23 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
34 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
12 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"
23
34 @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
12
23 ; UDiv is safe to speculate if the denominator is known non-zero.
34
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
12 ; The objects *p and *q are aliased to each other, but even though *q is
23 ; volatile, *p can be considered invariant in the loop. Check if it is moved
34 ; out of the loop.