llvm-project/llvm/lib/Transforms/Scalar
Kazu Hirata 53b68e676f Resubmit: [JumpThreading] Thread jumps through two basic blocks
This reverts commit 2d258ed931.  This
revision fixes the Windows build and adds a testcase for it, namely
thread-two-bbs3.ll.  My original patch improperly copied EH pads on
Windows.  This patch disregards jump threading opportunities having to
do with EH pads.

[JumpThreading] Thread jumps through two basic blocks

Summary:
This patch teaches JumpThreading.cpp to thread through two basic
blocks like:

  bb3:
    %var = phi i32* [ null, %bb1 ], [ @a, %bb2 ]
    %tobool = icmp eq i32 %cond, 0
    br i1 %tobool, label %bb4, label ...

  bb4:
    %cmp = icmp eq i32* %var, null
    br i1 %cmp, label bb5, label bb6

by duplicating basic blocks like bb3 above.  Once we duplicate bb3 as
bb3.dup and redirect edge bb2->bb3 to bb2->bb3.dup, we have:

  bb3:
    %var = phi i32* [ @a, %bb2 ]
    %tobool = icmp eq i32 %cond, 0
    br i1 %tobool, label %bb4, label ...

  bb3.dup:
    %var = phi i32* [ null, %bb1 ]
    %tobool = icmp eq i32 %cond, 0
    br i1 %tobool, label %bb4, label ...

  bb4:
    %cmp = icmp eq i32* %var, null
    br i1 %cmp, label bb5, label bb6

Then the existing code in JumpThreading.cpp can thread edge
bb3.dup->bb4 through bb4 and eventually create bb3.dup->bb5.

Reviewers: wmi

Subscribers: hiraditya, jfb, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D70247
2020-01-16 12:33:37 -08:00
..
ADCE.cpp Sink all InitializePasses.h includes 2019-11-13 16:34:37 -08:00
AlignmentFromAssumptions.cpp Sink all InitializePasses.h includes 2019-11-13 16:34:37 -08:00
BDCE.cpp Clang-trunk Generates Wrong Debug values with -O1 2019-11-21 13:53:10 -08:00
CMakeLists.txt [Matrix] Add first set of matrix intrinsics and initial lowering pass. 2019-12-12 15:42:18 +00:00
CallSiteSplitting.cpp Add missing includes needed to prune LLVMContext.h include, NFC 2019-11-14 15:23:15 -08:00
ConstantHoisting.cpp [ConstantHoisting] Ignore unreachable bb:s when collecting candidates 2019-12-19 15:07:55 +01:00
ConstantProp.cpp Sink all InitializePasses.h includes 2019-11-13 16:34:37 -08:00
CorrelatedValuePropagation.cpp Sink all InitializePasses.h includes 2019-11-13 16:34:37 -08:00
DCE.cpp [BasicBlockUtils] Add utility to remove redundant dbg.value instrs 2019-12-16 11:41:21 +01:00
DeadStoreElimination.cpp DSE: fix bug where we would only check libcalls for name rather than whole decl 2020-01-11 11:57:29 +00:00
DivRemPairs.cpp Sink all InitializePasses.h includes 2019-11-13 16:34:37 -08:00
EarlyCSE.cpp [DebugInfo][EarlyCSE] Use the salvageDebugInfoOrMarkUndef(); NFC 2019-12-09 13:57:35 +01:00
FlattenCFGPass.cpp Sink all InitializePasses.h includes 2019-11-13 16:34:37 -08:00
Float2Int.cpp Add missing includes needed to prune LLVMContext.h include, NFC 2019-11-14 15:23:15 -08:00
GVN.cpp [GVN] introduce GVNOptions to control GVN pass behavior 2020-01-16 20:21:08 +03:00
GVNHoist.cpp [MemorySSA] Moving at the end often means before terminator. 2019-11-20 17:11:00 -08:00
GVNSink.cpp Sink all InitializePasses.h includes 2019-11-13 16:34:37 -08:00
GuardWidening.cpp Broaden the definition of a "widenable branch" 2019-11-21 10:46:16 -08:00
IVUsersPrinter.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
IndVarSimplify.cpp [NFC][IndVarSimplify] remove duplicate code in widenWithVariantLoadUseCodegen. 2020-01-15 16:27:58 -05:00
InductiveRangeCheckElimination.cpp Revert "[SCEV] Move ScalarEvolutionExpander.cpp to Transforms/Utils (NFC)." 2020-01-04 18:44:38 +00:00
InferAddressSpaces.cpp Resubmit "[Alignment][NFC] Deprecate CreateMemCpy/CreateMemMove" 2019-12-17 10:07:46 +01:00
InstSimplifyPass.cpp Sink all InitializePasses.h includes 2019-11-13 16:34:37 -08:00
JumpThreading.cpp Resubmit: [JumpThreading] Thread jumps through two basic blocks 2020-01-16 12:33:37 -08:00
LICM.cpp [MemorySSA] Moving at the end often means before terminator. 2019-11-20 17:11:00 -08:00
LLVMBuild.txt Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
LoopAccessAnalysisPrinter.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
LoopDataPrefetch.cpp Revert "[SCEV] Move ScalarEvolutionExpander.cpp to Transforms/Utils (NFC)." 2020-01-04 18:44:38 +00:00
LoopDeletion.cpp Sink all InitializePasses.h includes 2019-11-13 16:34:37 -08:00
LoopDistribute.cpp Sink all InitializePasses.h includes 2019-11-13 16:34:37 -08:00
LoopFuse.cpp [NFC][LoopFusion] Fix printing of the guard branch. 2019-12-26 02:45:29 +00:00
LoopIdiomRecognize.cpp Revert "[SCEV] Move ScalarEvolutionExpander.cpp to Transforms/Utils (NFC)." 2020-01-04 18:44:38 +00:00
LoopInstSimplify.cpp [LoopInstSimplify] Move MemorySSA verification under flag. 2019-11-21 17:01:24 -08:00
LoopInterchange.cpp [LoopInterchange] Improve inner exit loop safety checks. 2019-12-04 17:46:01 +00:00
LoopLoadElimination.cpp Revert "[SCEV] Move ScalarEvolutionExpander.cpp to Transforms/Utils (NFC)." 2020-01-04 18:44:38 +00:00
LoopPassManager.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
LoopPredication.cpp [BasicBlock] add helper getPostdominatingDeoptimizeCall 2020-01-16 01:15:57 +03:00
LoopRerollPass.cpp Revert "[SCEV] Move ScalarEvolutionExpander.cpp to Transforms/Utils (NFC)." 2020-01-04 18:44:38 +00:00
LoopRotation.cpp Add missing includes needed to prune LLVMContext.h include, NFC 2019-11-14 15:23:15 -08:00
LoopSimplifyCFG.cpp [MemorySSA] Update analysis when the terminator is a memory instruction. 2019-11-20 16:36:52 -08:00
LoopSink.cpp Sink all InitializePasses.h includes 2019-11-13 16:34:37 -08:00
LoopStrengthReduce.cpp Revert "[SCEV] Move ScalarEvolutionExpander.cpp to Transforms/Utils (NFC)." 2020-01-04 18:44:38 +00:00
LoopUnrollAndJamPass.cpp [NFCI][LoopUnrollAndJam] Changing LoopUnrollAndJamPass to a function 2020-01-09 16:18:36 +00:00
LoopUnrollPass.cpp Revert "[Loop Peeling] Add possibility to enable peeling on loop nests." 2020-01-16 10:33:38 -08:00
LoopUnswitch.cpp Sink all InitializePasses.h includes 2019-11-13 16:34:37 -08:00
LoopVersioningLICM.cpp Sink all InitializePasses.h includes 2019-11-13 16:34:37 -08:00
LowerAtomic.cpp Sink all InitializePasses.h includes 2019-11-13 16:34:37 -08:00
LowerConstantIntrinsics.cpp Sink all InitializePasses.h includes 2019-11-13 16:34:37 -08:00
LowerExpectIntrinsic.cpp Sink all InitializePasses.h includes 2019-11-13 16:34:37 -08:00
LowerGuardIntrinsic.cpp Move widenable branch formation into makeGuardControlFlowExplicit helper 2019-11-20 12:54:05 -08:00
LowerMatrixIntrinsics.cpp [Matrix] Update shape propagation to iterate until done. 2020-01-09 10:52:52 +00:00
LowerWidenableCondition.cpp Sink all InitializePasses.h includes 2019-11-13 16:34:37 -08:00
MakeGuardsExplicit.cpp D'oh. Fix assert after a84922916e. 2019-11-20 22:22:51 -05:00
MemCpyOptimizer.cpp Resubmit "[Alignment][NFC] Deprecate CreateMemCpy/CreateMemMove" 2019-12-17 10:07:46 +01:00
MergeICmps.cpp Sink all InitializePasses.h includes 2019-11-13 16:34:37 -08:00
MergedLoadStoreMotion.cpp Sink all InitializePasses.h includes 2019-11-13 16:34:37 -08:00
NaryReassociate.cpp Sink all InitializePasses.h includes 2019-11-13 16:34:37 -08:00
NewGVN.cpp Sink all InitializePasses.h includes 2019-11-13 16:34:37 -08:00
PartiallyInlineLibCalls.cpp Sink all InitializePasses.h includes 2019-11-13 16:34:37 -08:00
PlaceSafepoints.cpp [NFC] Refactor InlineResult for readability 2020-01-15 13:34:20 -08:00
Reassociate.cpp Sink all InitializePasses.h includes 2019-11-13 16:34:37 -08:00
Reg2Mem.cpp Sink all InitializePasses.h includes 2019-11-13 16:34:37 -08:00
RewriteStatepointsForGC.cpp Sink all InitializePasses.h includes 2019-11-13 16:34:37 -08:00
SCCP.cpp [Transforms] Fixes -Wrange-loop-analysis warnings 2019-12-22 19:20:17 +01:00
SROA.cpp [Alignment][NFC] Introduce Align in IRBuilder 2019-12-11 14:41:23 +01:00
Scalar.cpp [BasicBlockUtils] Add utility to remove redundant dbg.value instrs 2019-12-16 11:41:21 +01:00
Scalarizer.cpp Remove Support/Options.h, it is unused 2019-11-15 13:32:52 -08:00
SeparateConstOffsetFromGEP.cpp Sink all InitializePasses.h includes 2019-11-13 16:34:37 -08:00
SimpleLoopUnswitch.cpp [LCSSA] Don't use VH callbacks to invalidate SCEV when creating LCSSA phis 2019-12-06 13:21:49 +07:00
SimplifyCFGPass.cpp Sink all InitializePasses.h includes 2019-11-13 16:34:37 -08:00
Sink.cpp Sink all InitializePasses.h includes 2019-11-13 16:34:37 -08:00
SpeculateAroundPHIs.cpp Rename TTI::getIntImmCost for instructions and intrinsics 2019-12-11 18:00:20 -08:00
SpeculativeExecution.cpp Sink all InitializePasses.h includes 2019-11-13 16:34:37 -08:00
StraightLineStrengthReduce.cpp Sink all InitializePasses.h includes 2019-11-13 16:34:37 -08:00
StructurizeCFG.cpp Add missing includes needed to prune LLVMContext.h include, NFC 2019-11-14 15:23:15 -08:00
TailRecursionElimination.cpp Sink all InitializePasses.h includes 2019-11-13 16:34:37 -08:00
WarnMissedTransforms.cpp Sink all InitializePasses.h includes 2019-11-13 16:34:37 -08:00