diff options
author | Erich Keane <erich.keane@intel.com> | 2018-12-12 20:30:53 +0000 |
---|---|---|
committer | Erich Keane <erich.keane@intel.com> | 2018-12-12 20:30:53 +0000 |
commit | 8c94f07f54519b6c1844fc911d78b9cc7d7abd79 (patch) | |
tree | 97d2d6dd92c50a87b7cebf96863125b0c4809f26 /clang/test/CodeGen/builtin-unpredictable.c | |
parent | c22e62d9a7fbaca8ad17071159e70aae7147ee08 (diff) | |
download | bcm5719-llvm-8c94f07f54519b6c1844fc911d78b9cc7d7abd79.tar.gz bcm5719-llvm-8c94f07f54519b6c1844fc911d78b9cc7d7abd79.zip |
Teach __builtin_unpredictable to work through implicit casts.
The __builtin_unpredictable implementation is confused by any implicit
casts, which happen in C++. This patch strips those off so that
if/switch statements now work with it in C++.
Change-Id: I73c3bf4f1775cd906703880944f4fcdc29fffb0a
llvm-svn: 348969
Diffstat (limited to 'clang/test/CodeGen/builtin-unpredictable.c')
-rw-r--r-- | clang/test/CodeGen/builtin-unpredictable.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/clang/test/CodeGen/builtin-unpredictable.c b/clang/test/CodeGen/builtin-unpredictable.c index 30709b0cac6..bdd62e972b0 100644 --- a/clang/test/CodeGen/builtin-unpredictable.c +++ b/clang/test/CodeGen/builtin-unpredictable.c @@ -1,10 +1,15 @@ -// RUN: %clang_cc1 -triple x86_64-unknown-unknown -emit-llvm -disable-llvm-passes -o - %s -O1 | FileCheck %s +// RUN: %clang_cc1 -triple x86_64-unknown-unknown -emit-llvm -disable-llvm-passes -o - %s -O1 | FileCheck %s +// RUN: %clang_cc1 -triple x86_64-unknown-unknown -emit-llvm -disable-llvm-passes -o - -x c++ %s -O1 | FileCheck %s // RUN: %clang_cc1 -triple x86_64-unknown-unknown -emit-llvm -o - %s -O0 | FileCheck %s --check-prefix=CHECK_O0 // When optimizing, the builtin should be converted to metadata. // When not optimizing, there should be no metadata created for the builtin. // In both cases, the builtin should be removed from the code. +#ifdef __cplusplus +extern "C" { +#endif + void foo(); void branch(int x) { // CHECK-LABEL: define void @branch( @@ -42,5 +47,10 @@ int unpredictable_switch(int x) { return 0; } +#ifdef __cplusplus +} +#endif + + // CHECK: [[METADATA]] = !{} |