[llvm] 8cb04d8 - [X86] X86OptimizeLEAPass::replaceDebugValue - take a copy of the DebugLoc not a reference as it may be deleted.

Simon Pilgrim via llvm-commits llvm-commits at lists.llvm.org
Sat May 15 08:28:43 PDT 2021


Author: Simon Pilgrim
Date: 2021-05-15T16:28:20+01:00
New Revision: 8cb04d891fba6ee81c385519510cb89e37acea0c

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

LOG: [X86] X86OptimizeLEAPass::replaceDebugValue - take a copy of the DebugLoc not a reference as it may be deleted.

Fixes msan warning due to rG9ca2c50b3601

Added: 
    

Modified: 
    llvm/lib/Target/X86/X86OptimizeLEAs.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Target/X86/X86OptimizeLEAs.cpp b/llvm/lib/Target/X86/X86OptimizeLEAs.cpp
index ef60fd87f4cb..ab4d2bd05772 100644
--- a/llvm/lib/Target/X86/X86OptimizeLEAs.cpp
+++ b/llvm/lib/Target/X86/X86OptimizeLEAs.cpp
@@ -598,7 +598,7 @@ MachineInstr *X86OptimizeLEAPass::replaceDebugValue(MachineInstr &MI,
 
   // Replace DBG_VALUE instruction with modified version.
   MachineBasicBlock *MBB = MI.getParent();
-  const DebugLoc &DL = MI.getDebugLoc();
+  DebugLoc DL = MI.getDebugLoc();
   bool IsIndirect = MI.isIndirectDebugValue();
   const MDNode *Var = MI.getDebugVariable();
   unsigned Opcode = MI.isNonListDebugValue() ? TargetOpcode::DBG_VALUE


        


More information about the llvm-commits mailing list