aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/CodeGen/MachinePipeliner.cpp
diff options
context:
space:
mode:
authorSebastian Pop <sebpop@gmail.com>2018-03-26 16:19:31 +0000
committerSebastian Pop <sebpop@gmail.com>2018-03-26 16:19:31 +0000
commitd870aea03ecb2387c215afb16f5e2073718d5aa4 (patch)
tree6e9004a302668fa5226bc30ddda0bb3ad53cf066 /llvm/lib/CodeGen/MachinePipeliner.cpp
parent40df8a2b98b5a753d38972777659be34fd03322e (diff)
downloadllvm-d870aea03ecb2387c215afb16f5e2073718d5aa4.zip
llvm-d870aea03ecb2387c215afb16f5e2073718d5aa4.tar.gz
llvm-d870aea03ecb2387c215afb16f5e2073718d5aa4.tar.bz2
[InstCombine] reassociate loop invariant GEP chains to enable LICM
This change brings performance of zlib up by 10%. The example below is from a hot loop in longest_match() from zlib. do.body: %cur_match.addr.0 = phi i32 [ %cur_match, %entry ], [ %2, %do.cond ] %idx.ext = zext i32 %cur_match.addr.0 to i64 %add.ptr = getelementptr inbounds i8, i8* %win, i64 %idx.ext %add.ptr2 = getelementptr inbounds i8, i8* %add.ptr, i64 %idx.ext1 %add.ptr3 = getelementptr inbounds i8, i8* %add.ptr2, i64 -1 In this example %idx.ext1 is a loop invariant. It will be moved above the use of loop induction variable %idx.ext such that it can be hoisted out of the loop by LICM. The operands that have dependences carried by the loop will be sinked down in the GEP chain. This patch will produce the following output: do.body: %cur_match.addr.0 = phi i32 [ %cur_match, %entry ], [ %2, %do.cond ] %idx.ext = zext i32 %cur_match.addr.0 to i64 %add.ptr = getelementptr inbounds i8, i8* %win, i64 %idx.ext1 %add.ptr2 = getelementptr inbounds i8, i8* %add.ptr, i64 -1 %add.ptr3 = getelementptr inbounds i8, i8* %add.ptr2, i64 %idx.ext llvm-svn: 328539
Diffstat (limited to 'llvm/lib/CodeGen/MachinePipeliner.cpp')
0 files changed, 0 insertions, 0 deletions