llvm-project/llvm/test/Transforms
Hans Wennborg 53a51acc36 Revert "[MemCpyOpt] Make capture check during call slot optimization more precise"
This casued a miscompile due to call slot optimization replacing a call
argument without considering the call's !noalias metadata, see discussion on
the code review.

> Call slot optimization is currently supposed to be prevented if
> the call can capture the source pointer. Due to an implementation
> bug, this check currently doesn't trigger if a bitcast of the source
> pointer is passed instead. I'm somewhat afraid of the fallout of
> fixing this bug (due to heavy reliance on call slot optimization
> in rust), so I'd like to strengthen the capture reasoning a bit first.
>
> In particular, I believe that the capture is fine as long as a)
> the call itself cannot depend on the pointer identity, because
> neither dest has been captured before/at nor src before the
> call and b) there is no potential use of the captured pointer
> before the lifetime of the source alloca ends, either due to
> lifetime.end or a return from a function. At that point the
> potentially captured pointer becomes dangling.
>
> Differential Revision: https://reviews.llvm.org/D115615

Also reverting the dependent commit:

> [MemCpyOpt] Look through pointer casts when checking capture
>
> The user scanning loop above looks through pointer casts, so we
> also need to strip pointer casts in the capture check. Previously
> the source was incorrectly considered not captured if a bitcast
> was passed to the call.

This reverts commit 487a34ed9d
and 00e6869463.
2022-01-18 17:41:49 +01:00
..
ADCE [test] Update some test cases to use -passes when specifying the pipeline 2021-09-29 21:51:08 +02:00
AddDiscriminators [test] Update some test cases to use -passes when specifying the pipeline 2021-09-29 21:51:08 +02:00
AggressiveInstCombine [test] Update some test cases to use -passes when specifying the pipeline 2021-09-29 21:51:08 +02:00
AlignmentFromAssumptions [test] Update some test cases to use -passes when specifying the pipeline 2021-09-29 21:51:08 +02:00
ArgumentPromotion [test] Update some test cases to use -passes when specifying the pipeline 2021-09-29 21:51:08 +02:00
AtomicExpand
Attributor [Attributor] Generalize calloc handling in heap-to-stack for any init value [NFC] 2022-01-12 16:58:39 -08:00
BDCE [test] Update some test cases to use -passes when specifying the pipeline 2021-09-29 21:51:08 +02:00
BlockExtractor
BranchFolding
CallSiteSplitting [llvm][test] rewrite callbr to use i rather than X constraint NFC 2022-01-11 11:31:08 -08:00
CalledValuePropagation [test] Update some test cases to use -passes when specifying the pipeline 2021-09-29 21:51:08 +02:00
CanonicalizeAliases
CanonicalizeFreezeInLoops [AArch64] Make -mcpu=generic schedule for an in-order core 2021-10-09 15:58:31 +01:00
CodeExtractor [CodeExtractor] Preserve topological order for the return blocks. 2021-08-25 08:09:01 -07:00
CodeGenPrepare Revert "[AArch64] Revive optimize add/sub with immediate through MIPeepholeOpt" 2022-01-18 13:17:02 +00:00
ConstantHoisting [RISCV] Update recently ratified Zb{a,b,c,s} extensions to no longer be experimental 2022-01-12 19:33:44 +00:00
ConstantMerge [test] Use -passes syntax when specifying pipeline in some more tests 2021-11-27 09:52:55 +01:00
ConstraintElimination [test] Use -passes syntax when specifying pipeline in some more tests 2021-11-27 09:52:55 +01:00
Coroutines [Coroutines] Handle lifetime markers, bitcast and unused instruciton for symmetric transfer 2022-01-12 15:58:38 +08:00
CorrelatedValuePropagation [LVI] Handle implication from icmp of trunc (PR51867) 2022-01-18 11:24:11 +01:00
CrossDSOCFI
DCE [test] Update some test cases to use -passes when specifying the pipeline 2021-09-29 21:51:08 +02:00
DFAJumpThreading [DFAJumpThreading] Determinator BB should precede switch-defining BB 2021-12-24 10:27:03 -05:00
DeadArgElim [test] Use opt -passes syntax in DeadArgElim lit tests. NFC 2022-01-17 18:14:36 +01:00
DeadStoreElimination [BuildLibCalls] Add nounwind,willreturn to memset_pattern{4,8,16}. 2022-01-12 10:32:53 +00:00
DivRemPairs
EarlyCSE [EarlyCSE] Support opaque pointers 2022-01-06 17:08:50 +01:00
EliminateAvailableExternally
EntryExitInstrumenter [NewPM] Use parameterized syntax for a couple of more passes 2021-08-20 14:59:21 +02:00
ExpandMemCmp [x86] split memcmp tests for 32/64-bit targets; NFC 2021-08-15 13:51:18 -04:00
FixIrreducible
Float2Int [NewPM][test] Strickly use -passes in some more lit tests 2021-10-20 17:06:47 +02:00
ForcedFunctionAttrs
FunctionAttrs [funcattrs] Infer writeonly argument attribute [part 2] 2022-01-04 09:07:54 -08:00
FunctionImport [Tests] Add elementtype attribute to indirect inline asm operands (NFC) 2022-01-06 14:23:51 +01:00
FunctionSpecialization [FuncSpec] Rename internal option. NFC. 2021-12-21 11:02:01 +00:00
GCOVProfiling
GVN Revert "[BasicAliasAnalysis] Remove isMallocOrCallocLikeFn" 2022-01-14 14:42:53 -08:00
GVNHoist PR46874: Reset stack after visiting a node 2021-08-20 11:25:05 -07:00
GVNSink
GlobalDCE [test] Use -passes syntax when specifying pipeline in some more tests 2021-11-27 09:52:55 +01:00
GlobalMerge
GlobalOpt [GlobalOpt] Generalize malloc-to-global for any allocation function 2022-01-17 15:06:23 -08:00
GlobalSplit
GuardWidening [test] Remove -loop-guard-widening legacy PM tests 2021-09-05 11:36:21 -07:00
HardwareLoops [ARM] Update test comments after D114018. NFC 2021-11-16 22:48:45 +00:00
HelloNew
HotColdSplit [CodeExtractor] Preserve topological order for the return blocks. 2021-08-25 08:09:01 -07:00
IRCE [SCEVExpander] Drop poison generating flags when reusing instructions 2021-11-29 15:23:34 -08:00
IROutliner [llvm][test] rewrite callbr to use i rather than X constraint NFC 2022-01-11 11:31:08 -08:00
IndVarSimplify [SCEV] Reenable umin_seq support and fix the `computeSCEVAtScope()` 2022-01-11 16:03:35 +03:00
IndirectBrExpand
InferAddressSpaces [InferAddressSpaces] Support assumed addrspaces from addrspace predicates. 2021-11-08 16:51:57 -05:00
InferFunctionAttrs [BuildLibCalls] Add nounwind,willreturn to memset_pattern{4,8,16}. 2022-01-12 10:32:53 +00:00
Inline [Inline] Attempt to delete any discardable if unused functions 2022-01-13 14:48:38 -08:00
InstCombine [ConstantFold] Don't fold load from non-byte-sized vector 2022-01-17 17:01:47 +01:00
InstMerge Reland "[LICM] Hoist LOAD without sinking the STORE" 2021-12-02 03:53:50 -08:00
InstNamer
InstSimplify [ConstantFold] Check for uniform value before reinterpret load 2022-01-14 10:18:02 +01:00
InterleavedAccess [AArch64][SVE] Add FP types to the supported SVE structure load/stores vector type list 2021-11-08 22:29:08 +08:00
Internalize
JumpThreading [JumpThreading] Change asserts for WantInteger into actual checks 2022-01-14 11:15:14 -08:00
LCSSA
LICM [llvm][test] rewrite callbr to use i rather than X constraint NFC 2022-01-11 11:31:08 -08:00
LoadStoreVectorizer [LoadStoreVectorizer] Check for guaranteed-to-transfer (PR52950) 2022-01-03 10:55:47 +01:00
LoopBoundSplit [LoopBoundSplit] Handle the case in which exiting block is loop header 2021-10-08 09:13:41 +01:00
LoopDataPrefetch [LoopDataPrefetch] Add missed LoopSimplify dependence for prefetch pass 2021-08-26 21:01:59 +08:00
LoopDeletion [LoopDeletion] Revert 3af8a11 and add test coverage for breakage 2022-01-17 11:44:03 -08:00
LoopDistribute [IRBuilder] Introduce folder using inst-simplify, use for Or fold. 2022-01-11 17:30:48 +00:00
LoopFlatten [LoopFlatten] Bail if we can't perform flattening after IV widening 2021-09-29 19:53:34 +01:00
LoopFusion
LoopIdiom [RISCV] Update recently ratified Zb{a,b,c,s} extensions to no longer be experimental 2022-01-12 19:33:44 +00:00
LoopInstSimplify
LoopInterchange [LoopInterchange] Enable interchange with multiple inner loop indvars 2022-01-14 16:28:41 -05:00
LoopLoadElim [LAA] Remove overeager assertion for aggregate types. 2022-01-04 15:20:35 +00:00
LoopPredication [SCEVExpander] Drop poison generating flags when reusing instructions 2021-11-29 15:23:34 -08:00
LoopReroll
LoopRotate [llvm][test] rewrite callbr to use i rather than X constraint NFC 2022-01-11 11:31:08 -08:00
LoopSimplify [test] Fixup tests with -analyze in llvm/test/Transforms 2021-09-04 16:45:51 -07:00
LoopSimplifyCFG [Tests] Remove explicit -enable-mssa-loop-dependency options (NFC) 2021-08-14 21:21:07 +02:00
LoopStrengthReduce [LSR] Fix crash in Phi node with EHPad block 2022-01-14 18:53:18 -08:00
LoopTransformWarning
LoopUnroll [llvm][test] rewrite callbr to use i rather than X constraint NFC 2022-01-11 11:31:08 -08:00
LoopUnrollAndJam [LoopUnroll] Disable loop unroll when user explicitly asks for unroll-and-jam 2021-12-15 15:58:05 +00:00
LoopUnswitch [llvm][test] rewrite callbr to use i rather than X constraint NFC 2022-01-11 11:31:08 -08:00
LoopVectorize [LoopVectorize][AArch64] Use get.active.lane.mask intrinsic when SVE is enabled 2022-01-18 11:59:30 +00:00
LoopVersioning [LoopUtils] Use InstSimplifyFolder in addRuntimeChecks. 2022-01-15 15:21:16 +00:00
LoopVersioningLICM [opt] Directly translate -O# to -passes='default<O#>' 2021-10-18 16:48:10 -07:00
LowerAtomic
LowerConstantIntrinsics [LowerConstantIntrinsics] Fix heap-use-after-free bug in worklist 2021-09-21 11:33:07 +02:00
LowerExpectIntrinsic
LowerGuardIntrinsic
LowerInvoke
LowerMatrixIntrinsics [Tests] Fix incorrect noalias metadata 2021-09-18 20:51:00 +02:00
LowerSwitch
LowerTypeTests [llvm][IR] Add no_cfi constant 2021-12-20 12:55:32 -08:00
LowerWidenableCondition
MakeGuardsExplicit
Mem2Reg [NFC][llvm] Inclusive language: reword uses of sanity test and check 2021-11-25 07:21:42 -05:00
MemCpyOpt Revert "[MemCpyOpt] Make capture check during call slot optimization more precise" 2022-01-18 17:41:49 +01:00
MergeFunc [opt] Directly translate -O# to -passes='default<O#>' 2021-10-18 16:48:10 -07:00
MergeICmps [MergeICmps] Don't reorder unmerged comparisons 2021-09-21 21:22:12 +02:00
MetaRenamer [MetaRenamer] Add command line options to disable renaming name with specified prefixes 2021-12-09 18:45:06 +07:00
NameAnonGlobals
NaryReassociate [NARY-REASSOCIATE] Fix infinite recursion optimizing min\max 2021-10-20 14:23:03 +07:00
NewGVN [NFC] Pre-commit NewGVN tests for wrong phi(undef, X) optimization 2021-12-30 15:45:20 +00:00
ObjCARC [ObjC][ARC] Handle operand bundle "clang.arc.attachedcall" on targets 2021-11-08 18:38:39 -08:00
OpenMP Reapply "[OpenMP][NFCI] Embed the source location string size in the ident_t" 2021-12-29 01:10:38 -06:00
PGOProfile [llvm][test] rewrite callbr to use i rather than X constraint NFC 2022-01-11 11:31:08 -08:00
PartialInlining
PartiallyInlineLibCalls [PartiallyInlineLibCalls] Don't crash when there's a writeonly attribute on the call 2022-01-05 12:16:26 +01:00
PhaseOrdering [Support] improve known bits analysis for leading zeros of multiply 2021-12-20 09:10:50 -05:00
PlaceSafepoints
PreISelIntrinsicLowering [ObjC][ARC] Replace uses of ObjC intrinsics that are arguments of 2021-11-08 21:19:07 -08:00
PruneEH
Reassociate [InstCombine] Simplify addends reordering logic 2022-01-18 16:00:47 +03:00
Reg2Mem [test] Update some test cases to use -passes when specifying the pipeline 2021-09-29 21:51:08 +02:00
RelLookupTableConverter/X86 [Passes] Fix relative lookup table converter pass 2021-12-12 04:40:17 +00:00
RewriteStatepointsForGC [LLVM] Inclusive terms: remove/replace references to sanity in RewriteStatepointsForGC.cpp and test 2021-10-25 16:17:41 -04:00
SCCP [ConstantFold] Remove unnecessary bounded index restriction 2022-01-04 15:23:09 +01:00
SLPVectorizer [LoopVectorize] Pass a vector type to isLegalMaskedGather/Scatter 2022-01-12 13:34:12 +00:00
SROA [SROA] Bail out on PHIs in catchswitch BBs 2022-01-14 14:55:07 -08:00
SafeStack
SampleProfile [CSSPGO] Use nested context-sensitive profile. 2021-12-14 14:40:25 -08:00
ScalarizeMaskedMemIntrin
Scalarizer [Scalarizer] Do not insert instructions between PHI nodes and debug intrinsics. 2021-11-02 09:53:59 -04:00
SeparateConstOffsetFromGEP SeparateConstOffsetFromGEP: Fix stack overflow in unreachable code 2021-09-14 19:49:38 -04:00
SimpleLoopUnswitch [llvm][test] rewrite callbr to use i rather than X constraint NFC 2022-01-11 11:31:08 -08:00
SimplifyCFG [SimplifyCFG] Fix assertion failure when reusing table switch comparison 2022-01-18 09:30:54 +01:00
Sink
SpeculativeExecution [NewPM][test] Use -passes syntax in SpeculativeExecution lit tests 2021-10-20 15:16:17 +02:00
StraightLineStrengthReduce
StripDeadPrototypes [NewPM][test] Strickly use -passes in some more lit tests 2021-10-20 17:06:47 +02:00
StripSymbols [NewPM][test] Strickly use -passes in some more lit tests 2021-10-20 17:06:47 +02:00
StructurizeCFG
SyntheticCountsPropagation
TailCallElim [test] Use -passes syntax when specifying pipeline in some more tests 2021-11-27 09:52:55 +01:00
ThinLTOBitcodeWriter [ThinLTO][MC] Use conditional assignments for promotion aliases 2021-12-10 12:21:37 -08:00
TypePromotion/ARM [TypePromotion] Extend TypePromotion::isSafeWrap 2021-11-14 11:18:31 +00:00
UnifyFunctionExitNodes
UnifyLoopExits
Util [NewPM] Port FlattenCFGPass to NPM 2021-12-09 07:55:02 +00:00
VectorCombine [VectorCombine] fold shuffle-of-binops with common operand 2021-10-21 12:37:54 -04:00
WholeProgramDevirt [LTO][WPD] Ignore unreachable function by analyzing IR. 2021-12-21 18:13:03 +00:00