llvm-project/llvm/lib/Transforms/Scalar
Davide Italiano 9a60d2c157 [CVP] Replace incoming values from unreachable blocks with undef.
This is an attempt of fixing PR35807.
Due to the non-standard definition of dominance in LLVM, where uses in
unreachable blocks are dominated by anything, you can have, in an
unreachable block:

  %patatino = OP1 %patatino, CONSTANT

When `SimplifyInstruction` receives a PHI where an incoming value is of
the aforementioned form, in some cases, loops indefinitely.

What I propose here instead is keeping track of the incoming values
from unreachable blocks, and replacing them with undef. It fixes this
case, and it seems to be good regardless (even if we can't prove that
the value is constant, as it's coming from an unreachable block, we
can ignore it).

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

llvm-svn: 322006
2018-01-08 16:34:06 +00:00
..
ADCE.cpp [ADCE] Use MapVector for BlockInfo to make iteration order deterministic 2017-11-03 14:15:08 +00:00
AlignmentFromAssumptions.cpp Sort the remaining #include lines in include/... and lib/.... 2017-06-06 11:49:48 +00:00
BDCE.cpp Remove redundant includes from lib/Transforms. 2017-12-13 21:31:01 +00:00
CMakeLists.txt Add a new pass to speculate around PHI nodes with constant (integer) operands when profitable. 2017-11-28 11:32:31 +00:00
CallSiteSplitting.cpp Use phi ranges to simplify code. No functionality change intended. 2017-12-30 15:27:33 +00:00
ConstantHoisting.cpp Fix out-of-order stepping behavior in programs with hoisted constants. 2017-11-09 20:01:31 +00:00
ConstantProp.cpp Sort the remaining #include lines in include/... and lib/.... 2017-06-06 11:49:48 +00:00
CorrelatedValuePropagation.cpp [CVP] Replace incoming values from unreachable blocks with undef. 2018-01-08 16:34:06 +00:00
DCE.cpp Sort the remaining #include lines in include/... and lib/.... 2017-06-06 11:49:48 +00:00
DeadStoreElimination.cpp Modify ModRefInfo values using static inline method abstractions [NFC]. 2017-12-05 20:12:23 +00:00
DivRemPairs.cpp [DivRempairs] add a pass to optimize div/rem pairs (PR31028) 2017-09-09 13:38:18 +00:00
EarlyCSE.cpp [EarlyCSE] recognize swapped variants of abs/nabs as equivalent 2017-12-13 22:57:35 +00:00
FlattenCFGPass.cpp Sort the remaining #include lines in include/... and lib/.... 2017-06-06 11:49:48 +00:00
Float2Int.cpp [Float2Int] Replace a ConstantRange copy with a move. Remove an extra call to MapVector::find. 2017-05-05 17:09:29 +00:00
GVN.cpp Hardware-assisted AddressSanitizer (llvm part). 2017-12-09 00:21:41 +00:00
GVNHoist.cpp [GVNHoist] Fix: PR35222 gvn-hoist incorrectly erases load in case of a loop 2018-01-04 07:47:24 +00:00
GVNSink.cpp Use phi ranges to simplify code. No functionality change intended. 2017-12-30 15:27:33 +00:00
GuardWidening.cpp Guard print() functions only used by dump() functions. 2017-07-31 10:07:49 +00:00
IVUsersPrinter.cpp [PM] Separate the LoopAnalysisManager from the LoopPassManager and move 2017-01-11 09:43:56 +00:00
IndVarSimplify.cpp Use phi ranges to simplify code. No functionality change intended. 2017-12-30 15:27:33 +00:00
InductiveRangeCheckElimination.cpp Use phi ranges to simplify code. No functionality change intended. 2017-12-30 15:27:33 +00:00
InferAddressSpaces.cpp InferAddressSpaces: Fix bug about replacing addrspacecast 2017-10-30 21:19:41 +00:00
JumpThreading.cpp Revert "[JumpThreading] Preservation of DT and LVI across the pass" 2018-01-04 23:23:46 +00:00
LICM.cpp Re-commit : [LICM] Allow sinking when foldable in loop 2017-12-15 20:33:24 +00:00
LLVMBuild.txt
LoopAccessAnalysisPrinter.cpp [PM] Separate the LoopAnalysisManager from the LoopPassManager and move 2017-01-11 09:43:56 +00:00
LoopDataPrefetch.cpp Remove redundant includes from lib/Transforms. 2017-12-13 21:31:01 +00:00
LoopDeletion.cpp Use phi ranges to simplify code. No functionality change intended. 2017-12-30 15:27:33 +00:00
LoopDistribute.cpp Add MemorySSA as loop dependency, disabled by default [NFC]. 2017-11-21 15:45:46 +00:00
LoopIdiomRecognize.cpp [ModRefInfo] Make enum ModRefInfo an enum class [NFC]. 2017-12-07 22:41:34 +00:00
LoopInstSimplify.cpp [Transforms] Fix some Clang-tidy modernize and Include What You Use warnings; other minor fixes (NFC). 2017-10-16 21:34:24 +00:00
LoopInterchange.cpp [LoopInterchange] Fix phi node ordering miscompile. 2017-10-21 13:58:37 +00:00
LoopLoadElimination.cpp Add MemorySSA as loop dependency, disabled by default [NFC]. 2017-11-21 15:45:46 +00:00
LoopPassManager.cpp [PM] Teach LoopUnroll to update the LPM infrastructure as it unrolls 2017-01-25 02:49:01 +00:00
LoopPredication.cpp [Loop Predication] Teach LP about reverse loops 2017-12-04 15:11:48 +00:00
LoopRerollPass.cpp [Transforms] Fix some Clang-tidy modernize and Include What You Use warnings; other minor fixes (NFC). 2017-10-18 21:46:47 +00:00
LoopRotation.cpp [LoopRotate] processLoop should return true even if it just simplified the loop latch without making any other changes 2017-11-15 00:22:42 +00:00
LoopSimplifyCFG.cpp Rename WeakVH to WeakTrackingVH; NFC 2017-05-01 17:07:49 +00:00
LoopSink.cpp Add hasProfileData() to check if a function has profile data. NFC. 2017-12-22 01:33:52 +00:00
LoopStrengthReduce.cpp Use phi ranges to simplify code. No functionality change intended. 2017-12-30 15:27:33 +00:00
LoopUnrollPass.cpp Add hasProfileData() to check if a function has profile data. NFC. 2017-12-22 01:33:52 +00:00
LoopUnswitch.cpp Use phi ranges to simplify code. No functionality change intended. 2017-12-30 15:27:33 +00:00
LoopVersioningLICM.cpp [Transforms] Fix some Clang-tidy modernize and Include What You Use warnings; other minor fixes (NFC). 2017-10-26 00:55:39 +00:00
LowerAtomic.cpp Remove redundant includes from lib/Transforms. 2017-12-13 21:31:01 +00:00
LowerExpectIntrinsic.cpp Fix builin_expect lowering bug 2017-06-07 18:32:24 +00:00
LowerGuardIntrinsic.cpp Sort the remaining #include lines in include/... and lib/.... 2017-06-06 11:49:48 +00:00
MemCpyOptimizer.cpp Revert "[memcpyopt] Teach memcpyopt to optimize across basic blocks" 2017-12-28 05:10:33 +00:00
MergeICmps.cpp Remove redundant includes from lib/Transforms. 2017-12-13 21:31:01 +00:00
MergedLoadStoreMotion.cpp Remove redundant includes from lib/Transforms. 2017-12-13 21:31:01 +00:00
NaryReassociate.cpp [Transforms] Fix some Clang-tidy modernize and Include What You Use warnings; other minor fixes (NFC). 2017-10-17 21:27:42 +00:00
NewGVN.cpp [NewGVN] Stop assuming PHI args ordering when looking at phi-of-ops. 2017-10-30 20:20:16 +00:00
PartiallyInlineLibCalls.cpp [PartiallyInlineLibCalls][x86] add TTI hook to allow sqrt inlining to depend on arg rather than result 2017-11-27 21:15:43 +00:00
PlaceSafepoints.cpp All libcalls should be considered to be GC-leaf functions. 2017-07-27 16:49:39 +00:00
Reassociate.cpp Reassociate: add global reassociation algorithm 2017-12-12 19:18:02 +00:00
Reg2Mem.cpp Sort the remaining #include lines in include/... and lib/.... 2017-06-06 11:49:48 +00:00
RewriteStatepointsForGC.cpp [RewriteStatepoints] Fix incorrect assertion 2017-12-28 12:03:12 +00:00
SCCP.cpp Revert "[SCCP] Manually fold branches on undef." 2018-01-07 22:09:44 +00:00
SROA.cpp [SROA] Disable non-whole-alloca splits by default 2017-12-18 06:47:37 +00:00
Scalar.cpp [PM] port Rewrite Statepoints For GC to the new pass manager. 2017-12-15 09:32:11 +00:00
Scalarizer.cpp [Transforms] Fix some Clang-tidy modernize and Include What You Use warnings; other minor fixes (NFC). 2017-10-20 21:47:29 +00:00
SeparateConstOffsetFromGEP.cpp [SeparateConstOffsetFromGEP] Fix a typo. NFC. 2017-12-19 18:49:21 +00:00
SimpleLoopUnswitch.cpp Use phi ranges to simplify code. No functionality change intended. 2017-12-30 15:27:33 +00:00
SimplifyCFGPass.cpp [SimplifyCFG] don't sink common insts too soon (PR34603) 2017-12-14 22:05:20 +00:00
Sink.cpp Modify ModRefInfo values using static inline method abstractions [NFC]. 2017-12-05 20:12:23 +00:00
SpeculateAroundPHIs.cpp Add a new pass to speculate around PHI nodes with constant (integer) operands when profitable. 2017-11-28 11:32:31 +00:00
SpeculativeExecution.cpp Revert r301950: SpeculativeExecution: Stop using whitelist for costs 2017-05-10 12:30:07 +00:00
StraightLineStrengthReduce.cpp [Transforms] Fix some Clang-tidy modernize and Include What You Use warnings; other minor fixes (NFC). 2017-10-27 01:09:08 +00:00
StructurizeCFG.cpp StructurizeCFG: Fix broken backedge detection 2018-01-03 18:45:37 +00:00
TailRecursionElimination.cpp Remove redundant includes from lib/Transforms. 2017-12-13 21:31:01 +00:00