Skip to content

Commit 6fee739

Browse files
committed
Fixing macro to lower intrinsics properly
1 parent 4a17579 commit 6fee739

File tree

1 file changed

+15
-5
lines changed

1 file changed

+15
-5
lines changed

src/llvm-final-gc-lowering.cpp

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -396,14 +396,24 @@ bool FinalLowerGC::runOnFunction(Function &F)
396396
LOWER_INTRINSIC(popGCFrame, lowerPopGCFrame);
397397
LOWER_INTRINSIC(getGCFrameSlot, lowerGetGCFrameSlot);
398398
LOWER_INTRINSIC(GCAllocBytes, lowerGCAllocBytes);
399-
LOWER_INTRINSIC(queueGCRoot, lowerQueueGCRoot);
400399
LOWER_INTRINSIC(safepoint, lowerSafepoint);
401400

401+
// These lowerings preserve the CI and do not erase them from the parent
402+
#define LOWER_WB_INTRINSIC(INTRINSIC, LOWER_INTRINSIC_FUNC) \
403+
auto INTRINSIC = getOrNull(jl_intrinsics::INTRINSIC); \
404+
if (INTRINSIC == callee) { \
405+
LOWER_INTRINSIC_FUNC(CI, F); \
406+
++it; \
407+
continue; \
408+
} \
409+
410+
LOWER_WB_INTRINSIC(queueGCRoot, lowerQueueGCRoot);
411+
402412
#ifdef MMTK_GC
403-
LOWER_INTRINSIC(writeBarrier1, lowerWriteBarrier1);
404-
LOWER_INTRINSIC(writeBarrier2, lowerWriteBarrier2);
405-
LOWER_INTRINSIC(writeBarrier1Slow, lowerWriteBarrier1Slow);
406-
LOWER_INTRINSIC(writeBarrier2Slow, lowerWriteBarrier2Slow);
413+
LOWER_WB_INTRINSIC(writeBarrier1, lowerWriteBarrier1);
414+
LOWER_WB_INTRINSIC(writeBarrier2, lowerWriteBarrier2);
415+
LOWER_WB_INTRINSIC(writeBarrier1Slow, lowerWriteBarrier1Slow);
416+
LOWER_WB_INTRINSIC(writeBarrier2Slow, lowerWriteBarrier2Slow);
407417
#endif
408418
++it;
409419

0 commit comments

Comments
 (0)