[PATCH] D37209: [LSR] Fix Shadow IV in case of integer overflow

Evgeny Stupachenko via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 28 09:31:57 PDT 2017


evstupac added a comment.

Hi Max,

I believe, C and C++ standards say that signed integers overflow has undefined behavior.
So in your example we can safely change program behavior in case of overflow.

"If during the evaluation of an expression, the result is not mathematically defined or not in the range of representable values for its type, the behavior is undefined. [...]"
Unsigned case is more complicated.

Thanks,
Evgeny


https://reviews.llvm.org/D37209





More information about the llvm-commits mailing list