[llvm] r257855 - Once again revert debug info verifier changes

Keno Fischer via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 14 18:12:38 PST 2016


Author: kfischer
Date: Thu Jan 14 20:12:38 2016
New Revision: 257855

URL: http://llvm.org/viewvc/llvm-project?rev=257855&view=rev
Log:
Once again revert debug info verifier changes

Yet another wave of buildbot failures (though fewer this time).
I'm only reverting the Verifier changes, as the test cases
will be fine without them as well, and touching them as often
just introduces unnecessary churn.

Modified:
    llvm/trunk/lib/IR/Verifier.cpp

Modified: llvm/trunk/lib/IR/Verifier.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/Verifier.cpp?rev=257855&r1=257854&r2=257855&view=diff
==============================================================================
--- llvm/trunk/lib/IR/Verifier.cpp (original)
+++ llvm/trunk/lib/IR/Verifier.cpp Thu Jan 14 20:12:38 2016
@@ -446,7 +446,8 @@ private:
   // Module-level debug info verification...
   void verifyTypeRefs();
   template <class MapTy>
-  void verifyDIExpression(const DbgInfoIntrinsic &I, const MapTy &TypeRefs);
+  void verifyBitPieceExpression(const DbgInfoIntrinsic &I,
+                                const MapTy &TypeRefs);
   void visitUnresolvedTypeRef(const MDString *S, const MDNode *N);
 };
 } // End anonymous namespace
@@ -4128,43 +4129,15 @@ static uint64_t getVariableSize(const DI
 }
 
 template <class MapTy>
-void Verifier::verifyDIExpression(const DbgInfoIntrinsic &I,
-                                  const MapTy &TypeRefs) {
+void Verifier::verifyBitPieceExpression(const DbgInfoIntrinsic &I,
+                                        const MapTy &TypeRefs) {
   DILocalVariable *V;
   DIExpression *E;
-  const Value *Arg;
-  // For now we check both the TypeSize and the TypeAllocSize because the
-  // difference is not clear in the IR Metadata
-  uint64_t ArgumentTypeSizeInBits = 0, ArgumentTypeAllocSizeInBits = 0;
   if (auto *DVI = dyn_cast<DbgValueInst>(&I)) {
-    Arg = DVI->getValue();
-    if (Arg) {
-      ArgumentTypeAllocSizeInBits =
-          M->getDataLayout().getTypeAllocSizeInBits(Arg->getType());
-      ArgumentTypeSizeInBits =
-          M->getDataLayout().getTypeSizeInBits(Arg->getType());
-    }
     V = dyn_cast_or_null<DILocalVariable>(DVI->getRawVariable());
     E = dyn_cast_or_null<DIExpression>(DVI->getRawExpression());
   } else {
     auto *DDI = cast<DbgDeclareInst>(&I);
-    // For declare intrinsics, get the total size of the alloca, to allow
-    // case where the variable may span more than one element.
-    Arg = DDI->getAddress();
-    if (Arg)
-      Arg = Arg->stripPointerCasts();
-    const AllocaInst *AI = dyn_cast_or_null<AllocaInst>(Arg);
-    if (AI) {
-      // We can only say something about constant size allocations
-      if (const ConstantInt *CI = dyn_cast<ConstantInt>(AI->getArraySize())) {
-        ArgumentTypeAllocSizeInBits =
-            CI->getLimitedValue() *
-            M->getDataLayout().getTypeAllocSizeInBits(AI->getAllocatedType());
-        ArgumentTypeSizeInBits =
-            CI->getLimitedValue() *
-            M->getDataLayout().getTypeSizeInBits(AI->getAllocatedType());
-      }
-    }
     V = dyn_cast_or_null<DILocalVariable>(DDI->getRawVariable());
     E = dyn_cast_or_null<DIExpression>(DDI->getRawExpression());
   }
@@ -4173,6 +4146,10 @@ void Verifier::verifyDIExpression(const
   if (!V || !E || !E->isValid())
     return;
 
+  // Nothing to do if this isn't a bit piece expression.
+  if (!E->isBitPiece())
+    return;
+
   // The frontend helps out GDB by emitting the members of local anonymous
   // unions as artificial local variables with shared storage. When SROA splits
   // the storage for artificial local variables that are smaller than the entire
@@ -4188,37 +4165,11 @@ void Verifier::verifyDIExpression(const
   if (!VarSize)
     return;
 
-  if (E->isBitPiece()) {
-    unsigned PieceSize = E->getBitPieceSize();
-    unsigned PieceOffset = E->getBitPieceOffset();
-    Assert(PieceSize + PieceOffset <= VarSize,
-           "piece is larger than or outside of variable", &I, V, E);
-    Assert(PieceSize != VarSize, "piece covers entire variable", &I, V, E);
-    return;
-  }
-
-  if (!ArgumentTypeSizeInBits)
-    return; // We were unable to determine the size of the argument
-
-  if (E->getNumElements() == 0) {
-    // In the case where the expression is empty, verify the size of the
-    // argument. Doing this in the general case would require looking through
-    // any dereferences that may be in the expression.
-    Assert(ArgumentTypeSizeInBits == VarSize ||
-               ArgumentTypeAllocSizeInBits == VarSize,
-           "size of passed value (" + Twine(ArgumentTypeSizeInBits) +
-               ", with padding " + Twine(ArgumentTypeAllocSizeInBits) +
-               ") does not match size of declared variable (" + Twine(VarSize) +
-               ")",
-           &I, Arg, V, V->getType(), E);
-  } else if (E->getElement(0) == dwarf::DW_OP_deref) {
-    // Pointers shouldn't have any alignment padding, so no need to check
-    // the alloc size
-    Assert(ArgumentTypeSizeInBits == M->getDataLayout().getPointerSizeInBits(),
-           "the operation of the expression is a deref, but the passed value "
-           "is not pointer sized",
-           &I, Arg, V, V->getType(), E);
-  }
+  unsigned PieceSize = E->getBitPieceSize();
+  unsigned PieceOffset = E->getBitPieceOffset();
+  Assert(PieceSize + PieceOffset <= VarSize,
+         "piece is larger than or outside of variable", &I, V, E);
+  Assert(PieceSize != VarSize, "piece covers entire variable", &I, V, E);
 }
 
 void Verifier::visitUnresolvedTypeRef(const MDString *S, const MDNode *N) {
@@ -4251,7 +4202,7 @@ void Verifier::verifyTypeRefs() {
     for (const BasicBlock &BB : F)
       for (const Instruction &I : BB)
         if (auto *DII = dyn_cast<DbgInfoIntrinsic>(&I))
-          verifyDIExpression(*DII, TypeRefs);
+          verifyBitPieceExpression(*DII, TypeRefs);
 
   // Return early if all typerefs were resolved.
   if (UnresolvedTypeRefs.empty())




More information about the llvm-commits mailing list