Don't rely in there being one argument before we've actually identified
authorChandler Carruth <chandlerc@gmail.com>
Mon, 12 Dec 2011 10:57:20 +0000 (10:57 +0000)
committerChandler Carruth <chandlerc@gmail.com>
Mon, 12 Dec 2011 10:57:20 +0000 (10:57 +0000)
a function to upgrade. Also, simplify the code a bit at the expense of
one line.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@146368 91177308-0d34-0410-b5e6-96231b3b80d8

lib/VMCore/AutoUpgrade.cpp

index 6bdb115a9aacb4465557c7bfe156065dfc81b33c..ef29f71d173b234ba4b77a0eb6c5186ae9ab1b0b 100644 (file)
@@ -41,15 +41,16 @@ static bool UpgradeIntrinsicFunction1(Function *F, Function *&NewFn) {
   switch (Name[0]) {
   default: break;
   case 'c': {
-    Type *Tys[] = { F->arg_begin()->getType() };
     if (Name.startswith("ctlz.") && F->arg_size() == 1) {
       F->setName(Name + ".old");
-      NewFn = Intrinsic::getDeclaration(F->getParent(), Intrinsic::ctlz, Tys);
+      NewFn = Intrinsic::getDeclaration(F->getParent(), Intrinsic::ctlz,
+                                        F->arg_begin()->getType());
       return true;
     }
     if (Name.startswith("cttz.") && F->arg_size() == 1) {
       F->setName(Name + ".old");
-      NewFn = Intrinsic::getDeclaration(F->getParent(), Intrinsic::cttz, Tys);
+      NewFn = Intrinsic::getDeclaration(F->getParent(), Intrinsic::cttz,
+                                        F->arg_begin()->getType());
       return true;
     }
     break;