Don't attempt to upgrade argument to va.start and va.end if there are none.
authorReid Spencer <rspencer@reidspencer.com>
Sat, 13 Jan 2007 00:22:40 +0000 (00:22 +0000)
committerReid Spencer <rspencer@reidspencer.com>
Sat, 13 Jan 2007 00:22:40 +0000 (00:22 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33171 91177308-0d34-0410-b5e6-96231b3b80d8

tools/llvm-upgrade/UpgradeParser.y

index 2b2d1ecd521ea42b65d95dd7ddbae103d1a5f3e4..ed70cbbff2b2c2b2f5bc073e425947093186ce30 100644 (file)
@@ -1888,11 +1888,13 @@ InstVal : ArithmeticOps Types ValueRef ',' ValueRef {
     } else {
       static unsigned upgradeCount = 1;
       if (*$4.val == "%llvm.va_start" || *$4.val == "%llvm.va_end") {
-        std::string name("%va_upgrade");
-        name += llvm::utostr(upgradeCount++);
-        $1->insert(0, name + " = bitcast " + *(*$6)[0].val + " to i8*\n    ");
-        *(*$6)[0].val = "i8* " + name;
-        (*$6)[0].type = TypeInfo::get("i8", UByteTy)->getPointerType();
+        if (!$6->empty()) {
+          std::string name("%va_upgrade");
+          name += llvm::utostr(upgradeCount++);
+          $1->insert(0, name + " = bitcast " + *(*$6)[0].val + " to i8*\n    ");
+          *(*$6)[0].val = "i8* " + name;
+          (*$6)[0].type = TypeInfo::get("i8", UByteTy)->getPointerType();
+        }
       } else if (*$4.val == "%llvm.va_copy") {
         std::string name0("%va_upgrade");
         name0 += llvm::utostr(upgradeCount++);