Skip to content

Commit a9e6c21

Browse files
committed
Fix instruction index bugs.
Index increments were being missed due to them being passed by value and not reference! This led to the IR using incorrect local variable operands in some cases. Tests will be added (where possible) to Yk's IR lowering suite.
1 parent 31f721a commit a9e6c21

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

llvm/lib/YkIR/YkIRWriter.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,7 @@ class YkIRWriter {
239239
}
240240

241241
void serialiseAllocaInst(AllocaInst *I, ValueLoweringMap &VLMap,
242-
unsigned BBIdx, unsigned InstIdx) {
242+
unsigned BBIdx, unsigned &InstIdx) {
243243
// type_index:
244244
OutStreamer.emitSizeT(typeIndex(I->getType()));
245245
// opcode:
@@ -265,7 +265,7 @@ class YkIRWriter {
265265
}
266266

267267
void serialiseCallInst(CallInst *I, ValueLoweringMap &VLMap, unsigned BBIdx,
268-
unsigned InstIdx) {
268+
unsigned &InstIdx) {
269269
// type_index:
270270
OutStreamer.emitSizeT(typeIndex(I->getType()));
271271
// opcode:
@@ -289,7 +289,7 @@ class YkIRWriter {
289289
}
290290

291291
void serialiseBranchInst(BranchInst *I, ValueLoweringMap &VLMap,
292-
unsigned BBIdx, unsigned InstIdx) {
292+
unsigned BBIdx, unsigned &InstIdx) {
293293
// We split LLVM's `br` into two Yk IR instructions: one for unconditional
294294
// branching, another for conidtional branching.
295295
if (!I->isConditional()) {

0 commit comments

Comments
 (0)