[llvm] f8c0cfc - ImplicitNullChecks: Don't add a dead definition of DepMI as live-in

Jonas Paulsson via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 3 02:03:37 PST 2019


Author: Jonas Paulsson
Date: 2019-12-03T11:02:53+01:00
New Revision: f8c0cfc24eab0f23e3ebc65b10ee4276b1f15eeb

URL: https://github.com/llvm/llvm-project/commit/f8c0cfc24eab0f23e3ebc65b10ee4276b1f15eeb
DIFF: https://github.com/llvm/llvm-project/commit/f8c0cfc24eab0f23e3ebc65b10ee4276b1f15eeb.diff

LOG: 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

Added: 
    

Modified: 
    llvm/lib/CodeGen/ImplicitNullChecks.cpp
    llvm/test/CodeGen/X86/implicit-null-checks.mir

Removed: 
    


################################################################################
diff  --git a/llvm/lib/CodeGen/ImplicitNullChecks.cpp b/llvm/lib/CodeGen/ImplicitNullChecks.cpp
index 4e54437947ff..b3ca4c1d8020 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 e6147f56ed77..e1ac01a82973 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


        


More information about the llvm-commits mailing list