Reland #186790 with fix for SCEV. A loop can have more than one latch, in which case getLoopLatch returns null.
Constant::isZeroValue