[PATCH] D31018: Handle boundry condition missed by r297682

Eli Friedman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 15 17:38:26 PDT 2017


efriedma added a comment.

(Missing context in diff; please generate diffs with "-U1000000".)



================
Comment at: lib/Target/ARM/ARMISelLowering.cpp:9792
       int64_t imm = C->getSExtValue();
-      if (imm < 0) {
+      if (imm < 0 && imm > -(1<<31)) {
         SDLoc DL(N);
----------------
"-(1<<31)" is undefined behavior, strictly speaking.  There are a few different ways you could write it, but the simplest is "INT32_MIN".


================
Comment at: test/CodeGen/Thumb/long.ll:148
+; i32 type represents from -2^31 to 2^31-1. Cannot transform this into
+; add i64 %y, 2147483648 because Thumb addc/subc don't support MVT::i32 type.
+define i64 @f9e(i64 %x, i64 %y) {
----------------
This comment is a bit misleading... we can, and do perform that transform.


Repository:
  rL LLVM

https://reviews.llvm.org/D31018





More information about the llvm-commits mailing list