llvm-project/llvm/lib/Transforms/Scalar
A-Wadhwani de3445e0ef [SROA] Create additional vector type candidates based on store and load slices
This patch adds additional vector types to be considered when doing
promotion in SROA, based on the types of the store and load slices. This
provides more promotion opportunities, by potentially using an optimal
"intermediate" vector type.

For example, the following code would currently not be promoted to a
vector, since `__m128i` is a `<2 x i64>` vector.

```

__m128i packfoo0(int a, int b, int c, int d) {
  int r[4] = {a, b, c, d};
  __m128i rm;
  std::memcpy(&rm, r, sizeof(rm));
  return rm;
}
```

```
packfoo0(int, int, int, int):
        mov     dword ptr [rsp - 24], edi
        mov     dword ptr [rsp - 20], esi
        mov     dword ptr [rsp - 16], edx
        mov     dword ptr [rsp - 12], ecx
        movaps  xmm0, xmmword ptr [rsp - 24]
        ret
```

By also considering the types of the elements, we could find that the
`<4 x i32>` type would be valid for promotion, hence removing the memory
accesses for this function. In other words, we can explore other new
vector types, with the same size but different element types based on
the load and store instructions from the Slices, which can provide us
more promotion opportunities.

Additionally, the step for removing duplicate elements from the
`CandidateTys` vector was not using an equality comparator, which has
been fixed.

Differential Revision: https://reviews.llvm.org/D132096
2022-09-12 09:55:37 -07:00
..
ADCE.cpp [Scalar] Qualify auto in range-based for loops (NFC) 2022-08-20 21:18:25 -07:00
AlignmentFromAssumptions.cpp Cleanup includes: Transform/Scalar 2022-03-03 07:56:34 +01:00
AnnotationRemarks.cpp Cleanup includes: Transform/Scalar 2022-03-03 07:56:34 +01:00
BDCE.cpp
CMakeLists.txt [Passes] Remove legacy LoopUnswitch pass. 2022-04-29 10:30:49 +01:00
CallSiteSplitting.cpp [Transform] Use range-based for loops (NFC) 2022-08-27 23:54:32 -07:00
ConstantHoisting.cpp Remove redundant initialization of Optional (NFC) 2022-08-20 21:18:28 -07:00
ConstraintElimination.cpp [ConstraintElimination] Replace pair with named struct (NFC). 2022-09-06 18:04:04 +01:00
CorrelatedValuePropagation.cpp [DebugInfo] Missing debug location after replacement in processSRem function 2022-09-01 13:18:17 +01:00
DCE.cpp
DFAJumpThreading.cpp [TTI] NFC: Reduce InstructionCost::getValue() usage... 2022-08-26 16:37:32 +03:00
DeadStoreElimination.cpp Revert "[DSE] Eliminate noop store even through has clobbering between LoadI and StoreI" 2022-09-02 09:28:48 +02:00
DivRemPairs.cpp
EarlyCSE.cpp Fix build error: [FPEnv][EarlyCSE] Support for CSE when exception behavior is "ignore" or "maytrap" and the rounding mode is known. 2022-08-16 08:47:36 -04:00
FlattenCFGPass.cpp Cleanup includes: Transform/Scalar 2022-03-03 07:56:34 +01:00
Float2Int.cpp [iwyu] Fix some header include regression 2022-04-05 15:02:03 +02:00
GVN.cpp [llvm] Use range-based for loops (NFC) 2022-09-03 11:17:40 -07:00
GVNHoist.cpp [Scalar] Qualify auto in range-based for loops (NFC) 2022-08-20 21:18:25 -07:00
GVNSink.cpp Use llvm::all_equal (NFC) 2022-08-27 09:53:10 -07:00
GuardWidening.cpp [GuardWidening] Fix a nasty cast bug in c2eccc6 2022-06-07 13:27:13 -07:00
IVUsersPrinter.cpp Cleanup includes: Transform/Scalar 2022-03-03 07:56:34 +01:00
IndVarSimplify.cpp [llvm] LLVM_FALLTHROUGH => [[fallthrough]]. NFC 2022-08-08 11:24:15 -07:00
InductiveRangeCheckElimination.cpp [IRCE] Bail in case of pointer types. PR40539 2022-09-12 16:01:25 +07:00
InferAddressSpaces.cpp [NFC][Alignment] Simplify code 2022-06-10 15:25:28 +00:00
InstSimplifyPass.cpp [NFC] format InstructionSimplify & lowerCaseFunctionNames 2022-06-09 16:10:08 +02:00
JumpThreading.cpp [JumpThreading] Process range comparisions with non-local cmp instructions 2022-09-02 12:22:45 +02:00
LICM.cpp [AST] Use BatchAA in aliasesUnknownInst() (NFCI) 2022-09-09 15:54:48 +02:00
LoopAccessAnalysisPrinter.cpp Cleanup includes: Transform/Scalar 2022-03-03 07:56:34 +01:00
LoopBoundSplit.cpp Cleanup includes: DebugInfo & CodeGen 2022-03-12 17:26:40 +01:00
LoopDataPrefetch.cpp Allow data prefetch into non-default address space 2022-07-27 10:01:26 -07:00
LoopDeletion.cpp [Transforms] Qualify auto in range-based for loops (NFC) 2022-08-14 12:51:58 -07:00
LoopDistribute.cpp [Scalar] Qualify auto in range-based for loops (NFC) 2022-08-20 21:18:25 -07:00
LoopFlatten.cpp [CostModel] Replace getUserCost with getInstructionCost 2022-08-18 11:55:23 +01:00
LoopFuse.cpp Sink/hoist memory instructions between loop fusion candidates 2022-09-07 07:42:00 -04:00
LoopIdiomRecognize.cpp [AA] Make ModRefInfo a bitmask enum (NFC) 2022-08-03 10:05:55 +02:00
LoopInstSimplify.cpp Don't use Optional::hasValue (NFC) 2022-06-20 20:17:57 -07:00
LoopInterchange.cpp [LoopInterchange][PR56275] Fix legality with negative dependence vectors 2022-08-03 19:59:01 -04:00
LoopLoadElimination.cpp [LoopLoadElim] Add stores with matching sizes as load-store candidates 2022-09-02 13:11:25 +01:00
LoopPassManager.cpp [Clang] Reimplement time tracing of NewPassManager by PassInstrumentation framework 2022-09-11 05:42:55 -07:00
LoopPredication.cpp [LoopPredication] Use isSafeToExpandAt() member function (NFC) 2022-07-14 14:49:07 +02:00
LoopRerollPass.cpp [AST] Use BatchAA in aliasesUnknownInst() (NFCI) 2022-09-09 15:54:48 +02:00
LoopRotation.cpp [llvm] Don't use Optional::hasValue (NFC) 2022-06-26 18:31:51 -07:00
LoopSimplifyCFG.cpp [Transforms] Fix comment typos (NFC) 2022-08-07 23:55:24 -07:00
LoopSink.cpp [Transforms] Fix comment typos (NFC) 2022-08-07 23:55:24 -07:00
LoopStrengthReduce.cpp Use llvm::is_contained (NFC) 2022-08-27 09:53:11 -07:00
LoopUnrollAndJamPass.cpp [llvm] Use value instead of getValue (NFC) 2022-07-13 23:11:56 -07:00
LoopUnrollPass.cpp [TTI] NFC: Reduce InstructionCost::getValue() usage... 2022-08-26 16:37:32 +03:00
LoopVersioningLICM.cpp Cleanup includes: Transform/Scalar 2022-03-03 07:56:34 +01:00
LowerAtomicPass.cpp Transforms: Split LowerAtomics into separate Utils and pass 2022-04-06 20:54:45 -04:00
LowerConstantIntrinsics.cpp [llvm] Don't use Optional::hasValue (NFC) 2022-06-26 18:31:51 -07:00
LowerExpectIntrinsic.cpp [llvm] Qualify auto (NFC) 2022-08-07 23:55:27 -07:00
LowerGuardIntrinsic.cpp Check users of instrinsics instead of traversing entire function.NFC 2022-04-13 12:28:51 -04:00
LowerMatrixIntrinsics.cpp [Matrix] Use print instead of dump for matrix-print-after-transpose-opt 2022-09-02 16:12:21 -07:00
LowerWidenableCondition.cpp Check users of instrinsics instead of traversing entire function.NFC 2022-04-13 12:28:51 -04:00
MakeGuardsExplicit.cpp Cleanup includes: Transform/Scalar 2022-03-03 07:56:34 +01:00
MemCpyOptimizer.cpp [Alignment] Replace commonAlignment with std::min 2022-06-28 07:15:02 +00:00
MergeICmps.cpp Reapply [MergeICmps] Don't require GEP 2022-03-04 11:39:11 +01:00
MergedLoadStoreMotion.cpp [DebugInfo] Fix line number attribution in mldst-motion 2022-08-30 10:03:53 +01:00
NaryReassociate.cpp Revert "Use std::is_same_v instead of std::is_same (NFC)" 2022-08-20 23:00:39 -07:00
NewGVN.cpp [llvm] Use range-based for loops (NFC) 2022-09-03 11:17:40 -07:00
PartiallyInlineLibCalls.cpp Don't use Optional::hasValue (NFC) 2022-06-20 20:17:57 -07:00
PlaceSafepoints.cpp Cleanup includes: TransformsUtils 2022-03-01 21:00:07 +01:00
Reassociate.cpp [Reassociate] prevent partial undef negation replacement 2022-09-12 12:28:34 -04:00
Reg2Mem.cpp Cleanup includes: Transform/Scalar 2022-03-03 07:56:34 +01:00
RewriteStatepointsForGC.cpp [Scalar] Qualify auto in range-based for loops (NFC) 2022-08-20 21:18:25 -07:00
SCCP.cpp [SCCP] convert signed div/rem to unsigned for non-negative operands, 2nd try 2022-09-07 11:56:29 -04:00
SROA.cpp [SROA] Create additional vector type candidates based on store and load slices 2022-09-12 09:55:37 -07:00
Scalar.cpp [LegacyPM] Remove {,PostInline}EntryExitInstrumenterPass 2022-07-23 15:30:15 -07:00
ScalarizeMaskedMemIntrin.cpp Don't use Optional::hasValue (NFC) 2022-06-20 20:17:57 -07:00
Scalarizer.cpp [NFC] Switch a few uses of undef to poison as placeholders for unreachble code 2022-06-30 21:47:31 +01:00
SeparateConstOffsetFromGEP.cpp [SeparateConstOffsetFromGEP] Remove TargetMachine.h include. NFC 2022-02-25 21:40:00 -08:00
SimpleLoopUnswitch.cpp [SimpleLoopUnswitch] Skip non-trivial unswitching of cold functions 2022-09-06 19:13:31 -04:00
SimplifyCFGPass.cpp Cleanup includes: Transform/Scalar 2022-03-03 07:56:34 +01:00
Sink.cpp [Sink] Don't sink non-willreturn calls (PR51188) 2022-04-07 16:35:05 +02:00
SpeculativeExecution.cpp [CostModel] Replace getUserCost with getInstructionCost 2022-08-18 11:55:23 +01:00
StraightLineStrengthReduce.cpp [IRBuilder] Add IsInBounds parameter to CreateGEP() 2022-05-13 14:30:55 +02:00
StructurizeCFG.cpp [Scalar] Qualify auto in range-based for loops (NFC) 2022-08-20 21:18:25 -07:00
TLSVariableHoist.cpp Correct spelling error in TLS-Load-Hoist 2022-04-04 08:27:54 +08:00
TailRecursionElimination.cpp KCFI sanitizer 2022-08-24 22:41:38 +00:00
WarnMissedTransforms.cpp [llvm] Use value_or instead of getValueOr (NFC) 2022-06-18 23:07:11 -07:00