[llvm-commits] [llvm-gcc-4.2] r41277 - /llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp

Duncan Sands baldrick at free.fr
Wed Aug 22 10:00:12 PDT 2007


Author: baldrick
Date: Wed Aug 22 12:00:12 2007
New Revision: 41277

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

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

Modified: llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp?rev=41277&r1=41276&r2=41277&view=diff

==============================================================================
--- llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp (original)
+++ llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp Wed Aug 22 12:00:12 2007
@@ -3906,11 +3906,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;
   }
@@ -3952,13 +3953,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