[PATCH] D23362: FIx UB in APInt::ashr

David Majnemer via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 10 12:27:32 PDT 2016


majnemer added inline comments.

================
Comment at: lib/Support/APInt.cpp:1047-1048
@@ +1046,4 @@
+      if (unsigned SignBit = APINT_BITS_PER_WORD - BitWidth)
+        return APInt(BitWidth,
+          (((int64_t(VAL) << SignBit) >> SignBit) >> shiftAmt));
+      else
----------------
Isn't this `SignExtend64(Val, BitWidth)` ?


https://reviews.llvm.org/D23362





More information about the llvm-commits mailing list