Skip to content

Commit 4038168

Browse files
committed
Use BranchInst::getSuccessor().
This is more resilient to changes in LLVM.
1 parent 0ec612c commit 4038168

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

llvm/lib/YkIR/YkIRWriter.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -459,16 +459,17 @@ class YkIRWriter {
459459
//
460460
// Note that in LLVM IR, the operands are ordered (despite the order they
461461
// appear in the language reference): cond, if-false, if-true. We
462-
// re-order those during lowering to avoid confusion.
462+
// use `getSuccessor()`, so as to re-order those during lowering to avoid
463+
// confusion.
463464
//
464465
// num_operands:
465466
OutStreamer.emitInt32(3);
466467
// OPERAND 0: condition.
467468
serialiseOperand(I, VLMap, I->getOperand(0));
468469
// OPERAND 1: block to go to if true.
469-
serialiseOperand(I, VLMap, I->getOperand(2));
470+
serialiseOperand(I, VLMap, I->getSuccessor(0));
470471
// OPERAND 2: block to go to if false.
471-
serialiseOperand(I, VLMap, I->getOperand(1));
472+
serialiseOperand(I, VLMap, I->getSuccessor(1));
472473
}
473474
InstIdx++;
474475
}

0 commit comments

Comments
 (0)