In builds with assertions enabled (!NDEBUG), IndVarSimplify has an additional query to ScalarEvolution which may change future SCEV queries since it fills the internal cache differently. The result is actually only used when -verify-indvars. We fix the issue by only calling SE->getBackedgeTakenCount(L) if -verify-indvars is enabled such that only -verify-indvars shows the behavior, but not debug builds themselves. Also add a remark to the description of -verify-indvars about this behavior.
Fixes llvm.org/PR44815