Some of the LoopInfo APIs are preceeded by this comment:
// Note that all of these methods can fail on general loops (ie, there may
// be a preheader, etc). For best success, the loop simplification and
// induction variable canonicalization pass should be used to normalize
// for easy analysis. These methods assume canonical loops.
What Pass would that be? IndVarSimplify?