1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-23 03:02:36 +01:00

[NFC][SimplifyCFG] FoldBranchToCommonDest(): unclutter Cond/CondInPred handling

We don't need those variables, we can just get the final value directly.
This commit is contained in:
Roman Lebedev 2021-01-21 20:21:55 +03:00
parent c40f533654
commit dac9414f63

View File

@ -2934,16 +2934,12 @@ bool llvm::FoldBranchToCommonDest(BranchInst *BI, DomTreeUpdater *DTU,
// Note that there may be multiple predecessor blocks, so we cannot move
// bonus instructions to a predecessor block.
ValueToValueMapTy VMap; // maps original values to cloned values
Instruction *CondInPred;
for (Instruction &BonusInst : *BB) {
if (isa<DbgInfoIntrinsic>(BonusInst) || isa<BranchInst>(BonusInst))
continue;
Instruction *NewBonusInst = BonusInst.clone();
if (&BonusInst == Cond)
CondInPred = NewBonusInst;
if (PBI->getDebugLoc() != NewBonusInst->getDebugLoc()) {
// Unless the instruction has the same !dbg location as the original
// branch, drop it. When we fold the bonus instructions we want to make
@ -3004,8 +3000,8 @@ bool llvm::FoldBranchToCommonDest(BranchInst *BI, DomTreeUpdater *DTU,
// Now that the Cond was cloned into the predecessor basic block,
// or/and the two conditions together.
Instruction *NewCond = cast<Instruction>(
Builder.CreateBinOp(Opc, PBI->getCondition(), CondInPred, "or.cond"));
Instruction *NewCond = cast<Instruction>(Builder.CreateBinOp(
Opc, PBI->getCondition(), VMap[BI->getCondition()], "or.cond"));
PBI->setCondition(NewCond);
uint64_t PredTrueWeight, PredFalseWeight, SuccTrueWeight, SuccFalseWeight;