[PATCH] Handle big index in getelementptr instruction

David Majnemer david.majnemer at gmail.com
Tue Mar 10 13:35:43 PDT 2015


REPOSITORY
  rL LLVM

================
Comment at: lib/CodeGen/SelectionDAG/FastISel.cpp:521
@@ -520,3 +520,3 @@
         // N = N + Offset
-        TotalOffs +=
-            DL.getTypeAllocSize(Ty) * cast<ConstantInt>(CI)->getSExtValue();
+        auto I = CI->getValue().sextOrTrunc(sizeof(TotalOffs)*8).getSExtValue();
+        TotalOffs += DL.getTypeAllocSize(Ty) * I;
----------------
chfast wrote:
> rnk wrote:
> > rnk wrote:
> > > Don't shadow the outer 'I' variable.
> > This sizeof computation doesn't get PtrSize. LLVM is a cross compiler. You can compute it out of the loop.
> I don't want a PtrSize, I want TotalOffs size in bits, because I'm going to add to that variable.
In that case, please just use 64.  LLVM assumes that pointers are not wider than 64-bits.

Is this functionally different from:
  CI->getValue().trunc(64).getSExtValue();

?

http://reviews.llvm.org/D8219

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






More information about the llvm-commits mailing list