[PATCH] D31242: [ARM] t2_so_imm_neg had a subtle bug in the conversion, and could trigger UB by negating (int)-2147483648. By pure luck, none of the pre-existing tests triggered this; so I'm adding one.
A. Skrobov via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Mar 22 08:13:24 PDT 2017
tyomitch added inline comments.
================
Comment at: lib/Target/ARM/ARMInstrThumb2.td:115
+ int64_t Value = N->getZExtValue();
+ if (Value == 1LL<<31) return false; // INT_MIN cannot be negated
+ Value = -(int)Value;
----------------
rengolin wrote:
> Why not just use INT_MIN?
`getZExtValue()` would have returned the unsigned value, i.e. `(uint64_t)2147483648`
https://reviews.llvm.org/D31242
More information about the llvm-commits
mailing list