llvm-project/llvm/lib
Craig Topper 06aea1720a [X86] Move promotion of vector and/or/xor from legalization to DAG combine
Summary:
I've noticed that the bitcasts we introduce for these make computeKnownBits and computeNumSignBits not work well in LegalizeVectorOps. LegalizeVectorOps legalizes bottom up while LegalizeDAG legalizes top down. The bottom up strategy for LegalizeVectorOps means operands are legalized before their uses. So we promote and/or/xor before we legalize the operands that use them making computeKnownBits/computeNumSignBits in places like LowerTruncate suboptimal. I looked at changing LegalizeVectorOps to be top down as well, but that was more disruptive and caused some regressions. I also looked at just moving promotion of binops to LegalizeDAG, but that had a few issues one around matching AND,ANDN,OR into VSELECT because I had to create ANDN as vXi64, but the other nodes hadn't legalized yet, I didn't look too hard at fixing that.

This patch seems to produce better results overall than my other attempts. We now form broadcasts of constants better in some cases. For at least some of them the AND was being introduced in LegalizeDAG, promoted to vXi64, and the BUILD_VECTOR was also legalized there. I think we got bad ordering of that. Now the promotion is out of the legalizer so we handle this better.

In the longer term I think we really should evaluate whether we should be doing this promotion at all. It's really there to reduce isel pattern count, but I'm wondering if we'd be better served just eating the pattern cost or doing C++ based isel for vector and/or/xor in X86ISelDAGToDAG. The masked and/or/xor will definitely be difficult in patterns if a bitcast gets between the vselect and the and/or/xor node. That becomes a lot of permutations to cover.

Reviewers: RKSimon, spatel

Reviewed By: RKSimon

Subscribers: llvm-commits

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

llvm-svn: 344487
2018-10-15 01:51:58 +00:00
..
Analysis recommit 344472 after fixing build failure on ARM and PPC. 2018-10-14 08:50:06 +00:00
AsmParser Emit template type and value parameter DIEs for template variables. 2018-10-03 18:44:53 +00:00
BinaryFormat Revert r343317 2018-09-28 17:01:50 +00:00
Bitcode Emit template type and value parameter DIEs for template variables. 2018-10-03 18:44:53 +00:00
CodeGen [LegalizeDAG] Don't bother with final MUL+SRL stage for byte CTPOP. 2018-10-14 15:56:28 +00:00
DebugInfo [DwarfVerifier] Fixed -Wimplicit-fallthrough warning 2018-10-10 20:10:37 +00:00
Demangle Move some helpers from the global namespace into anonymous ones. 2018-10-13 22:18:22 +00:00
ExecutionEngine [ORC] During lookup, do not match against hidden symbols in other JITDylibs. 2018-10-13 21:53:40 +00:00
FuzzMutate [New PM] Introducing PassInstrumentation framework 2018-09-20 17:08:45 +00:00
Fuzzer
IR Generalize an IR verifier check to work with non-zero program address spaces 2018-10-11 12:49:50 +00:00
IRReader
LTO Add a flag to remap manglings when reading profile data information. 2018-10-10 23:13:47 +00:00
LineEditor
Linker llvm-link: Improve diagnostic for module-level metadata mismatch 2018-10-09 01:17:27 +00:00
MC Revert BTF commit series. 2018-10-12 19:41:05 +00:00
Object llvm-ar: Darwin archive format fixes. 2018-10-10 21:07:02 +00:00
ObjectYAML [WebAssembly] Add V128 value type to binary format 2018-09-20 22:04:44 +00:00
OptRemarks Reland: [OptRemarks] Add library for parsing optimization remarks 2018-10-10 18:43:42 +00:00
Option [opt] Change the parameter of OptTable::PrintHelp from Name to Usage and don't append "[options] <inputs>" 2018-10-10 00:15:31 +00:00
Passes [PassManager/Sanitizer] Port of AddresSanitizer pass from legacy to new PassManager 2018-10-11 18:31:51 +00:00
ProfileData Support for remapping profile data when symbols change, for sample-based 2018-10-10 21:31:01 +00:00
Support [Support] exit with custom return code for SIGPIPE 2018-10-12 17:22:07 +00:00
TableGen [TableGen] fix assert in !cast when used out of definition in a multiclass 2018-10-10 10:52:57 +00:00
Target [X86] Move promotion of vector and/or/xor from legalization to DAG combine 2018-10-15 01:51:58 +00:00
Testing Fix error with SmallString implicit conversion. 2018-09-06 22:47:32 +00:00
ToolDrivers [opt] Change the parameter of OptTable::PrintHelp from Name to Usage and don't append "[options] <inputs>" 2018-10-10 00:15:31 +00:00
Transforms [LV] Fix comments reported when not vectorizing single iteration loops; NFC 2018-10-14 17:53:02 +00:00
WindowsManifest Convert line endings of lib/WindowsManifest/CMakeLists.txt to unix. 2018-04-07 04:28:08 +00:00
XRay Use the container form llvm::sort(C, ...) 2018-09-30 22:31:29 +00:00
CMakeLists.txt Reland: [OptRemarks] Add library for parsing optimization remarks 2018-10-10 18:43:42 +00:00
LLVMBuild.txt Reland: [OptRemarks] Add library for parsing optimization remarks 2018-10-10 18:43:42 +00:00