[llvm-commits] [llvm-gcc-4.0] r40862 - /llvm-gcc-4.0/trunk/gcc/llvm-convert.cpp

Chris Lattner sabre at nondot.org
Mon Aug 6 09:28:12 PDT 2007


Author: lattner
Date: Mon Aug  6 11:28:11 2007
New Revision: 40862

URL: http://llvm.org/viewvc/llvm-project?rev=40862&view=rev
Log:
fix a regression compiling SingleSource/UnitTests/2005-05-11-Popcount-ffs-fls,
introduced by chandler's recent patches.

Modified:
    llvm-gcc-4.0/trunk/gcc/llvm-convert.cpp

Modified: llvm-gcc-4.0/trunk/gcc/llvm-convert.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.0/trunk/gcc/llvm-convert.cpp?rev=40862&r1=40861&r2=40862&view=diff

==============================================================================
--- llvm-gcc-4.0/trunk/gcc/llvm-convert.cpp (original)
+++ llvm-gcc-4.0/trunk/gcc/llvm-convert.cpp Mon Aug  6 11:28:11 2007
@@ -4303,11 +4303,12 @@
     // the ffs, but should ignore the return type of ffs.
     Value *Amt = Emit(TREE_VALUE(TREE_OPERAND(exp, 1)), 0);
     EmitBuiltinUnaryIntOp(Amt, Result, Intrinsic::cttz); 
-    Result = Builder.CreateAdd(Result, ConstantInt::get(Type::Int32Ty, 1),
+    Result = Builder.CreateAdd(Result, ConstantInt::get(Result->getType(), 1),
                                "tmp");
     Value *Cond =
       Builder.CreateICmpEQ(Amt, Constant::getNullValue(Amt->getType()), "tmp");
-    Result = Builder.CreateSelect(Cond, Constant::getNullValue(Type::Int32Ty),
+    Result = Builder.CreateSelect(Cond,
+                                  Constant::getNullValue(Result->getType()),
                                   Result, "tmp");
     return true;
   }
@@ -4347,13 +4348,9 @@
   // varying type. Make sure that we specify the actual type for "iAny" 
   // by passing it as the 3rd and 4th parameters. This isn't needed for
   // most intrinsics, but is needed for ctpop, cttz, ctlz.
-  const Type* Tys[] = {
-    InVal->getType()
-  };
-  Result = Builder.CreateCall(Intrinsic::getDeclaration(TheModule, Id, Tys, 
-                                                        sizeof(Tys)/sizeof(Tys[0])),
-                              InVal, "tmp");
-  
+  const Type *Ty = InVal->getType();
+  Result = Builder.CreateCall(Intrinsic::getDeclaration(TheModule, Id, &Ty, 1),
+                                                        InVal, "tmp");
   return true;
 }
 





More information about the llvm-commits mailing list