From f8c0cfc24eab0f23e3ebc65b10ee4276b1f15eeb Mon Sep 17 00:00:00 2001 From: Jonas Paulsson Date: Tue, 19 Nov 2019 13:15:12 +0100 Subject: [PATCH] ImplicitNullChecks: Don't add a dead definition of DepMI as live-in This is one of the fixes needed to reapply D68267 which improves verification of live-in lists. Review: craig.topper https://reviews.llvm.org/D70434 --- llvm/lib/CodeGen/ImplicitNullChecks.cpp | 2 +- llvm/test/CodeGen/X86/implicit-null-checks.mir | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/llvm/lib/CodeGen/ImplicitNullChecks.cpp b/llvm/lib/CodeGen/ImplicitNullChecks.cpp index 4e54437..b3ca4c1d 100644 --- a/llvm/lib/CodeGen/ImplicitNullChecks.cpp +++ b/llvm/lib/CodeGen/ImplicitNullChecks.cpp @@ -698,7 +698,7 @@ void ImplicitNullChecks::rewriteNullChecks( 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()); diff --git a/llvm/test/CodeGen/X86/implicit-null-checks.mir b/llvm/test/CodeGen/X86/implicit-null-checks.mir index e6147f5..e1ac01a 100644 --- a/llvm/test/CodeGen/X86/implicit-null-checks.mir +++ b/llvm/test/CodeGen/X86/implicit-null-checks.mir @@ -828,6 +828,7 @@ name: inc_store_with_dep # 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 -- 2.7.4