[PATCH] D24171: Refactor LICM to expose canSinkOrHoistInst to LoopSink pass.

Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 1 16:39:45 PDT 2016


This revision was automatically updated to reflect the committed changes.
Closed by commit rL280429: Refactor LICM to expose canSinkOrHoistInst to LoopSink pass. (authored by dehao).

Changed prior to commit:
  https://reviews.llvm.org/D24171?vs=70097&id=70098#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D24171

Files:
  llvm/trunk/include/llvm/Transforms/Utils/LoopUtils.h
  llvm/trunk/lib/Transforms/Scalar/LICM.cpp

Index: llvm/trunk/include/llvm/Transforms/Utils/LoopUtils.h
===================================================================
--- llvm/trunk/include/llvm/Transforms/Utils/LoopUtils.h
+++ llvm/trunk/include/llvm/Transforms/Utils/LoopUtils.h
@@ -21,12 +21,14 @@
 #include "llvm/IR/IRBuilder.h"
 
 namespace llvm {
+class AAResults;
 class AliasSet;
 class AliasSetTracker;
 class AssumptionCache;
 class BasicBlock;
 class DataLayout;
 class DominatorTree;
+class Instruction;
 class Loop;
 class LoopInfo;
 class Pass;
@@ -467,6 +469,12 @@
 /// All loop passes should call this as part of implementing their \c
 /// getAnalysisUsage.
 void getLoopAnalysisUsage(AnalysisUsage &AU);
-}
 
+/// canSinkOrHoistInst - Return true if the hoister and sinker can handle this
+/// instruction. If SafetyInfo is not nullptr, check if the instruction can
+/// execute speculatively.
+bool canSinkOrHoistInst(Instruction &I, AAResults *AA, DominatorTree *DT,
+                        Loop *CurLoop, AliasSetTracker *CurAST,
+                        LoopSafetyInfo *SafetyInfo);
+}
 #endif
Index: llvm/trunk/lib/Transforms/Scalar/LICM.cpp
===================================================================
--- llvm/trunk/lib/Transforms/Scalar/LICM.cpp
+++ llvm/trunk/lib/Transforms/Scalar/LICM.cpp
@@ -100,10 +100,6 @@
 CloneInstructionInExitBlock(Instruction &I, BasicBlock &ExitBlock, PHINode &PN,
                             const LoopInfo *LI,
                             const LoopSafetyInfo *SafetyInfo);
-static bool canSinkOrHoistInst(Instruction &I, AliasAnalysis *AA,
-                               DominatorTree *DT,
-                               Loop *CurLoop, AliasSetTracker *CurAST,
-                               LoopSafetyInfo *SafetyInfo);
 
 namespace {
 struct LoopInvariantCodeMotion {
@@ -439,9 +435,9 @@
 /// canSinkOrHoistInst - Return true if the hoister and sinker can handle this
 /// instruction.
 ///
-bool canSinkOrHoistInst(Instruction &I, AAResults *AA, DominatorTree *DT,
-                        Loop *CurLoop, AliasSetTracker *CurAST,
-                        LoopSafetyInfo *SafetyInfo) {
+bool llvm::canSinkOrHoistInst(Instruction &I, AAResults *AA, DominatorTree *DT,
+                              Loop *CurLoop, AliasSetTracker *CurAST,
+                              LoopSafetyInfo *SafetyInfo) {
   if (!isa<LoadInst>(I) && !isa<CallInst>(I) &&
       !isa<BinaryOperator>(I) && !isa<CastInst>(I) && !isa<SelectInst>(I) &&
       !isa<GetElementPtrInst>(I) && !isa<CmpInst>(I) &&


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D24171.70098.patch
Type: text/x-patch
Size: 2516 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160901/54e2477a/attachment-0001.bin>


More information about the llvm-commits mailing list