diff options
author | Devang Patel <dpatel@apple.com> | 2007-10-09 20:51:27 +0000 |
---|---|---|
committer | Devang Patel <dpatel@apple.com> | 2007-10-09 20:51:27 +0000 |
commit | 152f18f671fb787eda1b803e956725095fd7ffa3 (patch) | |
tree | 4b249cb70fc18c436f6d18a278e801af668eddc2 /clang/test/CodeGen/whilestmt.c | |
parent | f8a76755df0cfa1cbb0adb7a5a53a287a37f0582 (diff) | |
download | bcm5719-llvm-152f18f671fb787eda1b803e956725095fd7ffa3.tar.gz bcm5719-llvm-152f18f671fb787eda1b803e956725095fd7ffa3.zip |
Recognize while(1) and avoid extra blocks.
llvm-svn: 42811
Diffstat (limited to 'clang/test/CodeGen/whilestmt.c')
-rw-r--r-- | clang/test/CodeGen/whilestmt.c | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/clang/test/CodeGen/whilestmt.c b/clang/test/CodeGen/whilestmt.c new file mode 100644 index 00000000000..8ded265d0c0 --- /dev/null +++ b/clang/test/CodeGen/whilestmt.c @@ -0,0 +1,62 @@ +// RUN: clang %s -emit-llvm + +int bar(); +int foo() { + int i; + i = 1 + 2; + while(1) { + i = bar(); + i = bar(); + }; + return i; +} + + +int foo1() { + int i; + i = 1 + 2; + while(1) { + i = bar(); + if (i == 42) + break; + i = bar(); + }; + return i; +} + + +int foo2() { + int i; + i = 1 + 2; + while(1) { + i = bar(); + if (i == 42) + continue; + i = bar(); + }; + return i; +} + + +int foo3() { + int i; + i = 1 + 2; + while(1) { + i = bar(); + if (i == 42) + break; + }; + return i; +} + + +int foo4() { + int i; + i = 1 + 2; + while(1) { + i = bar(); + if (i == 42) + continue; + }; + return i; +} |