@@ -2713,16 +2713,16 @@ bool llvm::FoldBranchToCommonDest(BranchInst *BI, unsigned BonusInstThreshold) {
2713
2713
2714
2714
// Clone Cond into the predecessor basic block, and or/and the
2715
2715
// two conditions together.
2716
- Instruction *New = Cond->clone ();
2717
- RemapInstruction (New , VMap,
2716
+ Instruction *CondInPred = Cond->clone ();
2717
+ RemapInstruction (CondInPred , VMap,
2718
2718
RF_NoModuleLevelChanges | RF_IgnoreMissingLocals);
2719
- PredBlock->getInstList ().insert (PBI->getIterator (), New );
2720
- New ->takeName (Cond);
2721
- Cond->setName (New ->getName () + " .old" );
2719
+ PredBlock->getInstList ().insert (PBI->getIterator (), CondInPred );
2720
+ CondInPred ->takeName (Cond);
2721
+ Cond->setName (CondInPred ->getName () + " .old" );
2722
2722
2723
2723
if (BI->isConditional ()) {
2724
2724
Instruction *NewCond = cast<Instruction>(
2725
- Builder.CreateBinOp (Opc, PBI->getCondition (), New , " or.cond" ));
2725
+ Builder.CreateBinOp (Opc, PBI->getCondition (), CondInPred , " or.cond" ));
2726
2726
PBI->setCondition (NewCond);
2727
2727
2728
2728
uint64_t PredTrueWeight, PredFalseWeight, SuccTrueWeight, SuccFalseWeight;
@@ -2786,7 +2786,8 @@ bool llvm::FoldBranchToCommonDest(BranchInst *BI, unsigned BonusInstThreshold) {
2786
2786
Instruction *NotCond = cast<Instruction>(
2787
2787
Builder.CreateNot (PBI->getCondition (), " not.cond" ));
2788
2788
MergedCond = cast<Instruction>(
2789
- Builder.CreateBinOp (Instruction::And, NotCond, New, " and.cond" ));
2789
+ Builder.CreateBinOp (Instruction::And, NotCond, CondInPred,
2790
+ " and.cond" ));
2790
2791
if (PBI_C->isOne ())
2791
2792
MergedCond = cast<Instruction>(Builder.CreateBinOp (
2792
2793
Instruction::Or, PBI->getCondition (), MergedCond, " or.cond" ));
@@ -2795,7 +2796,7 @@ bool llvm::FoldBranchToCommonDest(BranchInst *BI, unsigned BonusInstThreshold) {
2795
2796
// PBI_C is true: (PBI_Cond and BI_Value) or (!PBI_Cond)
2796
2797
// is false: PBI_Cond and BI_Value
2797
2798
MergedCond = cast<Instruction>(Builder.CreateBinOp (
2798
- Instruction::And, PBI->getCondition (), New , " and.cond" ));
2799
+ Instruction::And, PBI->getCondition (), CondInPred , " and.cond" ));
2799
2800
if (PBI_C->isOne ()) {
2800
2801
Instruction *NotCond = cast<Instruction>(
2801
2802
Builder.CreateNot (PBI->getCondition (), " not.cond" ));
0 commit comments