Skip to content

Commit f514b32

Browse files
committed
[LICM] Add assert of AST/MSSA exclusiveness.
The API `canSinkOrHoistInst` may be called by LoopSink. Add assert to avoid having two analyses passed in.
1 parent 8b37a4e commit f514b32

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

llvm/lib/Transforms/Scalar/LICM.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1106,6 +1106,9 @@ bool llvm::canSinkOrHoistInst(Instruction &I, AAResults *AA, DominatorTree *DT,
11061106
bool TargetExecutesOncePerLoop,
11071107
SinkAndHoistLICMFlags *Flags,
11081108
OptimizationRemarkEmitter *ORE) {
1109+
assert(((CurAST != nullptr) ^ (MSSAU != nullptr)) &&
1110+
"Either AliasSetTracker or MemorySSA should be initialized.");
1111+
11091112
// If we don't understand the instruction, bail early.
11101113
if (!isHoistableAndSinkableInst(I))
11111114
return false;

0 commit comments

Comments
 (0)