[PATCH] Fix icmp lowering

Paweł Bylica chfast at gmail.com
Wed May 20 09:30:31 PDT 2015


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())) {
----------------
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.

http://reviews.llvm.org/D9147

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






More information about the llvm-commits mailing list