Index: llvm/lib/CodeGen/ImplicitNullChecks.cpp =================================================================== --- llvm/lib/CodeGen/ImplicitNullChecks.cpp +++ llvm/lib/CodeGen/ImplicitNullChecks.cpp @@ -698,7 +698,7 @@ if (auto *DepMI = NC.getOnlyDependency()) { for (auto &MO : DepMI->operands()) { - if (!MO.isReg() || !MO.getReg() || !MO.isDef()) + if (!MO.isReg() || !MO.getReg() || !MO.isDef() || MO.isDead()) continue; if (!NC.getNotNullSucc()->isLiveIn(MO.getReg())) NC.getNotNullSucc()->addLiveIn(MO.getReg()); Index: llvm/test/CodeGen/X86/implicit-null-checks.mir =================================================================== --- llvm/test/CodeGen/X86/implicit-null-checks.mir +++ llvm/test/CodeGen/X86/implicit-null-checks.mir @@ -828,6 +828,7 @@ # CHECK-NEXT: $noreg = FAULTING_OP 3, %bb.2, {{[0-9]+}}, $rdi, 1, $noreg, 16, $noreg, $esi # CHECK-NEXT: JMP_1 %bb.1 # CHECK: bb.1.not_null +# CHECK-NOT: liveins: {{.*}} $eflags alignment: 16 tracksRegLiveness: true