[polly] r246940 - RuntimeDebugPrinter: Simplify code [NFC]

Tobias Grosser via llvm-commits llvm-commits at lists.llvm.org
Sun Sep 6 00:17:56 PDT 2015


Author: grosser
Date: Sun Sep  6 02:17:54 2015
New Revision: 246940

URL: http://llvm.org/viewvc/llvm-project?rev=246940&view=rev
Log:
RuntimeDebugPrinter: Simplify code [NFC]

Modified:
    polly/trunk/lib/CodeGen/RuntimeDebugBuilder.cpp

Modified: polly/trunk/lib/CodeGen/RuntimeDebugBuilder.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/CodeGen/RuntimeDebugBuilder.cpp?rev=246940&r1=246939&r2=246940&view=diff
==============================================================================
--- polly/trunk/lib/CodeGen/RuntimeDebugBuilder.cpp (original)
+++ polly/trunk/lib/CodeGen/RuntimeDebugBuilder.cpp Sun Sep  6 02:17:54 2015
@@ -119,32 +119,28 @@ void RuntimeDebugBuilder::createGPUVAPri
     Type *Ty = Val->getType();
 
     if (Ty->isFloatingPointTy()) {
-      if (!Ty->isDoubleTy()) {
-        Ty = Builder.getDoubleTy();
-        Val = Builder.CreateFPExt(Val, Ty);
-      }
+      if (!Ty->isDoubleTy())
+        Val = Builder.CreateFPExt(Val, Builder.getDoubleTy());
     } else if (Ty->isIntegerTy()) {
-      auto Int64Bitwidth = Builder.getInt64Ty()->getIntegerBitWidth();
-      assert(Ty->getIntegerBitWidth() <= Int64Bitwidth);
-      if (Ty->getIntegerBitWidth() < Int64Bitwidth) {
-        Ty = Builder.getInt64Ty();
-        Val = Builder.CreateSExt(Val, Ty);
-      }
+      if (Ty->getIntegerBitWidth() < 64)
+        Val = Builder.CreateSExt(Val, Builder.getInt64Ty());
+      else
+        assert(Ty->getIntegerBitWidth() &&
+               "Integer types larger 64 bit not supported");
     } else if (auto PtTy = dyn_cast<PointerType>(Ty)) {
       if (PtTy->getAddressSpace() == 4) {
         // Pointers in constant address space are printed as strings
         Val = Builder.CreateGEP(Val, Builder.getInt64(0));
         auto F = RuntimeDebugBuilder::getAddressSpaceCast(Builder, 4, 0);
         Val = Builder.CreateCall(F, Val);
-        Ty = Val->getType();
       } else {
         Val = Builder.CreatePtrToInt(Val, Builder.getInt64Ty());
-        Ty = Val->getType();
       }
     } else {
       llvm_unreachable("Unknown type");
     }
 
+    Ty = Val->getType();
     Ptr = Builder.CreatePointerBitCastOrAddrSpaceCast(Ptr, Ty->getPointerTo(5));
     Builder.CreateAlignedStore(Val, Ptr, 4);
 




More information about the llvm-commits mailing list