llvm-project/llvm/lib/Transforms/Scalar
Congzhe Cao 75b33d6bd5 [LoopInterchange] Check phis in all subloops
This is the bugfix to the miscompile mentioned in
https://reviews.llvm.org/D132055#3814831. The IR
that reproduced the bug is added as the test case in
this patch.

What this patch does is that, during legality phase
instead of checking the phi nodes only in `InnerLoop`
and `OuterLoop`, we check phi nodes in all subloops
of the `OuterLoop`. Suppose if the loop nest is triply
nested, and `InnerLoop` and `OuterLoop` is the middle
loop and the outermost loop respectively, we'll check
phi nodes in the innermost loop as well, in addition to
the ones in the middle and outermost loops.

Reviewed By: Meinersbur, #loopoptwg

Differential Revision: https://reviews.llvm.org/D134930
2022-11-04 00:20:52 -04:00
..
ADCE.cpp [Scalar] Qualify auto in range-based for loops (NFC) 2022-08-20 21:18:25 -07:00
AlignmentFromAssumptions.cpp
AnnotationRemarks.cpp
BDCE.cpp
CMakeLists.txt Revert "Remove PlaceSafepoints pass" 2022-10-13 07:17:25 -07: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 [ConstraintElim] Drop bail out for scalable vectors after using getTrue 2022-11-03 19:05:45 +00:00
CorrelatedValuePropagation.cpp [CVP] Simplify comparisons without constant operand 2022-11-03 15:35:27 +01:00
DCE.cpp
DFAJumpThreading.cpp [llvm] Use llvm::find (NFC) 2022-10-16 16:21:00 -07:00
DeadStoreElimination.cpp Revert "[DSE] Eliminate noop store even through has clobbering between LoadI and StoreI" 2022-10-06 10:36:02 -07:00
DivRemPairs.cpp
EarlyCSE.cpp [Coroutines] Don't merge readnone calls in presplit coroutines 2022-10-17 10:22:43 +08:00
FlattenCFGPass.cpp
Float2Int.cpp
GVN.cpp [Coroutines] Don't merge readnone calls in presplit coroutines 2022-10-17 10:22:43 +08: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: Pass through AssumptionCache (NFC) 2022-09-26 14:53:00 -04:00
IVUsersPrinter.cpp
IndVarSimplify.cpp [IndVarSimplify] Clear block and loop dispositions after moving instr. 2022-10-18 16:18:14 +01:00
InductiveRangeCheckElimination.cpp [IRCE] Bail in case of pointer types. PR40539 2022-09-12 16:01:25 +07:00
InferAddressSpaces.cpp [DebugInfo][InferAddressSpaces] Propagate DebugLoc when cloning an instruction in InferAddressSpaces 2022-09-29 08:43:37 +00:00
InstSimplifyPass.cpp [NFC] format InstructionSimplify & lowerCaseFunctionNames 2022-06-09 16:10:08 +02:00
JumpThreading.cpp [JumpThreading] Put a limit on the PHI nodes when duplicating a BB. 2022-10-31 15:51:56 -07:00
LICM.cpp [AliasAnalysis] Introduce getModRefInfoMask() as a generalization of pointsToConstantMemory(). 2022-10-31 13:03:41 -07:00
LoopAccessAnalysisPrinter.cpp [LAA] Change to function analysis for new PM. 2022-10-01 15:44:27 +01:00
LoopBoundSplit.cpp
LoopDataPrefetch.cpp Allow data prefetch into non-default address space 2022-07-27 10:01:26 -07:00
LoopDeletion.cpp [Loop] Move block and loop dispo invalidation to makeLoopInvariant. 2022-10-14 21:58:14 +01:00
LoopDistribute.cpp [LAA] Pass LoopAccessInfoManager instead of GetLAA function. 2022-10-04 11:51:25 +01:00
LoopFlatten.cpp Revert "Recommit "[LoopFlatten] Enable it by default"" 2022-10-18 23:36:36 +05:30
LoopFuse.cpp [LoopFuse] Ensure loops are in loop simplified form under new PM 2022-10-31 11:46:28 -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] Check phis in all subloops 2022-11-04 00:20:52 -04:00
LoopLoadElimination.cpp [LoopVersioning,LLE] Clear LoopAccessInfoManager after making changes. 2022-10-04 21:35:42 +01:00
LoopPassManager.cpp [LoopPassManager] Ensure to construct loop nests with the outermost loop 2022-09-21 23:59:26 -04:00
LoopPredication.cpp [LoopPredication][NFCI] Perform 'visited' check before pushing to worklist 2022-11-02 18:04:23 +07: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 [LoopSimplifyCFG] Forget loop and block dispos after merging blocks. 2022-10-20 11:23:29 +01:00
LoopSink.cpp Recommit "[SCEV] Support clearing Block/LoopDispositions for a single value." 2022-10-07 20:15:44 +01:00
LoopStrengthReduce.cpp [LSR] Drop LSR solution if it is less profitable than baseline 2022-10-27 10:13:57 -07:00
LoopUnrollAndJamPass.cpp LoopUnroll: Pass through AssumptionCache (NFC) 2022-09-26 14:52:59 -04:00
LoopUnrollPass.cpp LoopUnroll: Pass through AssumptionCache (NFC) 2022-09-26 14:52:59 -04:00
LoopVersioningLICM.cpp [LAA] Pass LoopAccessInfoManager instead of GetLAA function. 2022-10-04 11:51:25 +01:00
LowerAtomicPass.cpp
LowerConstantIntrinsics.cpp [llvm] Don't use Optional::hasValue (NFC) 2022-06-26 18:31:51 -07:00
LowerExpectIntrinsic.cpp [iwyu] Move <cmath> out of llvm/Support/MathExtras.h 2022-09-28 20:49:01 +02:00
LowerGuardIntrinsic.cpp
LowerMatrixIntrinsics.cpp [iwyu] Move <cmath> out of llvm/Support/MathExtras.h 2022-09-28 20:49:01 +02:00
LowerWidenableCondition.cpp
MakeGuardsExplicit.cpp
MemCpyOptimizer.cpp [MemCpyOpt] Add additional debug output (NFC) 2022-10-13 17:03:44 +02:00
MergeICmps.cpp [BuildLibCalls] Use TLI to get 'int' and 'size_t' type sizes 2022-10-04 12:52:05 +02: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 [Coroutines] Don't merge readnone calls in presplit coroutines 2022-10-17 10:22:43 +08:00
PartiallyInlineLibCalls.cpp Don't use Optional::hasValue (NFC) 2022-06-20 20:17:57 -07:00
PlaceSafepoints.cpp Revert "Remove PlaceSafepoints pass" 2022-10-13 07:17:25 -07:00
Reassociate.cpp [Reassociate] prevent partial undef negation replacement 2022-09-12 12:28:34 -04:00
Reg2Mem.cpp
RewriteStatepointsForGC.cpp [Scalar] Qualify auto in range-based for loops (NFC) 2022-08-20 21:18:25 -07:00
SCCP.cpp [SCCP] remove unnecessary check for constant when folding sext->zext 2022-09-30 17:26:10 -04:00
SROA.cpp [SROA] Don't speculate phis with different load user types 2022-10-18 08:44:13 -07:00
Scalar.cpp Revert "Remove PlaceSafepoints pass" 2022-10-13 07:17:25 -07:00
ScalarizeMaskedMemIntrin.cpp Don't use Optional::hasValue (NFC) 2022-06-20 20:17:57 -07:00
Scalarizer.cpp [NFC] Fixed several misspellings of "Splitter" in Scalarizer 2022-10-22 15:13:56 +02:00
SeparateConstOffsetFromGEP.cpp
SimpleLoopUnswitch.cpp [SimpleLoopUnswitch] Forget block and loop dispositions. 2022-10-30 20:44:22 +00:00
SimplifyCFGPass.cpp Revert "reland e5581df60a [SimplifyCFG] accumulate bonus insts cost" 2022-10-25 12:15:39 -04:00
Sink.cpp [Sink] Allow sinking of invariant loads across critical edges 2022-10-06 09:21:12 +09:00
SpeculativeExecution.cpp [CostModel] Replace getUserCost with getInstructionCost 2022-08-18 11:55:23 +01:00
StraightLineStrengthReduce.cpp
StructurizeCFG.cpp [StructurizeCFG][DebugInfo] Maintain DILocations in the branches created by StructurizeCFG 2022-10-28 02:51:02 -05:00
TLSVariableHoist.cpp
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