From: Daniel Dunbar Date: Wed, 25 Feb 2009 20:59:29 +0000 (+0000) Subject: Temporarily disable clearing of insert point (to indicate unreachable X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=0334a4ec63c43ac9ed13faa30fbcfc7697828ffd;p=clang Temporarily disable clearing of insert point (to indicate unreachable 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 --- diff --git a/lib/CodeGen/CGCall.cpp b/lib/CodeGen/CGCall.cpp index 8f4367c858..93f4ebe945 100644 --- a/lib/CodeGen/CGCall.cpp +++ b/lib/CodeGen/CGCall.cpp @@ -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); } diff --git a/test/CodeGen/function-attributes.c b/test/CodeGen/function-attributes.c index ca16459fd9..eb8b1e3324 100644 --- a/test/CodeGen/function-attributes.c +++ b/test/CodeGen/function-attributes.c @@ -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