[llvm] 2399497 - [debug-info] Followup to e0374fb2f4, avoid changing codegen

Jeremy Morse via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 7 04:26:57 PST 2023


Author: Jeremy Morse
Date: 2023-02-07T12:24:48Z
New Revision: 2399497c9d68c946764e3089fb0b4c8d29166d67

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

LOG: [debug-info] Followup to e0374fb2f4, avoid changing codegen

As discussed on D140404, calling GetValueInMiddleOfBlock can force PHI
nodes to be created, but the patch was only supposed to fetch a Value if it
wasn't going to generate any PHIs. Fix this by using GetValueAtEndOfBlock
instead of the Middle variant, which was the original intention given the
check of HasValueForBlock.

We don't need to consider the "middle of block" scenario as we're only
dealing with blocks where there are no value definitions.

Added: 
    

Modified: 
    llvm/lib/Transforms/Utils/SSAUpdater.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Transforms/Utils/SSAUpdater.cpp b/llvm/lib/Transforms/Utils/SSAUpdater.cpp
index 13975ded64161..ebe9cb27f5ab0 100644
--- a/llvm/lib/Transforms/Utils/SSAUpdater.cpp
+++ b/llvm/lib/Transforms/Utils/SSAUpdater.cpp
@@ -216,7 +216,7 @@ void SSAUpdater::UpdateDebugValues(Instruction *I,
 void SSAUpdater::UpdateDebugValue(Instruction *I, DbgValueInst *DbgValue) {
   BasicBlock *UserBB = DbgValue->getParent();
   if (HasValueForBlock(UserBB)) {
-    Value *NewVal = GetValueInMiddleOfBlock(UserBB);
+    Value *NewVal = GetValueAtEndOfBlock(UserBB);
     DbgValue->replaceVariableLocationOp(I, NewVal);
   }
   else


        


More information about the llvm-commits mailing list