llvm-project/llvm/test/Transforms/SCCP
Bjorn Pettersson cd53b7f54e [IPSCCP] Fix a problem with removing labels in a switch with undef condition
Summary:
Before removing basic blocks that ipsccp has considered as dead
all uses of the basic block label must be removed. That is done
by calling ConstantFoldTerminator on the users. An exception
is when the branch condition is an undef value. In such
scenarios ipsccp is using some internal assumptions regarding
which edge in the control flow that should remain, while
ConstantFoldTerminator don't know how to fold the terminator.

The problem addressed here is related to ConstantFoldTerminator's
ability to rewrite a 'switch' into a conditional 'br'. In such
situations ConstantFoldTerminator returns true indicating that
the terminator has been rewritten. However, ipsccp treated the
true value as if the edge to the dead basic block had been
removed. So the code for resolving an undef branch condition
did not trigger, and we ended up with assertion that there were
uses remaining when deleting the basic block.

The solution is to resolve indeterminate branches before the
call to ConstantFoldTerminator.

Reviewers: efriedma, fhahn, davide

Reviewed By: fhahn

Subscribers: llvm-commits

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

llvm-svn: 342632
2018-09-20 09:00:17 +00:00
..
2002-05-02-MissSecondInst.ll
2002-05-20-MissedIncomingValue.ll
2002-05-21-InvalidSimplify.ll
2002-08-30-GetElementPtrTest.ll
2003-06-24-OverdefinedPHIValue.ll
2003-08-26-InvokeHandling.ll
2004-11-16-DeadInvoke.ll
2004-12-10-UndefBranchBug.ll
2006-10-23-IPSCCP-Crash.ll [PPC] Remove Darwin support from POWER backend. 2018-08-28 01:18:29 +00:00
2006-12-04-PackedType.ll [PPC] Remove Darwin support from POWER backend. 2018-08-28 01:18:29 +00:00
2006-12-19-UndefBug.ll
2007-05-16-InvokeCrash.ll
2008-01-27-UndefCorrelate.ll
2008-04-22-multiple-ret-sccp.ll
2008-05-23-UndefCallFold.ll
2009-01-14-IPSCCP-Invoke.ll
2009-05-27-VectorOperandZero.ll
apint-array.ll
apint-basictest.ll
apint-basictest2.ll
apint-basictest3.ll
apint-basictest4.ll
apint-bigarray.ll
apint-bigint.ll
apint-bigint2.ll
apint-ipsccp1.ll
apint-ipsccp2.ll
apint-ipsccp3.ll
apint-ipsccp4.ll
apint-load.ll
apint-phi.ll
apint-select.ll
atomic-load-store.ll
atomic.ll
bitcast.ll
calltest.ll
comdat-ipo.ll
constant-struct.ll
crash.ll
definite-initializer.ll
dont-zap-return.ll
global-alias-constprop.ll
indirectbr.ll
ip-constant-ranges.ll Recommit r328307: [IPSCCP] Use constant range information for comparisons of parameters. 2018-07-20 13:29:12 +00:00
ipsccp-addr-taken.ll
ipsccp-basic.ll [IPSCCP] Run Solve each time we resolved an undef in a function. 2018-07-17 14:04:59 +00:00
ipsccp-branch-unresolved-undef.ll [SCCP] Don't use markForcedConstant on branch conditions. 2018-07-19 23:02:07 +00:00
ipsccp-phi-one-pred-dead.ll [SCCP] Don't use markForcedConstant on branch conditions. 2018-07-19 23:02:07 +00:00
loadtest.ll
logical-nuke.ll
overdefined-div.ll
pr27712.ll
pr35357.ll
preserve-analysis.ll [BasicAA] Use PhiValuesAnalysis if available when handling phi alias 2018-07-30 11:52:08 +00:00
return-zapped.ll [SCCP] Don't use markForcedConstant on branch conditions. 2018-07-19 23:02:07 +00:00
retvalue-undef.ll
sccptest.ll
select.ll
switch-multiple-undef.ll
switch-undef-constantfoldterminator.ll [IPSCCP] Fix a problem with removing labels in a switch with undef condition 2018-09-20 09:00:17 +00:00
switch.ll
ub-shift.ll
undef-resolve.ll
vector-bitcast.ll