1 //===----------- LoopVersioningLICM.cpp - LICM Loop Versioning ------------===// 2 // 3 // The LLVM Compiler Infrastructure 4 // 5 // This file is distributed under the University of Illinois Open Source 6 // License. See LICENSE.TXT for details. 7 // 8 //===----------------------------------------------------------------------===// 9 // 10 // When alias analysis is uncertain about the aliasing between any two accesses, 11 // it will return MayAlias. This uncertainty from alias analysis restricts LICM 12 // from proceeding further. In cases where alias analysis is uncertain we might 13 // use loop versioning as an alternative. 14 // 15 // Loop Versioning will create a version of the loop with aggressive aliasing 16 // assumptions in addition to the original with conservative (default) aliasing 17 // assumptions. The version of the loop making aggressive aliasing assumptions 18 // will have all the memory accesses marked as no-alias. These two versions of 19 // loop will be preceded by a memory runtime check. This runtime check consists 20 // of bound checks for all unique memory accessed in loop, and it ensures the 21 // lack of memory aliasing. The result of the runtime check determines which of 22 // the loop versions is executed: If the runtime check detects any memory 23 // aliasing, then the original loop is executed. Otherwise, the version with 24 // aggressive aliasing assumptions is used. 25 // 26 // Following are the top level steps: 27 // 28 // a) Perform LoopVersioningLICM's feasibility check. 29 // b) If loop is a candidate for versioning then create a memory bound check, 30 // by considering all the memory accesses in loop body. 31 // c) Clone original loop and set all memory accesses as no-alias in new loop. 32 // d) Set original loop & versioned loop as a branch target of the runtime check 33 // result. 34 // 35 // It transforms loop as shown below: 36 // 37 // +----------------+ 38 // |Runtime Memcheck| 39 // +----------------+ 40 // | 41 // +----------+----------------+----------+ 42 // | | 43 // +---------+----------+ +-----------+----------+ 44 // |Orig Loop Preheader | |Cloned Loop Preheader | 45 // +--------------------+ +----------------------+ 46 // | | 47 // +--------------------+ +----------------------+ 48 // |Orig Loop Body | |Cloned Loop Body | 49 // +--------------------+ +----------------------+ 50 // | | 51 // +--------------------+ +----------------------+ 52 // |Orig Loop Exit Block| |Cloned Loop Exit Block| 53 // +--------------------+ +-----------+----------+ 54 // | | 55 // +----------+--------------+-----------+ 56 // | 57 // +-----+----+ 58 // |Join Block| 59 // +----------+ 60 // 61 //===----------------------------------------------------------------------===// 62 63 #include "llvm/ADT/MapVector.h" 64 #include "llvm/ADT/SmallPtrSet.h" 65 #include "llvm/ADT/Statistic.h" 66 #include "llvm/ADT/StringExtras.h" 67 #include "llvm/Analysis/AliasAnalysis.h" 68 #include "llvm/Analysis/AliasSetTracker.h" 69 #include "llvm/Analysis/ConstantFolding.h" 70 #include "llvm/Analysis/GlobalsModRef.h" 71 #include "llvm/Analysis/LoopAccessAnalysis.h" 72 #include "llvm/Analysis/LoopInfo.h" 73 #include "llvm/Analysis/LoopPass.h" 74 #include "llvm/Analysis/ScalarEvolution.h" 75 #include "llvm/Analysis/ScalarEvolutionExpander.h" 76 #include "llvm/Analysis/TargetLibraryInfo.h" 77 #include "llvm/Analysis/ValueTracking.h" 78 #include "llvm/Analysis/VectorUtils.h" 79 #include "llvm/IR/Dominators.h" 80 #include "llvm/IR/IntrinsicInst.h" 81 #include "llvm/IR/MDBuilder.h" 82 #include "llvm/IR/PatternMatch.h" 83 #include "llvm/IR/PredIteratorCache.h" 84 #include "llvm/IR/Type.h" 85 #include "llvm/Support/Debug.h" 86 #include "llvm/Support/raw_ostream.h" 87 #include "llvm/Transforms/Scalar.h" 88 #include "llvm/Transforms/Utils/BasicBlockUtils.h" 89 #include "llvm/Transforms/Utils/Cloning.h" 90 #include "llvm/Transforms/Utils/LoopUtils.h" 91 #include "llvm/Transforms/Utils/LoopVersioning.h" 92 #include "llvm/Transforms/Utils/ValueMapper.h" 93 94 #define DEBUG_TYPE "loop-versioning-licm" 95 static const char *LICMVersioningMetaData = "llvm.loop.licm_versioning.disable"; 96 97 using namespace llvm; 98 99 /// Threshold minimum allowed percentage for possible 100 /// invariant instructions in a loop. 101 static cl::opt<float> 102 LVInvarThreshold("licm-versioning-invariant-threshold", 103 cl::desc("LoopVersioningLICM's minimum allowed percentage" 104 "of possible invariant instructions per loop"), 105 cl::init(25), cl::Hidden); 106 107 /// Threshold for maximum allowed loop nest/depth 108 static cl::opt<unsigned> LVLoopDepthThreshold( 109 "licm-versioning-max-depth-threshold", 110 cl::desc( 111 "LoopVersioningLICM's threshold for maximum allowed loop nest/depth"), 112 cl::init(2), cl::Hidden); 113 114 /// \brief Create MDNode for input string. 115 static MDNode *createStringMetadata(Loop *TheLoop, StringRef Name, unsigned V) { 116 LLVMContext &Context = TheLoop->getHeader()->getContext(); 117 Metadata *MDs[] = { 118 MDString::get(Context, Name), 119 ConstantAsMetadata::get(ConstantInt::get(Type::getInt32Ty(Context), V))}; 120 return MDNode::get(Context, MDs); 121 } 122 123 /// \brief Set input string into loop metadata by keeping other values intact. 124 void llvm::addStringMetadataToLoop(Loop *TheLoop, const char *MDString, 125 unsigned V) { 126 SmallVector<Metadata *, 4> MDs(1); 127 // If the loop already has metadata, retain it. 128 MDNode *LoopID = TheLoop->getLoopID(); 129 if (LoopID) { 130 for (unsigned i = 1, ie = LoopID->getNumOperands(); i < ie; ++i) { 131 MDNode *Node = cast<MDNode>(LoopID->getOperand(i)); 132 MDs.push_back(Node); 133 } 134 } 135 // Add new metadata. 136 MDs.push_back(createStringMetadata(TheLoop, MDString, V)); 137 // Replace current metadata node with new one. 138 LLVMContext &Context = TheLoop->getHeader()->getContext(); 139 MDNode *NewLoopID = MDNode::get(Context, MDs); 140 // Set operand 0 to refer to the loop id itself. 141 NewLoopID->replaceOperandWith(0, NewLoopID); 142 TheLoop->setLoopID(NewLoopID); 143 } 144 145 namespace { 146 struct LoopVersioningLICM : public LoopPass { 147 static char ID; 148 149 bool runOnLoop(Loop *L, LPPassManager &LPM) override; 150 151 void getAnalysisUsage(AnalysisUsage &AU) const override { 152 AU.setPreservesCFG(); 153 AU.addRequired<AAResultsWrapperPass>(); 154 AU.addRequired<DominatorTreeWrapperPass>(); 155 AU.addRequiredID(LCSSAID); 156 AU.addRequired<LoopAccessLegacyAnalysis>(); 157 AU.addRequired<LoopInfoWrapperPass>(); 158 AU.addRequiredID(LoopSimplifyID); 159 AU.addRequired<ScalarEvolutionWrapperPass>(); 160 AU.addPreserved<AAResultsWrapperPass>(); 161 AU.addPreserved<GlobalsAAWrapperPass>(); 162 } 163 164 LoopVersioningLICM() 165 : LoopPass(ID), AA(nullptr), SE(nullptr), LAA(nullptr), LAI(nullptr), 166 CurLoop(nullptr), LoopDepthThreshold(LVLoopDepthThreshold), 167 InvariantThreshold(LVInvarThreshold), LoadAndStoreCounter(0), 168 InvariantCounter(0), IsReadOnlyLoop(true) { 169 initializeLoopVersioningLICMPass(*PassRegistry::getPassRegistry()); 170 } 171 StringRef getPassName() const override { return "Loop Versioning for LICM"; } 172 173 void reset() { 174 AA = nullptr; 175 SE = nullptr; 176 LAA = nullptr; 177 CurLoop = nullptr; 178 LoadAndStoreCounter = 0; 179 InvariantCounter = 0; 180 IsReadOnlyLoop = true; 181 CurAST.reset(); 182 } 183 184 class AutoResetter { 185 public: 186 AutoResetter(LoopVersioningLICM &LVLICM) : LVLICM(LVLICM) {} 187 ~AutoResetter() { LVLICM.reset(); } 188 189 private: 190 LoopVersioningLICM &LVLICM; 191 }; 192 193 private: 194 AliasAnalysis *AA; // Current AliasAnalysis information 195 ScalarEvolution *SE; // Current ScalarEvolution 196 LoopAccessLegacyAnalysis *LAA; // Current LoopAccessAnalysis 197 const LoopAccessInfo *LAI; // Current Loop's LoopAccessInfo 198 199 Loop *CurLoop; // The current loop we are working on. 200 std::unique_ptr<AliasSetTracker> 201 CurAST; // AliasSet information for the current loop. 202 203 unsigned LoopDepthThreshold; // Maximum loop nest threshold 204 float InvariantThreshold; // Minimum invariant threshold 205 unsigned LoadAndStoreCounter; // Counter to track num of load & store 206 unsigned InvariantCounter; // Counter to track num of invariant 207 bool IsReadOnlyLoop; // Read only loop marker. 208 209 bool isLegalForVersioning(); 210 bool legalLoopStructure(); 211 bool legalLoopInstructions(); 212 bool legalLoopMemoryAccesses(); 213 bool isLoopAlreadyVisited(); 214 void setNoAliasToLoop(Loop *); 215 bool instructionSafeForVersioning(Instruction *); 216 }; 217 } 218 219 /// \brief Check loop structure and confirms it's good for LoopVersioningLICM. 220 bool LoopVersioningLICM::legalLoopStructure() { 221 // Loop must have a preheader, if not return false. 222 if (!CurLoop->getLoopPreheader()) { 223 DEBUG(dbgs() << " loop preheader is missing\n"); 224 return false; 225 } 226 // Loop should be innermost loop, if not return false. 227 if (CurLoop->getSubLoops().size()) { 228 DEBUG(dbgs() << " loop is not innermost\n"); 229 return false; 230 } 231 // Loop should have a single backedge, if not return false. 232 if (CurLoop->getNumBackEdges() != 1) { 233 DEBUG(dbgs() << " loop has multiple backedges\n"); 234 return false; 235 } 236 // Loop must have a single exiting block, if not return false. 237 if (!CurLoop->getExitingBlock()) { 238 DEBUG(dbgs() << " loop has multiple exiting block\n"); 239 return false; 240 } 241 // We only handle bottom-tested loop, i.e. loop in which the condition is 242 // checked at the end of each iteration. With that we can assume that all 243 // instructions in the loop are executed the same number of times. 244 if (CurLoop->getExitingBlock() != CurLoop->getLoopLatch()) { 245 DEBUG(dbgs() << " loop is not bottom tested\n"); 246 return false; 247 } 248 // Parallel loops must not have aliasing loop-invariant memory accesses. 249 // Hence we don't need to version anything in this case. 250 if (CurLoop->isAnnotatedParallel()) { 251 DEBUG(dbgs() << " Parallel loop is not worth versioning\n"); 252 return false; 253 } 254 // Loop depth more then LoopDepthThreshold are not allowed 255 if (CurLoop->getLoopDepth() > LoopDepthThreshold) { 256 DEBUG(dbgs() << " loop depth is more then threshold\n"); 257 return false; 258 } 259 // Loop should have a dedicated exit block, if not return false. 260 if (!CurLoop->hasDedicatedExits()) { 261 DEBUG(dbgs() << " loop does not has dedicated exit blocks\n"); 262 return false; 263 } 264 // We need to be able to compute the loop trip count in order 265 // to generate the bound checks. 266 const SCEV *ExitCount = SE->getBackedgeTakenCount(CurLoop); 267 if (ExitCount == SE->getCouldNotCompute()) { 268 DEBUG(dbgs() << " loop does not has trip count\n"); 269 return false; 270 } 271 return true; 272 } 273 274 /// \brief Check memory accesses in loop and confirms it's good for 275 /// LoopVersioningLICM. 276 bool LoopVersioningLICM::legalLoopMemoryAccesses() { 277 bool HasMayAlias = false; 278 bool TypeSafety = false; 279 bool HasMod = false; 280 // Memory check: 281 // Transform phase will generate a versioned loop and also a runtime check to 282 // ensure the pointers are independent and they don’t alias. 283 // In version variant of loop, alias meta data asserts that all access are 284 // mutually independent. 285 // 286 // Pointers aliasing in alias domain are avoided because with multiple 287 // aliasing domains we may not be able to hoist potential loop invariant 288 // access out of the loop. 289 // 290 // Iterate over alias tracker sets, and confirm AliasSets doesn't have any 291 // must alias set. 292 for (const auto &I : *CurAST) { 293 const AliasSet &AS = I; 294 // Skip Forward Alias Sets, as this should be ignored as part of 295 // the AliasSetTracker object. 296 if (AS.isForwardingAliasSet()) 297 continue; 298 // With MustAlias its not worth adding runtime bound check. 299 if (AS.isMustAlias()) 300 return false; 301 Value *SomePtr = AS.begin()->getValue(); 302 bool TypeCheck = true; 303 // Check for Mod & MayAlias 304 HasMayAlias |= AS.isMayAlias(); 305 HasMod |= AS.isMod(); 306 for (const auto &A : AS) { 307 Value *Ptr = A.getValue(); 308 // Alias tracker should have pointers of same data type. 309 TypeCheck = (TypeCheck && (SomePtr->getType() == Ptr->getType())); 310 } 311 // At least one alias tracker should have pointers of same data type. 312 TypeSafety |= TypeCheck; 313 } 314 // Ensure types should be of same type. 315 if (!TypeSafety) { 316 DEBUG(dbgs() << " Alias tracker type safety failed!\n"); 317 return false; 318 } 319 // Ensure loop body shouldn't be read only. 320 if (!HasMod) { 321 DEBUG(dbgs() << " No memory modified in loop body\n"); 322 return false; 323 } 324 // Make sure alias set has may alias case. 325 // If there no alias memory ambiguity, return false. 326 if (!HasMayAlias) { 327 DEBUG(dbgs() << " No ambiguity in memory access.\n"); 328 return false; 329 } 330 return true; 331 } 332 333 /// \brief Check loop instructions safe for Loop versioning. 334 /// It returns true if it's safe else returns false. 335 /// Consider following: 336 /// 1) Check all load store in loop body are non atomic & non volatile. 337 /// 2) Check function call safety, by ensuring its not accessing memory. 338 /// 3) Loop body shouldn't have any may throw instruction. 339 bool LoopVersioningLICM::instructionSafeForVersioning(Instruction *I) { 340 assert(I != nullptr && "Null instruction found!"); 341 // Check function call safety 342 if (isa<CallInst>(I) && !AA->doesNotAccessMemory(CallSite(I))) { 343 DEBUG(dbgs() << " Unsafe call site found.\n"); 344 return false; 345 } 346 // Avoid loops with possiblity of throw 347 if (I->mayThrow()) { 348 DEBUG(dbgs() << " May throw instruction found in loop body\n"); 349 return false; 350 } 351 // If current instruction is load instructions 352 // make sure it's a simple load (non atomic & non volatile) 353 if (I->mayReadFromMemory()) { 354 LoadInst *Ld = dyn_cast<LoadInst>(I); 355 if (!Ld || !Ld->isSimple()) { 356 DEBUG(dbgs() << " Found a non-simple load.\n"); 357 return false; 358 } 359 LoadAndStoreCounter++; 360 Value *Ptr = Ld->getPointerOperand(); 361 // Check loop invariant. 362 if (SE->isLoopInvariant(SE->getSCEV(Ptr), CurLoop)) 363 InvariantCounter++; 364 } 365 // If current instruction is store instruction 366 // make sure it's a simple store (non atomic & non volatile) 367 else if (I->mayWriteToMemory()) { 368 StoreInst *St = dyn_cast<StoreInst>(I); 369 if (!St || !St->isSimple()) { 370 DEBUG(dbgs() << " Found a non-simple store.\n"); 371 return false; 372 } 373 LoadAndStoreCounter++; 374 Value *Ptr = St->getPointerOperand(); 375 // Check loop invariant. 376 if (SE->isLoopInvariant(SE->getSCEV(Ptr), CurLoop)) 377 InvariantCounter++; 378 379 IsReadOnlyLoop = false; 380 } 381 return true; 382 } 383 384 /// \brief Check loop instructions and confirms it's good for 385 /// LoopVersioningLICM. 386 bool LoopVersioningLICM::legalLoopInstructions() { 387 // Resetting counters. 388 LoadAndStoreCounter = 0; 389 InvariantCounter = 0; 390 IsReadOnlyLoop = true; 391 // Iterate over loop blocks and instructions of each block and check 392 // instruction safety. 393 for (auto *Block : CurLoop->getBlocks()) 394 for (auto &Inst : *Block) { 395 // If instruction is unsafe just return false. 396 if (!instructionSafeForVersioning(&Inst)) 397 return false; 398 } 399 // Get LoopAccessInfo from current loop. 400 LAI = &LAA->getInfo(CurLoop); 401 // Check LoopAccessInfo for need of runtime check. 402 if (LAI->getRuntimePointerChecking()->getChecks().empty()) { 403 DEBUG(dbgs() << " LAA: Runtime check not found !!\n"); 404 return false; 405 } 406 // Number of runtime-checks should be less then RuntimeMemoryCheckThreshold 407 if (LAI->getNumRuntimePointerChecks() > 408 VectorizerParams::RuntimeMemoryCheckThreshold) { 409 DEBUG(dbgs() << " LAA: Runtime checks are more than threshold !!\n"); 410 return false; 411 } 412 // Loop should have at least one invariant load or store instruction. 413 if (!InvariantCounter) { 414 DEBUG(dbgs() << " Invariant not found !!\n"); 415 return false; 416 } 417 // Read only loop not allowed. 418 if (IsReadOnlyLoop) { 419 DEBUG(dbgs() << " Found a read-only loop!\n"); 420 return false; 421 } 422 // Profitablity check: 423 // Check invariant threshold, should be in limit. 424 if (InvariantCounter * 100 < InvariantThreshold * LoadAndStoreCounter) { 425 DEBUG(dbgs() 426 << " Invariant load & store are less then defined threshold\n"); 427 DEBUG(dbgs() << " Invariant loads & stores: " 428 << ((InvariantCounter * 100) / LoadAndStoreCounter) << "%\n"); 429 DEBUG(dbgs() << " Invariant loads & store threshold: " 430 << InvariantThreshold << "%\n"); 431 return false; 432 } 433 return true; 434 } 435 436 /// \brief It checks loop is already visited or not. 437 /// check loop meta data, if loop revisited return true 438 /// else false. 439 bool LoopVersioningLICM::isLoopAlreadyVisited() { 440 // Check LoopVersioningLICM metadata into loop 441 if (findStringMetadataForLoop(CurLoop, LICMVersioningMetaData)) { 442 return true; 443 } 444 return false; 445 } 446 447 /// \brief Checks legality for LoopVersioningLICM by considering following: 448 /// a) loop structure legality b) loop instruction legality 449 /// c) loop memory access legality. 450 /// Return true if legal else returns false. 451 bool LoopVersioningLICM::isLegalForVersioning() { 452 DEBUG(dbgs() << "Loop: " << *CurLoop); 453 // Make sure not re-visiting same loop again. 454 if (isLoopAlreadyVisited()) { 455 DEBUG( 456 dbgs() << " Revisiting loop in LoopVersioningLICM not allowed.\n\n"); 457 return false; 458 } 459 // Check loop structure leagality. 460 if (!legalLoopStructure()) { 461 DEBUG( 462 dbgs() << " Loop structure not suitable for LoopVersioningLICM\n\n"); 463 return false; 464 } 465 // Check loop instruction leagality. 466 if (!legalLoopInstructions()) { 467 DEBUG(dbgs() 468 << " Loop instructions not suitable for LoopVersioningLICM\n\n"); 469 return false; 470 } 471 // Check loop memory access leagality. 472 if (!legalLoopMemoryAccesses()) { 473 DEBUG(dbgs() 474 << " Loop memory access not suitable for LoopVersioningLICM\n\n"); 475 return false; 476 } 477 // Loop versioning is feasible, return true. 478 DEBUG(dbgs() << " Loop Versioning found to be beneficial\n\n"); 479 return true; 480 } 481 482 /// \brief Update loop with aggressive aliasing assumptions. 483 /// It marks no-alias to any pairs of memory operations by assuming 484 /// loop should not have any must-alias memory accesses pairs. 485 /// During LoopVersioningLICM legality we ignore loops having must 486 /// aliasing memory accesses. 487 void LoopVersioningLICM::setNoAliasToLoop(Loop *VerLoop) { 488 // Get latch terminator instruction. 489 Instruction *I = VerLoop->getLoopLatch()->getTerminator(); 490 // Create alias scope domain. 491 MDBuilder MDB(I->getContext()); 492 MDNode *NewDomain = MDB.createAnonymousAliasScopeDomain("LVDomain"); 493 StringRef Name = "LVAliasScope"; 494 SmallVector<Metadata *, 4> Scopes, NoAliases; 495 MDNode *NewScope = MDB.createAnonymousAliasScope(NewDomain, Name); 496 // Iterate over each instruction of loop. 497 // set no-alias for all load & store instructions. 498 for (auto *Block : CurLoop->getBlocks()) { 499 for (auto &Inst : *Block) { 500 // Only interested in instruction that may modify or read memory. 501 if (!Inst.mayReadFromMemory() && !Inst.mayWriteToMemory()) 502 continue; 503 Scopes.push_back(NewScope); 504 NoAliases.push_back(NewScope); 505 // Set no-alias for current instruction. 506 Inst.setMetadata( 507 LLVMContext::MD_noalias, 508 MDNode::concatenate(Inst.getMetadata(LLVMContext::MD_noalias), 509 MDNode::get(Inst.getContext(), NoAliases))); 510 // set alias-scope for current instruction. 511 Inst.setMetadata( 512 LLVMContext::MD_alias_scope, 513 MDNode::concatenate(Inst.getMetadata(LLVMContext::MD_alias_scope), 514 MDNode::get(Inst.getContext(), Scopes))); 515 } 516 } 517 } 518 519 bool LoopVersioningLICM::runOnLoop(Loop *L, LPPassManager &LPM) { 520 // This will automatically release all resources hold by the current 521 // LoopVersioningLICM object. 522 AutoResetter Resetter(*this); 523 524 if (skipLoop(L)) 525 return false; 526 // Get Analysis information. 527 AA = &getAnalysis<AAResultsWrapperPass>().getAAResults(); 528 SE = &getAnalysis<ScalarEvolutionWrapperPass>().getSE(); 529 LAA = &getAnalysis<LoopAccessLegacyAnalysis>(); 530 LAI = nullptr; 531 // Set Current Loop 532 CurLoop = L; 533 CurAST.reset(new AliasSetTracker(*AA)); 534 535 // Loop over the body of this loop, construct AST. 536 LoopInfo *LI = &getAnalysis<LoopInfoWrapperPass>().getLoopInfo(); 537 for (auto *Block : L->getBlocks()) { 538 if (LI->getLoopFor(Block) == L) // Ignore blocks in subloop. 539 CurAST->add(*Block); // Incorporate the specified basic block 540 } 541 542 bool Changed = false; 543 544 // Check feasiblity of LoopVersioningLICM. 545 // If versioning found to be feasible and beneficial then proceed 546 // else simply return, by cleaning up memory. 547 if (isLegalForVersioning()) { 548 // Do loop versioning. 549 // Create memcheck for memory accessed inside loop. 550 // Clone original loop, and set blocks properly. 551 DominatorTree *DT = &getAnalysis<DominatorTreeWrapperPass>().getDomTree(); 552 LoopVersioning LVer(*LAI, CurLoop, LI, DT, SE, true); 553 LVer.versionLoop(); 554 // Set Loop Versioning metaData for original loop. 555 addStringMetadataToLoop(LVer.getNonVersionedLoop(), LICMVersioningMetaData); 556 // Set Loop Versioning metaData for version loop. 557 addStringMetadataToLoop(LVer.getVersionedLoop(), LICMVersioningMetaData); 558 // Set "llvm.mem.parallel_loop_access" metaData to versioned loop. 559 addStringMetadataToLoop(LVer.getVersionedLoop(), 560 "llvm.mem.parallel_loop_access"); 561 // Update version loop with aggressive aliasing assumption. 562 setNoAliasToLoop(LVer.getVersionedLoop()); 563 Changed = true; 564 } 565 return Changed; 566 } 567 568 char LoopVersioningLICM::ID = 0; 569 INITIALIZE_PASS_BEGIN(LoopVersioningLICM, "loop-versioning-licm", 570 "Loop Versioning For LICM", false, false) 571 INITIALIZE_PASS_DEPENDENCY(AAResultsWrapperPass) 572 INITIALIZE_PASS_DEPENDENCY(DominatorTreeWrapperPass) 573 INITIALIZE_PASS_DEPENDENCY(GlobalsAAWrapperPass) 574 INITIALIZE_PASS_DEPENDENCY(LCSSAWrapperPass) 575 INITIALIZE_PASS_DEPENDENCY(LoopAccessLegacyAnalysis) 576 INITIALIZE_PASS_DEPENDENCY(LoopInfoWrapperPass) 577 INITIALIZE_PASS_DEPENDENCY(LoopSimplify) 578 INITIALIZE_PASS_DEPENDENCY(ScalarEvolutionWrapperPass) 579 INITIALIZE_PASS_END(LoopVersioningLICM, "loop-versioning-licm", 580 "Loop Versioning For LICM", false, false) 581 582 Pass *llvm::createLoopVersioningLICMPass() { return new LoopVersioningLICM(); } 583