diff options
author | Sanjay Patel <spatel@rotateright.com> | 2017-06-08 16:53:18 +0000 |
---|---|---|
committer | Sanjay Patel <spatel@rotateright.com> | 2017-06-08 16:53:18 +0000 |
commit | e7c5041c2ae10b4da0526d5abdc5cbcd647f1b45 (patch) | |
tree | 3761f6a721bd3583f07f40fb2fdb3bd7fe9767c0 /llvm/lib/Object/IRObjectFile.cpp | |
parent | 8cb1d0931f2749a9731e1a59f869a509baa83640 (diff) | |
download | llvm-e7c5041c2ae10b4da0526d5abdc5cbcd647f1b45.zip llvm-e7c5041c2ae10b4da0526d5abdc5cbcd647f1b45.tar.gz llvm-e7c5041c2ae10b4da0526d5abdc5cbcd647f1b45.tar.bz2 |
[CGP / PowerPC] avoid multi-block overhead for simple memcmp expansion
The test diff for PowerPC shows we can better optimize if this case is one block.
For x86, there's would be a substantial difference if CGP expansion was enabled because branches are assumed
cheap and SDAG can't optimize across blocks.
Instead of this:
_cmp_eq8:
movq (%rdi), %rax
cmpq (%rsi), %rax
je LBB23_1
## BB#2: ## %res_block
movl $1, %ecx
jmp LBB23_3
LBB23_1:
xorl %ecx, %ecx
LBB23_3: ## %endblock
xorl %eax, %eax
testl %ecx, %ecx
sete %al
retq
We get this:
cmp_eq8:
movq (%rdi), %rcx
xorl %eax, %eax
cmpq (%rsi), %rcx
sete %al
retq
And that matches the optimal codegen that we get from the current expansion in SelectionDAGBuilder::visitMemCmpCall().
If this looks right, then I just need to confirm that vector-sized expansion will work from here, and we can enable
CGP memcmp() expansion for x86. Ie, we'll bypass the power-of-2 special cases currently optimized in SDAG because we
can lower the IR produced here optimally.
Differential Revision: https://reviews.llvm.org/D34005
llvm-svn: 304987
Diffstat (limited to 'llvm/lib/Object/IRObjectFile.cpp')
0 files changed, 0 insertions, 0 deletions