getAddExpr utility uses computed flags from AddRec plus loop invariants
in AddRec.Start + loop invariants basing on the an assumption that
0th iteration of the loop exists. However the loop might be dead
(runtime or compile time), in this case the propagation of the flag becomes
invalid.
To fix the bug we need to ensure that 0th iteration happens or use less
strict set of flags.
The patch uses the check for dominating all latches from used loops to ensure
that 0th iteration exists.
clang-tidy: warning: 'auto Op' can be declared as 'const auto *Op' [llvm-qualified-auto]
not useful