[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.

Renato Golin via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 22 08:11:19 PDT 2017


rengolin 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;
----------------
Why not just use INT_MIN?


https://reviews.llvm.org/D31242





More information about the llvm-commits mailing list