1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-24 03:33:20 +01:00
llvm-mirror/test/Transforms
Alina Sbirlea 029d974b53 Generalize MergeBlockIntoPredecessor. Replace uses of MergeBasicBlockIntoOnlyPred.
Summary:
Two utils methods have essentially the same functionality. This is an attempt to merge them into one.
1. lib/Transforms/Utils/Local.cpp : MergeBasicBlockIntoOnlyPred
2. lib/Transforms/Utils/BasicBlockUtils.cpp : MergeBlockIntoPredecessor

Prior to the patch:
1. MergeBasicBlockIntoOnlyPred
Updates either DomTree or DeferredDominance
Moves all instructions from Pred to BB, deletes Pred
Asserts BB has single predecessor
If address was taken, replace the block address with constant 1 (?)

2. MergeBlockIntoPredecessor
Updates DomTree, LoopInfo and MemoryDependenceResults
Moves all instruction from BB to Pred, deletes BB
Returns if doesn't have a single predecessor
Returns if BB's address was taken

After the patch:
Method 2. MergeBlockIntoPredecessor is attempting to become the new default:
Updates DomTree or DeferredDominance, and LoopInfo and MemoryDependenceResults
Moves all instruction from BB to Pred, deletes BB
Returns if doesn't have a single predecessor
Returns if BB's address was taken

Uses of MergeBasicBlockIntoOnlyPred that need to be replaced:

1. lib/Transforms/Scalar/LoopSimplifyCFG.cpp
Updated in this patch. No challenges.

2. lib/CodeGen/CodeGenPrepare.cpp
Updated in this patch.
  i. eliminateFallThrough is straightforward, but I added using a temporary array to avoid the iterator invalidation.
  ii. eliminateMostlyEmptyBlock(s) methods also now use a temporary array for blocks
Some interesting aspects:
  - Since Pred is not deleted (BB is), the entry block does not need updating.
  - The entry block was being updated with the deleted block in eliminateMostlyEmptyBlock. Added assert to make obvious that BB=SinglePred.
  - isMergingEmptyBlockProfitable assumes BB is the one to be deleted.
  - eliminateMostlyEmptyBlock(BB) does not delete BB on one path, it deletes its unique predecessor instead.
  - adding some test owner as subscribers for the interesting tests modified:
    test/CodeGen/X86/avx-cmp.ll
    test/CodeGen/AMDGPU/nested-loop-conditions.ll
    test/CodeGen/AMDGPU/si-annotate-cf.ll
    test/CodeGen/X86/hoist-spill.ll
    test/CodeGen/X86/2006-11-17-IllegalMove.ll

3. lib/Transforms/Scalar/JumpThreading.cpp
Not covered in this patch. It is the only use case using the DeferredDominance.
I would defer to Brian Rzycki to make this replacement.

Reviewers: chandlerc, spatel, davide, brzycki, bkramer, javed.absar

Subscribers: qcolombet, sanjoy, nemanjai, nhaehnle, jlebar, tpr, kbarton, RKSimon, wmi, arsenm, llvm-commits

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

llvm-svn: 335183
2018-06-20 22:01:04 +00:00
..
ADCE [DebugInfo] Add DILabel metadata and intrinsic llvm.dbg.label. 2018-05-09 02:40:45 +00:00
AddDiscriminators [DebugInfo] Add DILabel metadata and intrinsic llvm.dbg.label. 2018-05-09 02:40:45 +00:00
AggressiveInstCombine [AggressiveInstCombine] avoid crashing on unsimplified code (PR37446) 2018-05-14 13:43:32 +00:00
AlignmentFromAssumptions
ArgumentPromotion
AtomicExpand
BDCE [DebugInfo] Add DILabel metadata and intrinsic llvm.dbg.label. 2018-05-09 02:40:45 +00:00
BlockExtractor
BranchFolding
CalledValuePropagation
CallSiteSplitting
CodeExtractor [CodeExtractor] Allow extracting blocks with exception handling 2018-05-11 22:49:49 +00:00
CodeGenPrepare Generalize MergeBlockIntoPredecessor. Replace uses of MergeBasicBlockIntoOnlyPred. 2018-06-20 22:01:04 +00:00
ConstantHoisting [DebugInfo] Add DILabel metadata and intrinsic llvm.dbg.label. 2018-05-09 02:40:45 +00:00
ConstantMerge
ConstProp Make uitofp and sitofp defined on overflow. 2018-06-14 22:58:48 +00:00
Coroutines [Coroutines] PR34897: Fix incorrect elisions 2018-05-11 03:12:28 +00:00
CorrelatedValuePropagation [ValueTracking] Fix endless recursion in isKnownNonZero() 2018-05-30 15:56:46 +00:00
CrossDSOCFI
DCE
DeadArgElim [DebugInfo] Add DILabel metadata and intrinsic llvm.dbg.label. 2018-05-09 02:40:45 +00:00
DeadStoreElimination [Debugify] Move debug value intrinsics closer to their operand defs 2018-06-06 19:05:42 +00:00
DivRemPairs
EarlyCSE [EarlyCSE] Propagate conditions of AND and OR instructions 2018-06-14 13:02:13 +00:00
EliminateAvailableExternally
EntryExitInstrumenter [DebugInfo] Add DILabel metadata and intrinsic llvm.dbg.label. 2018-05-09 02:40:45 +00:00
ExpandMemCmp/X86
Float2Int
ForcedFunctionAttrs
FunctionAttrs [CaptureTracking] Handle capturing of launder.invariant.group 2018-05-05 10:23:27 +00:00
FunctionImport [DebugInfo] Add DILabel metadata and intrinsic llvm.dbg.label. 2018-05-09 02:40:45 +00:00
GCOVProfiling [DebugInfo] Add DILabel metadata and intrinsic llvm.dbg.label. 2018-05-09 02:40:45 +00:00
GlobalDCE
GlobalMerge [GlobalMerge] Set the alignment on merged global structs 2018-06-06 14:48:32 +00:00
GlobalOpt Fix evaluator for non-zero alloca addr space 2018-05-19 02:58:16 +00:00
GlobalSplit
GuardWidening [LoopGuardWidening] Make PostDomTree optional 2018-04-27 23:15:56 +00:00
GVN [Debugify] Move debug value intrinsics closer to their operand defs 2018-06-06 19:05:42 +00:00
GVNHoist [DebugInfo] Add DILabel metadata and intrinsic llvm.dbg.label. 2018-05-09 02:40:45 +00:00
GVNSink
IndirectBrExpand
IndVarSimplify [SimplifyIndVars] Eliminate redundant truncs 2018-06-19 04:48:34 +00:00
InferAddressSpaces
InferFunctionAttrs [SimplifyLibcalls] Replace locked IO with unlocked IO 2018-05-16 11:39:52 +00:00
Inline Fix aliasing of launder.invariant.group 2018-05-23 09:16:44 +00:00
InstCombine [InstCombine] fix typo in test comment; NFC 2018-06-20 20:16:45 +00:00
InstMerge [MergedLoadStoreMotion] Fix a debug invariant bug in mergeStores 2018-05-09 06:52:12 +00:00
InstNamer
InstSimplify [InstSimplify] Fix missed optimization in simplifyUnsignedRangeCheck() 2018-06-20 14:22:49 +00:00
InterleavedAccess
Internalize
IPConstantProp Revert r333740: IPSCCP] Use PredicateInfo to propagate facts from cmp. 2018-06-01 12:58:43 +00:00
IRCE [IRCE] Fix miscompile with range checks against negative values 2018-05-19 13:06:37 +00:00
JumpThreading Fix the issue that ComputeValueKnownInPredecessors only handles the case when 2018-05-01 14:47:24 +00:00
LCSSA [Debugify] Set a DI version module flag for llc compatibility 2018-05-24 23:00:23 +00:00
LICM [MustExecute] Fix a debug invariant issue in isGuaranteedToExecute() 2018-05-25 13:02:59 +00:00
LoadStoreVectorizer [AMDGPU] Re-enabled 128bit wide-vector generation for local addr space by default. 2018-05-28 18:15:11 +00:00
LoopDataPrefetch [DebugInfo] Add DILabel metadata and intrinsic llvm.dbg.label. 2018-05-09 02:40:45 +00:00
LoopDeletion
LoopDistribute [DebugInfo] Add DILabel metadata and intrinsic llvm.dbg.label. 2018-05-09 02:40:45 +00:00
LoopIdiom [ValueTracking] Match select abs pattern when there's an sext involved 2018-06-04 16:53:57 +00:00
LoopInstSimplify [LoopInstSimplify] Re-implement the core logic of loop-instsimplify to 2018-05-29 20:15:38 +00:00
LoopInterchange [DebugInfo] Add DILabel metadata and intrinsic llvm.dbg.label. 2018-05-09 02:40:45 +00:00
LoopLoadElim
LoopPredication
LoopReroll [DebugInfo] Add DILabel metadata and intrinsic llvm.dbg.label. 2018-05-09 02:40:45 +00:00
LoopRotate [DebugInfo] Add DILabel metadata and intrinsic llvm.dbg.label. 2018-05-09 02:40:45 +00:00
LoopSimplify [DebugInfo] Add DILabel metadata and intrinsic llvm.dbg.label. 2018-05-09 02:40:45 +00:00
LoopSimplifyCFG Generalize MergeBlockIntoPredecessor. Replace uses of MergeBasicBlockIntoOnlyPred. 2018-06-20 22:01:04 +00:00
LoopStrengthReduce Generalize MergeBlockIntoPredecessor. Replace uses of MergeBasicBlockIntoOnlyPred. 2018-06-20 22:01:04 +00:00
LoopUnroll [DebugInfo] Add DILabel metadata and intrinsic llvm.dbg.label. 2018-05-09 02:40:45 +00:00
LoopUnswitch [LoopUnswitch] Fix SCEV invalidation in unswitching 2018-05-23 10:09:53 +00:00
LoopVectorize Move redundant-vf2-cost.ll test to X86 directory 2018-06-15 18:46:03 +00:00
LoopVersioning [LoopVersioning] Don't modify the list that we iterate over in addPHINodes 2018-05-22 08:33:02 +00:00
LoopVersioningLICM
LowerAtomic
LowerExpectIntrinsic
LowerGuardIntrinsic
LowerInvoke
LowerSwitch
LowerTypeTests In thin and full LTO + CFI, direct function calls may go through jump table 2018-06-04 18:18:12 +00:00
Mem2Reg Re-apply "[DebugInfo] Check size of variable in ConvertDebugDeclareToDebugValue" 2018-06-15 13:48:55 +00:00
MemCpyOpt
MergeFunc [MergeFunctions] Fix merging of small weak functions 2018-05-15 11:31:07 +00:00
MergeICmps [MergeICmps] Don't crash when memcmp is not available 2018-05-19 12:51:59 +00:00
MetaRenamer
NameAnonGlobals
NaryReassociate [NaryReassociate] Detect deleted instr with WeakVH 2018-05-24 06:09:02 +00:00
NewGVN [NewGVN] Fix handling of assumes 2018-05-22 17:38:22 +00:00
ObjCARC [ObjCARC] Prevent code motion into a catchswitch 2018-05-16 04:52:18 +00:00
PartiallyInlineLibCalls
PGOProfile
PhaseOrdering [PhaseOrdering] remove stale comments; NFC 2018-05-09 23:10:46 +00:00
PlaceSafepoints
PreISelIntrinsicLowering
PruneEH
Reassociate [Reassociate] Prevent infinite loops when processing PHIs. 2018-05-11 15:45:36 +00:00
Reg2Mem
RewriteStatepointsForGC
SafeStack [DebugInfo] Add DILabel metadata and intrinsic llvm.dbg.label. 2018-05-09 02:40:45 +00:00
SampleProfile [SampleFDO] Add a new compact binary format for sample profile. 2018-06-11 22:40:43 +00:00
Scalarizer [DebugInfo] Add DILabel metadata and intrinsic llvm.dbg.label. 2018-05-09 02:40:45 +00:00
SCCP Revert r333268: [IPSCCP] Use PredicateInfo to propagate facts from... 2018-05-25 23:32:02 +00:00
SeparateConstOffsetFromGEP [Split GEP] handle trunc() in separate-const-offset-from-gep pass. 2018-05-11 21:13:19 +00:00
SimpleLoopUnswitch Generalize MergeBlockIntoPredecessor. Replace uses of MergeBasicBlockIntoOnlyPred. 2018-06-20 22:01:04 +00:00
SimplifyCFG Revert "Simplify blockaddress usage before giving up in MergeBlockIntoPredecessor" 2018-06-18 23:20:08 +00:00
Sink
SLPVectorizer [SLPVectorizer] Relax "alternate" opcode vectorisation to work with any SK_Select shuffle pattern 2018-06-20 14:26:28 +00:00
SpeculateAroundPHIs
SpeculativeExecution
SROA [SROA] Handle PHI with multiple duplicate predecessors 2018-05-17 07:21:41 +00:00
StraightLineStrengthReduce
StripDeadPrototypes
StripSymbols
StructurizeCFG StructurizeCFG: Adjust the loop depth for a subregion to order the nodes correctly 2018-05-23 18:34:48 +00:00
SyntheticCountsPropagation
TailCallElim [DebugInfo] Add DILabel metadata and intrinsic llvm.dbg.label. 2018-05-09 02:40:45 +00:00
ThinLTOBitcodeWriter [ThinLTOBitcodeWriter] Emit summaries for regular LTO modules 2018-06-01 15:20:47 +00:00
Util [PredicateInfo] Order instructions in different BBs by DFSNumIn. 2018-06-20 17:42:01 +00:00
WholeProgramDevirt