diff options
author | Chris Lattner <sabre@nondot.org> | 2008-05-19 20:18:56 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2008-05-19 20:18:56 +0000 |
commit | a540623ab1186d5045f40dc8659bf2330523d34c (patch) | |
tree | a9a256bdc984e3bf77700d6e3f64c3cbc4d649b0 /test/Transforms | |
parent | 13d57320bd212483463d4f8992d5787b29eda5df (diff) | |
download | external_llvm-a540623ab1186d5045f40dc8659bf2330523d34c.zip external_llvm-a540623ab1186d5045f40dc8659bf2330523d34c.tar.gz external_llvm-a540623ab1186d5045f40dc8659bf2330523d34c.tar.bz2 |
Fold FP comparisons where one operand is converted from an integer
type and the other operand is a constant into integer comparisons.
This happens surprisingly frequently (e.g. 10 times in 471.omnetpp),
which are things like this:
%tmp8283 = sitofp i32 %tmp82 to double
%tmp1013 = fcmp ult double %tmp8283, 0.0
Clearly comparing tmp82 against i32 0 is cheaper here.
this also triggers 8 times in gobmk, including this one:
%tmp375376 = sitofp i32 %tmp375 to double
%tmp377 = fcmp ogt double %tmp375376, 8.150000e+01
which is comparing an integer against 81.5 :).
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51268 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Transforms')
-rw-r--r-- | test/Transforms/InstCombine/sitofp.ll | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/test/Transforms/InstCombine/sitofp.ll b/test/Transforms/InstCombine/sitofp.ll new file mode 100644 index 0000000..fd06dea --- /dev/null +++ b/test/Transforms/InstCombine/sitofp.ll @@ -0,0 +1,25 @@ +; RUN: llvm-as < %s | opt -instcombine | llvm-dis | not grep sitofp + +define i1 @test1(i8 %A) { + %B = sitofp i8 %A to double + %C = fcmp ult double %B, 128.0 + ret i1 %C ; True! +} +define i1 @test2(i8 %A) { + %B = sitofp i8 %A to double + %C = fcmp ugt double %B, -128.1 + ret i1 %C ; True! +} + +define i1 @test3(i8 %A) { + %B = sitofp i8 %A to double + %C = fcmp ule double %B, 127.0 + ret i1 %C ; true! +} + +define i1 @test4(i8 %A) { + %B = sitofp i8 %A to double + %C = fcmp ult double %B, 127.0 + ret i1 %C ; A != 127 +} + |