[llvm] f514b32 - [LICM] Add assert of AST/MSSA exclusiveness.

Alina Sbirlea via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 2 18:05:09 PST 2020


Author: Alina Sbirlea
Date: 2020-11-02T18:04:43-08:00
New Revision: f514b32a89936880b792f917ea7645d4d635378b

URL: https://github.com/llvm/llvm-project/commit/f514b32a89936880b792f917ea7645d4d635378b
DIFF: https://github.com/llvm/llvm-project/commit/f514b32a89936880b792f917ea7645d4d635378b.diff

LOG: [LICM] Add assert of AST/MSSA exclusiveness.

The API `canSinkOrHoistInst` may be called by LoopSink. Add assert to
avoid having two analyses passed in.

Added: 
    

Modified: 
    llvm/lib/Transforms/Scalar/LICM.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Transforms/Scalar/LICM.cpp b/llvm/lib/Transforms/Scalar/LICM.cpp
index b63544062f39..3c9aa946d607 100644
--- a/llvm/lib/Transforms/Scalar/LICM.cpp
+++ b/llvm/lib/Transforms/Scalar/LICM.cpp
@@ -1106,6 +1106,9 @@ bool llvm::canSinkOrHoistInst(Instruction &I, AAResults *AA, DominatorTree *DT,
                               bool TargetExecutesOncePerLoop,
                               SinkAndHoistLICMFlags *Flags,
                               OptimizationRemarkEmitter *ORE) {
+  assert(((CurAST != nullptr) ^ (MSSAU != nullptr)) &&
+         "Either AliasSetTracker or MemorySSA should be initialized.");
+
   // If we don't understand the instruction, bail early.
   if (!isHoistableAndSinkableInst(I))
     return false;


        


More information about the llvm-commits mailing list