llvm-project/llvm/test
Hiroshi Inoue 37e63b1b21 Summary
PPC backend eliminates compare instructions by using record-form instructions in PPCInstrInfo::optimizeCompareInstr, which is called from peephole optimization pass.
This patch improves this optimization to eliminate more compare instructions in two types of common case.


- comparison against a constant 1 or -1

The record-form instructions set CR bit based on signed comparison against 0. So, the current implementation does not exploit the record-form instruction for comparison against a non-zero constant.
This patch enables record-form optimization for constant of 1 or -1 if possible; it changes the condition "greater than -1" into "greater than or equal to 0" and "less than 1" into "less than or equal to 0".
With this patch, compare can be eliminated in the following code sequence, as an example.

uint64_t a, b;
if ((a | b) & 0x8000000000000000ull) { ... }
else { ... }


- andi for 32-bit comparison on PPC64

Since record-form instructions execute 64-bit signed comparison and so we have limitation in eliminating 32-bit comparison, i.e. with cmplwi, using the record-form. The original implementation already has such checks but andi. is not recognized as an instruction which executes implicit zero extension and hence safe to convert into record-form if used for equality check.

%1 = and i32 %a, 10
%2 = icmp ne i32 %1, 0
br i1 %2, label %foo, label %bar

In this simple example, LLVM generates andi. + cmplwi + beq on PPC64.
This patch make it possible to eliminate the cmplwi for this case.
I added andi. for optimization targets if it is safe to do so.

Differential Revision: https://reviews.llvm.org/D30081

llvm-svn: 303500
2017-05-21 06:00:05 +00:00
..
Analysis Revert "[SCEV] Clarify behavior around max backedge taken count" 2017-05-21 05:02:12 +00:00
Assembler [IR] Allow attributes with global variables 2017-05-11 12:28:08 +00:00
Bindings
Bitcode Add "REQUIRES:" to the last few tests that use target specific intrinsics 2017-05-15 22:15:22 +00:00
BugPoint llvm/test/BugPoint/compile-custom.ll: Use %/s for its path not to be mis-escaped. 2017-04-13 11:40:32 +00:00
CodeGen Summary 2017-05-21 06:00:05 +00:00
DebugInfo llvm-symbolizer: Support multiple CUs in a single DWO file 2017-05-20 03:32:49 +00:00
Examples
ExecutionEngine [RuntimeDyld] Fix debug section relocation (pr20457) 2017-05-17 08:47:28 +00:00
Feature Test for r303197 2017-05-16 20:53:27 +00:00
FileCheck
Instrumentation Update three tests I missed in r302979 and r302990 2017-05-18 00:58:06 +00:00
Integer
JitListener
LTO Revert "Revert "ThinLTO: Verify bitcode before lauching the ThinLTOCodeGenerator."" 2017-05-20 00:00:08 +00:00
LibDriver
Linker Remap metadata attached to global variables. 2017-05-04 23:29:39 +00:00
MC [AMDGPU][MC] Corrected disassembler to decode instructions with 2 literals 2017-05-19 14:27:52 +00:00
Object Add support for handling ifuncs to GlobalValue::getBaseObject 2017-05-15 18:28:29 +00:00
ObjectYAML [WebAssembly] Improve libObject support for wasm imports and exports 2017-05-09 23:48:41 +00:00
Other [PM] Add ProfileSummaryAnalysis as a required pass in the new pipeline. 2017-05-04 16:58:45 +00:00
SymbolRewriter
TableGen [MVT] add v1i1 MVT 2017-05-18 11:29:41 +00:00
ThinLTO/X86 [ThinLTO] Do not assert when adding a module with a different but 2017-05-18 03:52:29 +00:00
Transforms Revert "Add pthread_self function prototype and make it speculatable." 2017-05-21 00:37:55 +00:00
Unit [Lit] Fix to prevent creation of "%SystemDrive%" directory on Windows. 2017-05-08 08:55:38 +00:00
Verifier Make it illegal for two Functions to point to the same DISubprogram 2017-05-09 19:47:37 +00:00
YAMLParser
tools Add functionality to cvtres to parse all entries in res file. 2017-05-20 01:49:19 +00:00
.clang-format
CMakeLists.txt Add a dependency from llvm/test to llvm-cvtres. 2017-04-21 20:45:11 +00:00
TestRunner.sh
lit.cfg
lit.site.cfg.in