[llvm] a5ac8ca - [CSInfo][TailDuplicator] Delete the call site info when removing dead MBBs

Djordje Todorovic via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 18 03:30:17 PST 2020


Author: Djordje Todorovic
Date: 2020-02-18T12:29:51+01:00
New Revision: a5ac8ca3e0e42a0bcb68c08c3279838bcf0cf64a

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

LOG: [CSInfo][TailDuplicator] Delete the call site info when removing dead MBBs

This is needed for the debug entry values feature.

Differential Revision: https://reviews.llvm.org/D74702

Added: 
    

Modified: 
    llvm/lib/CodeGen/TailDuplicator.cpp
    llvm/test/CodeGen/X86/tail-dup-repeat.ll

Removed: 
    


################################################################################
diff  --git a/llvm/lib/CodeGen/TailDuplicator.cpp b/llvm/lib/CodeGen/TailDuplicator.cpp
index d9518ff252bf..ae570fbfe7f5 100644
--- a/llvm/lib/CodeGen/TailDuplicator.cpp
+++ b/llvm/lib/CodeGen/TailDuplicator.cpp
@@ -1015,6 +1015,13 @@ void TailDuplicator::removeDeadBlock(
   assert(MBB->pred_empty() && "MBB must be dead!");
   LLVM_DEBUG(dbgs() << "\nRemoving MBB: " << *MBB);
 
+  MachineFunction *MF = MBB->getParent();
+  // Update the call site info.
+  std::for_each(MBB->begin(), MBB->end(), [MF](const MachineInstr &MI) {
+    if (MI.isCandidateForCallSiteEntry())
+      MF->eraseCallSiteInfo(&MI);
+  });
+
   if (RemovalCallback)
     (*RemovalCallback)(MBB);
 

diff  --git a/llvm/test/CodeGen/X86/tail-dup-repeat.ll b/llvm/test/CodeGen/X86/tail-dup-repeat.ll
index 9a06c9a723bb..fffc135fa526 100644
--- a/llvm/test/CodeGen/X86/tail-dup-repeat.ll
+++ b/llvm/test/CodeGen/X86/tail-dup-repeat.ll
@@ -1,5 +1,5 @@
 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
-; RUN: llc < %s -mtriple=x86_64-unknown-linux-gnu | FileCheck %s
+; RUN: llc < %s -mtriple=x86_64-unknown-linux-gnu -debug-entry-values | FileCheck %s
 
 ; Function Attrs: uwtable
 ; When tail-duplicating during placement, we work backward from blocks with


        


More information about the llvm-commits mailing list