[llvm] 0421074 - [DebugInfo][NFC] Rename is/setUndef to is/setKilllocation

via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 6 01:16:17 PST 2023


Author: OCHyams
Date: 2023-01-06T09:15:02Z
New Revision: 042107494d341f0e6eb38b474ec8bed13b6fd978

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

LOG: [DebugInfo][NFC] Rename is/setUndef to is/setKilllocation

These names better reflect the semantics and also the implementation, since
it's not just "undef" operands that are sentinels used to signal that the debug
intrinsic terminates dominating locations definitions.

Related to https://discourse.llvm.org/t/auto-undef-debug-uses-of-a-deleted-value

Reviewed By: StephenTozer

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

Added: 
    

Modified: 
    llvm/include/llvm/IR/IntrinsicInst.h
    llvm/lib/CodeGen/AssignmentTrackingAnalysis.cpp
    llvm/lib/CodeGen/CodeGenPrepare.cpp
    llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp
    llvm/lib/Transforms/Utils/BasicBlockUtils.cpp
    llvm/lib/Transforms/Utils/Debugify.cpp
    llvm/lib/Transforms/Utils/LoopUtils.cpp
    llvm/unittests/Transforms/Utils/LocalTest.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/include/llvm/IR/IntrinsicInst.h b/llvm/include/llvm/IR/IntrinsicInst.h
index e9dfd04d40db4..5c6c94518b192 100644
--- a/llvm/include/llvm/IR/IntrinsicInst.h
+++ b/llvm/include/llvm/IR/IntrinsicInst.h
@@ -267,7 +267,7 @@ class DbgVariableIntrinsic : public DbgInfoIntrinsic {
            getIntrinsicID() != Intrinsic::dbg_assign;
   }
 
-  void setUndef() {
+  void setKillLocation() {
     // TODO: When/if we remove duplicate values from DIArgLists, we don't need
     // this set anymore.
     SmallPtrSet<Value *, 4> RemovedValues;
@@ -279,7 +279,7 @@ class DbgVariableIntrinsic : public DbgInfoIntrinsic {
     }
   }
 
-  bool isUndef() const {
+  bool isKillLocation() const {
     return (getNumVariableLocationOps() == 0 &&
             !getExpression()->isComplex()) ||
            any_of(location_ops(), [](Value *V) { return isa<UndefValue>(V); });

diff  --git a/llvm/lib/CodeGen/AssignmentTrackingAnalysis.cpp b/llvm/lib/CodeGen/AssignmentTrackingAnalysis.cpp
index 1561fb4d3e5ce..294f5f61eb1ea 100644
--- a/llvm/lib/CodeGen/AssignmentTrackingAnalysis.cpp
+++ b/llvm/lib/CodeGen/AssignmentTrackingAnalysis.cpp
@@ -2111,7 +2111,8 @@ bool AssignmentTrackingLowering::emitPromotedVarLocs(
         // operand is nullptr. We also can't handle variadic DIExpressions yet.
         // Some of those conditions don't have a type we can pick for
         // undef. Use i32.
-        if (DVI->isUndef() || DVI->getValue() == nullptr || DVI->hasArgList())
+        if (DVI->isKillLocation() || DVI->getValue() == nullptr ||
+            DVI->hasArgList())
           return UndefValue::get(Type::getInt32Ty(DVI->getContext()));
         return DVI->getValue();
       };

diff  --git a/llvm/lib/CodeGen/CodeGenPrepare.cpp b/llvm/lib/CodeGen/CodeGenPrepare.cpp
index 860551d8b661b..cdfe98f2923e0 100644
--- a/llvm/lib/CodeGen/CodeGenPrepare.cpp
+++ b/llvm/lib/CodeGen/CodeGenPrepare.cpp
@@ -8326,7 +8326,7 @@ bool CodeGenPrepare::placeDbgValues(Function &F) {
               dbgs()
               << "Unable to find valid location for Debug Value, undefing:\n"
               << *DVI);
-          DVI->setUndef();
+          DVI->setKillLocation();
           break;
         }
 

diff  --git a/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp b/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp
index c01c5964c24fa..e60382bc933d5 100644
--- a/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp
+++ b/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp
@@ -6389,7 +6389,7 @@ static bool SalvageDVI(llvm::Loop *L, ScalarEvolution &SE,
                        llvm::PHINode *LSRInductionVar, DVIRecoveryRec &DVIRec,
                        const SCEV *SCEVInductionVar,
                        SCEVDbgValueBuilder IterCountExpr) {
-  if (!DVIRec.DVI->isUndef())
+  if (!DVIRec.DVI->isKillLocation())
     return false;
 
   // LSR may have caused several changes to the dbg.value in the failed salvage
@@ -6538,7 +6538,7 @@ static void DbgGatherSalvagableDVI(
         continue;
       // Ensure that if any location op is undef that the dbg.vlue is not
       // cached.
-      if (DVI->isUndef())
+      if (DVI->isKillLocation())
         continue;
 
       // Check that the location op SCEVs are suitable for translation to

diff  --git a/llvm/lib/Transforms/Utils/BasicBlockUtils.cpp b/llvm/lib/Transforms/Utils/BasicBlockUtils.cpp
index acde526854363..d14e5b8224500 100644
--- a/llvm/lib/Transforms/Utils/BasicBlockUtils.cpp
+++ b/llvm/lib/Transforms/Utils/BasicBlockUtils.cpp
@@ -502,8 +502,8 @@ static bool remomveUndefDbgAssignsFromEntryBlock(BasicBlock *BB) {
     bool IsDbgValueKind = (!DAI || at::getAssignmentInsts(DAI).empty());
     DebugVariable Aggregate = GetAggregateVariable(DVI);
     if (!SeenDefForAggregate.contains(Aggregate)) {
-      bool IsUndef = DVI->isUndef() && IsDbgValueKind;
-      if (!IsUndef) {
+      bool IsKill = DVI->isKillLocation() && IsDbgValueKind;
+      if (!IsKill) {
         SeenDefForAggregate.insert(Aggregate);
       } else if (DAI) {
         ToBeRemoved.push_back(DAI);

diff  --git a/llvm/lib/Transforms/Utils/Debugify.cpp b/llvm/lib/Transforms/Utils/Debugify.cpp
index b11435343b3fb..989473693a0bc 100644
--- a/llvm/lib/Transforms/Utils/Debugify.cpp
+++ b/llvm/lib/Transforms/Utils/Debugify.cpp
@@ -345,7 +345,7 @@ bool llvm::collectDebugInfoMetadata(Module &M,
             if (I.getDebugLoc().getInlinedAt())
               continue;
             // Skip undef values.
-            if (DVI->isUndef())
+            if (DVI->isKillLocation())
               continue;
 
             auto *Var = DVI->getVariable();
@@ -588,7 +588,7 @@ bool llvm::checkDebugInfoMetadata(Module &M,
             if (I.getDebugLoc().getInlinedAt())
               continue;
             // Skip undef values.
-            if (DVI->isUndef())
+            if (DVI->isKillLocation())
               continue;
 
             auto *Var = DVI->getVariable();

diff  --git a/llvm/lib/Transforms/Utils/LoopUtils.cpp b/llvm/lib/Transforms/Utils/LoopUtils.cpp
index bc81e0f7f047d..7df8651ede154 100644
--- a/llvm/lib/Transforms/Utils/LoopUtils.cpp
+++ b/llvm/lib/Transforms/Utils/LoopUtils.cpp
@@ -637,7 +637,7 @@ void llvm::deleteDeadLoop(Loop *L, DominatorTree *DT, ScalarEvolution *SE,
            "There should be a non-PHI instruction in exit block, else these "
            "instructions will have no parent.");
     for (auto *DVI : DeadDebugInst) {
-      DVI->setUndef();
+      DVI->setKillLocation();
       DVI->moveBefore(InsertDbgValueBefore);
     }
   }

diff  --git a/llvm/unittests/Transforms/Utils/LocalTest.cpp b/llvm/unittests/Transforms/Utils/LocalTest.cpp
index 59658d4580f06..2591f01d21954 100644
--- a/llvm/unittests/Transforms/Utils/LocalTest.cpp
+++ b/llvm/unittests/Transforms/Utils/LocalTest.cpp
@@ -786,7 +786,7 @@ TEST(Local, ReplaceAllDbgUsesWith) {
 
   auto *FDbgVal = cast<DbgValueInst>(F_.getNextNode());
   EXPECT_EQ(FDbgVal->getNumVariableLocationOps(), 1u);
-  EXPECT_TRUE(FDbgVal->isUndef());
+  EXPECT_TRUE(FDbgVal->isKillLocation());
 
   SmallVector<DbgValueInst *, 1> FDbgVals;
   findDbgValues(FDbgVals, &F_);


        


More information about the llvm-commits mailing list