Preheader instruction's operands will always be invariant w.r.t. the loop which its the preheader
for.
Memory aliases are handled in canSinkOrHoistInst.
 Differential  D28270  
Remove a unnecessary hasLoopInvariantOperands check in loop sink. Authored by trentxintong on Jan 3 2017, 5:26 PM. 
Details Preheader instruction's operands will always be invariant w.r.t. the loop which its the preheader Memory aliases are handled in canSinkOrHoistInst. 
Diff Detail 
 Event Timeline
  | ||||||
Did you consider asserting on hasLoopInvariantOperands instead? That kind of checking tends to make things easier to debug.