diff options
| author | Benjamin Kramer <benny.kra@googlemail.com> | 2010-11-22 09:45:38 +0000 |
|---|---|---|
| committer | Benjamin Kramer <benny.kra@googlemail.com> | 2010-11-22 09:45:38 +0000 |
| commit | 24656c958316e66e403c1f6e86d782240fc33301 (patch) | |
| tree | ff4ebe312733edbbe2a04e5a46ca597ea12dc29d /llvm/test | |
| parent | c6648eb4c33fd4a97436be4a899ae9ebf9dcd24a (diff) | |
| download | bcm5719-llvm-24656c958316e66e403c1f6e86d782240fc33301.tar.gz bcm5719-llvm-24656c958316e66e403c1f6e86d782240fc33301.zip | |
Implement the "if (X == 6 || X == 4)" -> "if ((X|2) == 6)" optimization.
This currently only catches the most basic case, a two-case switch, but can be
extended later.
llvm-svn: 119964
Diffstat (limited to 'llvm/test')
| -rw-r--r-- | llvm/test/CodeGen/X86/switch-or.ll | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/llvm/test/CodeGen/X86/switch-or.ll b/llvm/test/CodeGen/X86/switch-or.ll new file mode 100644 index 00000000000..75832c7d304 --- /dev/null +++ b/llvm/test/CodeGen/X86/switch-or.ll @@ -0,0 +1,22 @@ +; RUN: llc -march=x86 -asm-verbose=false < %s | FileCheck %s + +; Check that merging switch cases that differ in one bit works. +; CHECK: orl $2 +; CHECK-NEXT: cmpl $6 + +define void @foo(i32 %variable) nounwind { +entry: + switch i32 %variable, label %if.end [ + i32 4, label %if.then + i32 6, label %if.then + ] + +if.then: + %call = tail call i32 (...)* @bar() nounwind + ret void + +if.end: + ret void +} + +declare i32 @bar(...) nounwind |

