diff options
Diffstat (limited to 'test/CodeGen/builtin-expect.c')
-rw-r--r-- | test/CodeGen/builtin-expect.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/test/CodeGen/builtin-expect.c b/test/CodeGen/builtin-expect.c index 2d49700217..d0dce9b4b9 100644 --- a/test/CodeGen/builtin-expect.c +++ b/test/CodeGen/builtin-expect.c @@ -78,3 +78,20 @@ int switch_cond(int x) { return 0; } +int variable_expected(int stuff) { +// ALL-LABEL: define i32 @variable_expected( +// O1: call i64 @llvm.expect.i64(i64 {{%.*}}, i64 {{%.*}}) +// O0-NOT: @llvm.expect + + int res = 0; + + switch (__builtin_expect(stuff, stuff)) { + case 0: + res = 1; + break; + default: + break; + } + + return res; +} |