summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/Scalar/LoopUnswitch.cpp
diff options
context:
space:
mode:
authorWhitney Tsang <whitney.uwaterloo@gmail.com>2019-06-17 14:38:56 +0000
committerWhitney Tsang <whitney.uwaterloo@gmail.com>2019-06-17 14:38:56 +0000
commit15b7f5b72d2ae3dae37a42caa8d3259cfafc70c6 (patch)
treefdc3c71b9334ee77ede0ec010ac2269a03d24651 /llvm/lib/Transforms/Scalar/LoopUnswitch.cpp
parent1c91e63897d8832a7b634d9662b8dbcc3ba36efd (diff)
downloadbcm5719-llvm-15b7f5b72d2ae3dae37a42caa8d3259cfafc70c6.tar.gz
bcm5719-llvm-15b7f5b72d2ae3dae37a42caa8d3259cfafc70c6.zip
PHINode: introduce setIncomingValueForBlock() function, and use it.
Summary: There is PHINode::getBasicBlockIndex() and PHINode::setIncomingValue() but no function to replace incoming value for a specified BasicBlock* predecessor. Clearly, there are a lot of places that could use that functionality. Reviewer: craig.topper, lebedev.ri, Meinersbur, kbarton, fhahn Reviewed By: Meinersbur, fhahn Subscribers: fhahn, hiraditya, zzheng, jsji, llvm-commits Tag: LLVM Differential Revision: https://reviews.llvm.org/D63338 llvm-svn: 363566
Diffstat (limited to 'llvm/lib/Transforms/Scalar/LoopUnswitch.cpp')
-rw-r--r--llvm/lib/Transforms/Scalar/LoopUnswitch.cpp3
1 files changed, 1 insertions, 2 deletions
diff --git a/llvm/lib/Transforms/Scalar/LoopUnswitch.cpp b/llvm/lib/Transforms/Scalar/LoopUnswitch.cpp
index 87ca5f049e9..b5b8e720069 100644
--- a/llvm/lib/Transforms/Scalar/LoopUnswitch.cpp
+++ b/llvm/lib/Transforms/Scalar/LoopUnswitch.cpp
@@ -1550,8 +1550,7 @@ void LoopUnswitch::RewriteLoopBodyWithConditionConstant(Loop *L, Value *LIC,
ConstantInt::getTrue(Context), NewSISucc);
// Release the PHI operands for this edge.
for (PHINode &PN : NewSISucc->phis())
- PN.setIncomingValue(PN.getBasicBlockIndex(Switch),
- UndefValue::get(PN.getType()));
+ PN.setIncomingValueForBlock(Switch, UndefValue::get(PN.getType()));
// Tell the domtree about the new block. We don't fully update the
// domtree here -- instead we force it to do a full recomputation
// after the pass is complete -- but we do need to inform it of
OpenPOWER on IntegriCloud