diff options
author | Duncan Sands <baldrick@free.fr> | 2011-10-05 14:28:49 +0000 |
---|---|---|
committer | Duncan Sands <baldrick@free.fr> | 2011-10-05 14:28:49 +0000 |
commit | 02b5e72ac6ec1fe81e1f73f85be436faa078eabf (patch) | |
tree | b134b98f43ec52bd80d331da2a4fa442fc017370 /test/Transforms/GVN/phi-translate.ll | |
parent | 452c58f4c45249b5046f74a165430eedaab5f8f6 (diff) | |
download | external_llvm-02b5e72ac6ec1fe81e1f73f85be436faa078eabf.zip external_llvm-02b5e72ac6ec1fe81e1f73f85be436faa078eabf.tar.gz external_llvm-02b5e72ac6ec1fe81e1f73f85be436faa078eabf.tar.bz2 |
GVN does simple propagation of conditions: when it sees a conditional
branch "br i1 %x, label %if_true, label %if_false" then it replaces
"%x" with "true" in places only reachable via the %if_true arm, and
with "false" in places only reachable via the %if_false arm. Except
that actually it doesn't: if value numbering shows that %y is equal
to %x then, yes, %y will be turned into true/false in this way, but
any occurrences of %x itself are not transformed. Fix this. What's
more, it's often the case that %x is an equality comparison such as
"%x = icmp eq %A, 0", in which case every occurrence of %A that is
only reachable via the %if_true arm can be replaced with 0. Implement
this and a few other variations on this theme. This reduces the number
of lines of LLVM IR in "GCC as one big file" by 0.2%. It has a bigger
impact on Ada code, typically reducing the number of lines of bitcode
by around 0.4% by removing repeated compiler generated checks. Passes
the LLVM nightly testsuite and the Ada ACATS testsuite.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@141177 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Transforms/GVN/phi-translate.ll')
-rw-r--r-- | test/Transforms/GVN/phi-translate.ll | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/test/Transforms/GVN/phi-translate.ll b/test/Transforms/GVN/phi-translate.ll index f10537e..fa91d29 100644 --- a/test/Transforms/GVN/phi-translate.ll +++ b/test/Transforms/GVN/phi-translate.ll @@ -14,7 +14,7 @@ target datalayout = "e-p:64:64:64" @G = external global [100 x i32] define i32 @foo(i32 %x, i32 %z) { entry: - %tobool = icmp eq i32 %x, 0 + %tobool = icmp eq i32 %z, 0 br i1 %tobool, label %end, label %then then: |