@@ -7136,134 +7136,6 @@ void Verifier::visitConstrainedFPIntrinsic(ConstrainedFPIntrinsic &FPI) {
71367136 }
71377137}
71387138
7139- <<<<<<< HEAD
7140- void Verifier::visitDbgIntrinsic (StringRef Kind, DbgVariableIntrinsic &DII) {
7141- auto *MD = DII.getRawLocation ();
7142- CheckDI (isa<ValueAsMetadata>(MD) || isa<DIArgList>(MD) ||
7143- (isa<MDNode>(MD) && !cast<MDNode>(MD)->getNumOperands ()),
7144- " invalid llvm.dbg." + Kind + " intrinsic address/value" , &DII, MD);
7145- CheckDI (isa<DILocalVariable>(DII.getRawVariable ()),
7146- " invalid llvm.dbg." + Kind + " intrinsic variable" , &DII,
7147- DII.getRawVariable ());
7148- CheckDI (isa<DIExpression>(DII.getRawExpression ()),
7149- " invalid llvm.dbg." + Kind + " intrinsic expression" , &DII,
7150- DII.getRawExpression ());
7151-
7152- // This is redundant with the preprocessor-generated check, but here we
7153- // can include arguments for DIOp-based expression checking.
7154- SmallVector<const Value *> Arguments{DII.location_ops ()};
7155- DIExpressionEnv Env{DII.getVariable (), Arguments, DL};
7156- CheckDI (DII.getExpression ()->isValid (Env, dbgs ()),
7157- " invalid DIExpression in llvm.dbg." + Kind + " intrinsic" , &DII,
7158- DII.getRawExpression ());
7159-
7160- if (auto *DAI = dyn_cast<DbgAssignIntrinsic>(&DII)) {
7161- CheckDI (isa<DIAssignID>(DAI->getRawAssignID ()),
7162- " invalid llvm.dbg.assign intrinsic DIAssignID" , &DII,
7163- DAI->getRawAssignID ());
7164- const auto *RawAddr = DAI->getRawAddress ();
7165- CheckDI (
7166- isa<ValueAsMetadata>(RawAddr) ||
7167- (isa<MDNode>(RawAddr) && !cast<MDNode>(RawAddr)->getNumOperands ()),
7168- " invalid llvm.dbg.assign intrinsic address" , &DII,
7169- DAI->getRawAddress ());
7170- CheckDI (isa<DIExpression>(DAI->getRawAddressExpression ()),
7171- " invalid llvm.dbg.assign intrinsic address expression" , &DII,
7172- DAI->getRawAddressExpression ());
7173- // All of the linked instructions should be in the same function as DII.
7174- for (Instruction *I : at::getAssignmentInsts (DAI))
7175- CheckDI (DAI->getFunction () == I->getFunction (),
7176- " inst not in same function as dbg.assign" , I, DAI);
7177- }
7178-
7179- // Ignore broken !dbg attachments; they're checked elsewhere.
7180- if (MDNode *N = DII.getDebugLoc ().getAsMDNode ())
7181- if (!isa<DILocation>(N))
7182- return ;
7183-
7184- BasicBlock *BB = DII.getParent ();
7185- Function *F = BB ? BB->getParent () : nullptr ;
7186-
7187- // The scopes for variables and !dbg attachments must agree.
7188- DILocalVariable *Var = DII.getVariable ();
7189- DILocation *Loc = DII.getDebugLoc ();
7190- CheckDI (Loc, " llvm.dbg." + Kind + " intrinsic requires a !dbg attachment" ,
7191- &DII, BB, F);
7192-
7193- DISubprogram *VarSP = getSubprogram (Var->getRawScope ());
7194- DISubprogram *LocSP = getSubprogram (Loc->getRawScope ());
7195- if (!VarSP || !LocSP)
7196- return ; // Broken scope chains are checked elsewhere.
7197-
7198- CheckDI (VarSP == LocSP,
7199- " mismatched subprogram between llvm.dbg." + Kind +
7200- " variable and !dbg attachment" ,
7201- &DII, BB, F, Var, Var->getScope ()->getSubprogram (), Loc,
7202- Loc->getScope ()->getSubprogram ());
7203-
7204- // This check is redundant with one in visitLocalVariable().
7205- CheckDI (isType (Var->getRawType ()), " invalid type ref" , Var,
7206- Var->getRawType ());
7207- verifyFnArgs (DII);
7208- }
7209-
7210- void Verifier::visitDbgLabelIntrinsic (StringRef Kind, DbgLabelInst &DLI) {
7211- CheckDI (isa<DILabel>(DLI.getRawLabel ()),
7212- " invalid llvm.dbg." + Kind + " intrinsic variable" , &DLI,
7213- DLI.getRawLabel ());
7214-
7215- // Ignore broken !dbg attachments; they're checked elsewhere.
7216- if (MDNode *N = DLI.getDebugLoc ().getAsMDNode ())
7217- if (!isa<DILocation>(N))
7218- return ;
7219-
7220- BasicBlock *BB = DLI.getParent ();
7221- Function *F = BB ? BB->getParent () : nullptr ;
7222-
7223- // The scopes for variables and !dbg attachments must agree.
7224- DILabel *Label = DLI.getLabel ();
7225- DILocation *Loc = DLI.getDebugLoc ();
7226- Check (Loc, " llvm.dbg." + Kind + " intrinsic requires a !dbg attachment" , &DLI,
7227- BB, F);
7228-
7229- DISubprogram *LabelSP = getSubprogram (Label->getRawScope ());
7230- DISubprogram *LocSP = getSubprogram (Loc->getRawScope ());
7231- if (!LabelSP || !LocSP)
7232- return ;
7233-
7234- CheckDI (LabelSP == LocSP,
7235- " mismatched subprogram between llvm.dbg." + Kind +
7236- " label and !dbg attachment" ,
7237- &DLI, BB, F, Label, Label->getScope ()->getSubprogram (), Loc,
7238- Loc->getScope ()->getSubprogram ());
7239- }
7240-
7241- void Verifier::verifyFragmentExpression (const DbgVariableIntrinsic &I) {
7242- DILocalVariable *V = dyn_cast_or_null<DILocalVariable>(I.getRawVariable ());
7243- DIExpression *E = dyn_cast_or_null<DIExpression>(I.getRawExpression ());
7244-
7245- // We don't know whether this intrinsic verified correctly.
7246- if (!V || !E || !E->isValid ())
7247- return ;
7248-
7249- // Nothing to do if this isn't a DW_OP_LLVM_fragment expression.
7250- auto Fragment = E->getFragmentInfo ();
7251- if (!Fragment)
7252- return ;
7253-
7254- // The frontend helps out GDB by emitting the members of local anonymous
7255- // unions as artificial local variables with shared storage. When SROA splits
7256- // the storage for artificial local variables that are smaller than the entire
7257- // union, the overhang piece will be outside of the allotted space for the
7258- // variable and this check fails.
7259- // FIXME: Remove this check as soon as clang stops doing this; it hides bugs.
7260- if (V->isArtificial ())
7261- return ;
7262-
7263- verifyFragmentExpression (*V, *Fragment, &I);
7264- }
7265- =======
7266- >>>>>>> 7caa0c9a55b3
72677139void Verifier::verifyFragmentExpression (const DbgVariableRecord &DVR) {
72687140 DILocalVariable *V = dyn_cast_or_null<DILocalVariable>(DVR.getRawVariable ());
72697141 DIExpression *E = dyn_cast_or_null<DIExpression>(DVR.getRawExpression ());
0 commit comments