diff options
| author | Hiroshi Inoue <inouehrs@jp.ibm.com> | 2017-10-16 04:12:57 +0000 |
|---|---|---|
| committer | Hiroshi Inoue <inouehrs@jp.ibm.com> | 2017-10-16 04:12:57 +0000 |
| commit | e3a3e3c9e9d3c81e530431be213857cd34eecb56 (patch) | |
| tree | 2ee7cb124ec989fd64f92b0f4d8f336eb99fe462 /llvm/test/CodeGen/PowerPC/expand-isel.ll | |
| parent | ea8711b88e6c299b1abdb652b813f54f9340c23b (diff) | |
| download | bcm5719-llvm-e3a3e3c9e9d3c81e530431be213857cd34eecb56.tar.gz bcm5719-llvm-e3a3e3c9e9d3c81e530431be213857cd34eecb56.zip | |
[PowerPC] Eliminate sign- and zero-extensions if already sign- or zero-extended
This patch enables redundant sign- and zero-extension elimination in PowerPC MI Peephole pass.
If the input value of a sign- or zero-extension is known to be already sign- or zero-extended, the operation is redundant and can be eliminated.
One common case is sign-extensions for a method parameter or for a method return value; they must be sign- or zero-extended as defined in PPC ELF ABI.
For example of the following simple code, two extsw instructions are generated before the invocation of int_func and before the return. With this patch, both extsw are eliminated.
void int_func(int);
void ii_test(int a) {
if (a & 1) return int_func(a);
}
Such redundant sign- or zero-extensions are quite common in many programs; e.g. I observed about 60,000 occurrences of the elimination while compiling the LLVM+CLANG.
Differential Revision: https://reviews.llvm.org/D31319
llvm-svn: 315888
Diffstat (limited to 'llvm/test/CodeGen/PowerPC/expand-isel.ll')
| -rw-r--r-- | llvm/test/CodeGen/PowerPC/expand-isel.ll | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/llvm/test/CodeGen/PowerPC/expand-isel.ll b/llvm/test/CodeGen/PowerPC/expand-isel.ll index 84d17baf13a..76479705f02 100644 --- a/llvm/test/CodeGen/PowerPC/expand-isel.ll +++ b/llvm/test/CodeGen/PowerPC/expand-isel.ll @@ -215,9 +215,7 @@ cleanup: ; CHECK-LABEL: @testComplexISEL ; CHECK-DAG: [[LI:r[0-9]+]], 1 ; CHECK-DAG: cmplwi [[LD:r[0-9]+]], 0 -; CHECK: beq cr0, [[EQ:.LBB[0-9_]+]] -; CHECK: blr -; CHECK: [[EQ]] +; CHECK: bnelr cr0 ; CHECK: xor [[XOR:r[0-9]+]] ; CHECK: cntlzd [[CZ:r[0-9]+]], [[XOR]] ; CHECK: rldicl [[SH:r[0-9]+]], [[CZ]], 58, 63 |

