[PATCH] D31319: [PPC] Eliminate redundant sign- and zero-extensions in PPC MI Peephole pass
Hiroshi Inoue via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Mar 24 00:25:00 PDT 2017
inouehrs created this revision.
Herald added a subscriber: mehdi_amini.
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 common in many programs; e.g. I observed about 45,000 occurrences of the elimination while compiling the LLVM+CLANG for PPC.
https://reviews.llvm.org/D31319
Files:
lib/Target/PowerPC/PPCISelLowering.cpp
lib/Target/PowerPC/PPCInstrInfo.cpp
lib/Target/PowerPC/PPCInstrInfo.h
lib/Target/PowerPC/PPCMIPeephole.cpp
lib/Target/PowerPC/PPCMachineFunctionInfo.cpp
lib/Target/PowerPC/PPCMachineFunctionInfo.h
test/CodeGen/PowerPC/eliminate_ext.ll
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D31319.92902.patch
Type: text/x-patch
Size: 19317 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170324/f18cc902/attachment.bin>
More information about the llvm-commits
mailing list