Index: llvm/lib/CodeGen/SplitKit.cpp =================================================================== --- llvm/lib/CodeGen/SplitKit.cpp +++ llvm/lib/CodeGen/SplitKit.cpp @@ -118,6 +118,13 @@ if (!VNI) return LIP.first; + // The def of statepoint instruction is a gc relocation and it should be alive + // in landing pad. So we cannot split interval after statepoint instruction. + if (SlotIndex::isSameInstr(VNI->def, LIP.second)) + if (auto *I = LIS.getInstructionFromIndex(LIP.second)) + if (I->getOpcode() == TargetOpcode::STATEPOINT) + return LIP.second; + // If the value leaving MBB was defined after the call in MBB, it can't // really be live-in to the landing pad. This can happen if the landing pad // has a PHI, and this register is undef on the exceptional edge. Index: llvm/test/CodeGen/X86/statepoint-invoke-ra1.ll =================================================================== --- llvm/test/CodeGen/X86/statepoint-invoke-ra1.ll +++ llvm/test/CodeGen/X86/statepoint-invoke-ra1.ll @@ -4,7 +4,7 @@ ; The test checks the verification catch the case when RA splits live interval in the ; way the def is located after invoke statepoint while use is in landing pad. -; CHECK: *** Bad machine code: Register not marked live out of predecessor *** +; CHECK: *** Bad machine code: Two-address instruction operands must be identical *** target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128-ni:1-p2:32:8:8:32-ni:2" target triple = "x86_64-unknown-linux-gnu"