diff options
author | Chris Lattner <sabre@nondot.org> | 2004-12-12 05:52:12 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2004-12-12 05:52:12 +0000 |
commit | ef07cc5e489def0561d45d850d4eeccee723d5db (patch) | |
tree | 8c23420a6b6a850d4f866e72de2109732ded37a6 | |
parent | a177c6747195f2abe5a0fc10e1a65d6c0afb85b5 (diff) |
New testcase. Shrinking the variable to a bool allows instcombine to delete
the condition.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18816 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | test/Transforms/GlobalOpt/integer-bool.ll | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/test/Transforms/GlobalOpt/integer-bool.ll b/test/Transforms/GlobalOpt/integer-bool.ll new file mode 100644 index 0000000000..2daf9550f6 --- /dev/null +++ b/test/Transforms/GlobalOpt/integer-bool.ll @@ -0,0 +1,22 @@ +; RUN: llvm-as < %s | opt -globalopt -instcombine | llvm-dis | grep 'ret bool true' + +;; check that global opt turns integers that only hold 0 or 1 into bools. + +%G = internal global int 0 ;; This only holds 0 or 1. + +implementation + +void %set1() { + store int 0, int* %G + ret void +} +void %set2() { + store int 1, int* %G + ret void +} + +bool %get() { + %A = load int* %G + %C = setlt int %A, 2 ;; always true + ret bool %C +} |