changeset 218:7073f9e4bffb

fix goto.c with -O
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Sat, 17 Jul 2021 15:02:42 +0900
parents ed684adca46d
children 9b1a90cb0f3c
files clang/lib/CodeGen/CGCall.cpp clang/lib/Parse/ParseCbC.cpp llvm/lib/IR/Function.cpp
diffstat 3 files changed, 6 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/clang/lib/CodeGen/CGCall.cpp	Fri Jul 16 23:26:00 2021 +0900
+++ b/clang/lib/CodeGen/CGCall.cpp	Sat Jul 17 15:02:42 2021 +0900
@@ -762,7 +762,7 @@
 #ifndef noCbC
   // if the function is a code segment , set fastcall calling convention.
   if(resultType.getTypePtr()->is__CodeType()){
-    CC = llvm::CallingConv::Fast;
+     CC = llvm::CallingConv::Fast;
   }
 #endif
 
@@ -5320,8 +5320,10 @@
     if (TargetDecl && TargetDecl->hasAttr<NotTailCalledAttr>())
       Call->setTailCallKind(llvm::CallInst::TCK_NoTail);
 #ifndef noCbC
-    if (this->FnRetTy.getTypePtr()->is__CodeType() && CallInfo.getReturnType().getTypePtr()->is__CodeType())
-      Call->setTailCallKind(llvm::CallInst::TCK_Tail);
+    if (! CallInfo.isVariadic() ) {
+      if (this->FnRetTy.getTypePtr()->is__CodeType() && CallInfo.getReturnType().getTypePtr()->is__CodeType())
+          Call->setTailCallKind(llvm::CallInst::TCK_Tail);
+    }
 #endif
   }
 
--- a/clang/lib/Parse/ParseCbC.cpp	Fri Jul 16 23:26:00 2021 +0900
+++ b/clang/lib/Parse/ParseCbC.cpp	Sat Jul 17 15:02:42 2021 +0900
@@ -220,7 +220,6 @@
       if (innerRes.isUsable())
         CompoundStmts.push_back(innerRes.get());
   }
-  ConsumeAnyToken();
   Tok = TokSave ;
   PrevTokLocation= PLocSave ;
 }
--- a/llvm/lib/IR/Function.cpp	Fri Jul 16 23:26:00 2021 +0900
+++ b/llvm/lib/IR/Function.cpp	Sat Jul 17 15:02:42 2021 +0900
@@ -818,6 +818,7 @@
   } else if (Ty) {
     switch (Ty->getTypeID()) {
     default: llvm_unreachable("Unhandled type");
+    case Type::__CodeTyID:      Result += "isVoid";   break;
     case Type::VoidTyID:      Result += "isVoid";   break;
     case Type::MetadataTyID:  Result += "Metadata"; break;
     case Type::HalfTyID:      Result += "f16";      break;