[llvm-commits] [dragonegg] r132740 - /dragonegg/trunk/src/Constants.cpp

Duncan Sands baldrick at free.fr
Wed Jun 8 00:03:04 PDT 2011


Author: baldrick
Date: Wed Jun  8 02:03:04 2011
New Revision: 132740

URL: http://llvm.org/viewvc/llvm-project?rev=132740&view=rev
Log:
Hoist getting IntPtrTy out of the loop.

Modified:
    dragonegg/trunk/src/Constants.cpp

Modified: dragonegg/trunk/src/Constants.cpp
URL: http://llvm.org/viewvc/llvm-project/dragonegg/trunk/src/Constants.cpp?rev=132740&r1=132739&r2=132740&view=diff
==============================================================================
--- dragonegg/trunk/src/Constants.cpp (original)
+++ dragonegg/trunk/src/Constants.cpp Wed Jun  8 02:03:04 2011
@@ -541,15 +541,14 @@
     unsigned NumElts = TYPE_VECTOR_SUBPARTS(type);
     unsigned Stride = GET_MODE_BITSIZE(TYPE_MODE(elt_type));
     SmallVector<Constant*, 16> Vals(NumElts);
+    const IntegerType *IntPtrTy = getTargetData().getIntPtrType(Context);
     for (unsigned i = 0; i != NumElts; ++i) {
       Vals[i] = ExtractRegisterFromConstantImpl(C, elt_type,
                                                 StartingBit+i*Stride, Folder);
       // LLVM does not support vectors of pointers, so turn any pointers into
       // integers.
-      if (isa<PointerType>(Vals[i]->getType())) {
-        const IntegerType *IntTy = getTargetData().getIntPtrType(Context);
-        Vals[i] = Folder.CreatePtrToInt(Vals[i], IntTy);
-      }
+      if (isa<PointerType>(Vals[i]->getType()))
+        Vals[i] = Folder.CreatePtrToInt(Vals[i], IntPtrTy);
     }
     return ConstantVector::get(Vals);
   }





More information about the llvm-commits mailing list