]> granicus.if.org Git - clang/commitdiff
Temporarily disable clearing of insert point (to indicate unreachable
authorDaniel Dunbar <daniel@zuster.org>
Wed, 25 Feb 2009 20:59:29 +0000 (20:59 +0000)
committerDaniel Dunbar <daniel@zuster.org>
Wed, 25 Feb 2009 20:59:29 +0000 (20:59 +0000)
code) when calling noreturn functions; general expression emission
isn't ready to do the right thing in all cases.

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

lib/CodeGen/CGCall.cpp
test/CodeGen/function-attributes.c

index 8f4367c8586bd7fd587d4f89e24481d61a3234b0..93f4ebe9452576285c0d5c33bc7923756db16907 100644 (file)
@@ -1787,6 +1787,11 @@ RValue CodeGenFunction::EmitCall(const CGFunctionInfo &CallInfo,
       Builder.CreateUnreachable();
       Builder.ClearInsertionPoint();
       
+      // FIXME: For now, emit a dummy basic block because expr
+      // emitters in generally are not ready to handle emitting
+      // expressions at unreachable points.
+      EnsureInsertPoint();
+
       // Return a reasonable RValue.
       return GetUndefRValue(RetTy);
     }    
index ca16459fd9757e485c930688a85ae38b619bc519..eb8b1e332496e5ad9218564b35a95b07c6695931 100644 (file)
@@ -35,5 +35,12 @@ void f9(void) { f9_t(); }
 // RUN: grep 'call i32 @f10_t() readnone' %t &&
 int __attribute__((const)) f10_t(void);
 int f10(void) { return f10_t(); }
+int f11(void) {
+ exit:
+  return f10_t();
+}
+int f12(int arg) {
+  return arg ? 0 : f10_t();
+}
 
 // RUN: true