[PATCH] Fix icmp lowering

hfinkel at anl.gov hfinkel at anl.gov
Wed May 20 09:35:27 PDT 2015


LGTM.


REPOSITORY
  rL LLVM

================
Comment at: lib/CodeGen/SelectionDAG/TargetLowering.cpp:1727
@@ -1726,2 +1726,3 @@
         NewC = NewC.lshr(ShiftBits);
-        if (ShiftBits && isLegalICmpImmediate(NewC.getSExtValue())) {
+        if (ShiftBits && NewC.getMinSignedBits() <= 64 &&
+          isLegalICmpImmediate(NewC.getSExtValue())) {
----------------
chfast wrote:
> hfinkel wrote:
> > chfast wrote:
> > > hfinkel wrote:
> > > > Why 64? Shouldn't this depend on the size of the type?
> > > This check is needed to later `NewC.getSExtValue()` be always correct. isLegalICmpImmediate checks the real value.
> > Sure, but why 64?
> > 
> If it less than 64 you can fit the value in int64_t. If not you cannot. It's all about C++ types, not LLVM types.
Okay, thanks. It is that NewC.getSExtValue() gives the int64_t.

http://reviews.llvm.org/D9147

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/






More information about the llvm-commits mailing list