1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-22 18:54:02 +01:00
llvm-mirror/test
David Sherwood 8067824e3d [InstCombine] Fold extractelement + vector GEP with one use
We sometimes see code like this:

Case 1:
  %gep = getelementptr i32, i32* %a, <2 x i64> %splat
  %ext = extractelement <2 x i32*> %gep, i32 0

or this:

Case 2:
  %gep = getelementptr i32, <4 x i32*> %a, i64 1
  %ext = extractelement <4 x i32*> %gep, i32 0

where there is only one use of the GEP. In such cases it makes
sense to fold the two together such that we create a scalar GEP:

Case 1:
  %ext = extractelement <2 x i64> %splat, i32 0
  %gep = getelementptr i32, i32* %a, i64 %ext

Case 2:
  %ext = extractelement <2 x i32*> %a, i32 0
  %gep = getelementptr i32, i32* %ext, i64 1

This may create further folding opportunities as a result, i.e.
the extract of a splat vector can be completely eliminated. Also,
even for the general case where the vector operand is not a splat
it seems beneficial to create a scalar GEP and extract the scalar
element from the operand. Therefore, in this patch I've assumed
that a scalar GEP is always preferrable to a vector GEP and have
added code to unconditionally fold the extract + GEP.

I haven't added folds for the case when we have both a vector of
pointers and a vector of indices, since this would require
generating an additional extractelement operation.

Tests have been added here:

  Transforms/InstCombine/gep-vector-indices.ll

Differential Revision: https://reviews.llvm.org/D101900
2021-05-26 09:54:26 +01:00
..
Analysis [CostModel][X86] Improve accuracy of 256-bit non-uniform vector shifts on AVX1 2021-05-25 17:31:45 +01:00
Assembler [OpaquePtr] Make atomicrmw work with opaque pointers 2021-05-25 20:16:21 -07:00
Bindings
Bitcode [OpaquePtr] Create new bitcode encoding for atomicrmw 2021-05-25 16:30:34 -07:00
BugPoint
CodeGen [ARM] Add patterns for vmulh 2021-05-26 09:22:12 +01:00
DebugInfo
Demangle [Demangle][Rust] Parse function signatures 2021-05-22 11:49:08 +02:00
Examples
ExecutionEngine [JITLink][MachO][arm64] Build GOT entries for defined symbols too. 2021-05-25 12:19:09 -07:00
Feature [FunctionAttrs] Force old pm in test so it doens't behave differently depending on the configuration setting for this flag 2021-04-09 11:46:19 +02:00
FileCheck
Instrumentation LLVM Detailed IR tests for introduction of flag -fsanitize-address-detect-stack-use-after-return-mode. 2021-05-25 16:17:39 -07:00
Integer
JitListener
Linker Revert "[NFC] remove explicit default value for strboolattr attribute in tests" 2021-05-24 19:43:40 +02:00
LTO Revert "[NFC] remove explicit default value for strboolattr attribute in tests" 2021-05-24 19:43:40 +02:00
MachineVerifier
MC Revert "[NFC] remove explicit default value for strboolattr attribute in tests" 2021-05-24 19:43:40 +02:00
Object
ObjectYAML
Other Making Instrumentation aware of LoopNest Pass 2021-05-24 20:25:52 -07:00
SafepointIRVerifier
Support
SymbolRewriter
TableGen [TableGen] Make the NUL character invalid in .td files 2021-05-13 10:17:45 -04:00
ThinLTO/X86
tools [CSSPGO][llvm-profgen] Change default cold threshold for context merging 2021-05-25 10:41:10 -07:00
Transforms [InstCombine] Fold extractelement + vector GEP with one use 2021-05-26 09:54:26 +01:00
Unit
Verifier [OpaquePtr] Make atomicrmw work with opaque pointers 2021-05-25 20:16:21 -07:00
YAMLParser
.clang-format
CMakeLists.txt
lit.cfg.py
lit.site.cfg.py.in
TestRunner.sh