summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--clang/lib/CodeGen/CGCall.cpp5
-rw-r--r--clang/test/CodeGen/function-attributes.c7
2 files changed, 12 insertions, 0 deletions
diff --git a/clang/lib/CodeGen/CGCall.cpp b/clang/lib/CodeGen/CGCall.cpp
index 8f4367c8586..93f4ebe9452 100644
--- a/clang/lib/CodeGen/CGCall.cpp
+++ b/clang/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/clang/test/CodeGen/function-attributes.c b/clang/test/CodeGen/function-attributes.c
index ca16459fd97..eb8b1e33249 100644
--- a/clang/test/CodeGen/function-attributes.c
+++ b/clang/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
OpenPOWER on IntegriCloud