[llvm] r332416 - [Debugfiy] Print the pass name next to the result

Vedant Kumar via llvm-commits llvm-commits at lists.llvm.org
Wed May 16 10:24:56 PDT 2018


Thanks for catching this. I'll tighten this test up.

vedant

> On May 16, 2018, at 8:00 AM, via llvm-commits <llvm-commits at lists.llvm.org> wrote:
> 
> 
> 
>> -----Original Message-----
>> From: llvm-commits [mailto:llvm-commits-bounces at lists.llvm.org <mailto:llvm-commits-bounces at lists.llvm.org>] On Behalf
>> Of Anastasis Grammenos via llvm-commits
>> Sent: Tuesday, May 15, 2018 7:38 PM
>> To: llvm-commits at lists.llvm.org <mailto:llvm-commits at lists.llvm.org>
>> Subject: [llvm] r332416 - [Debugfiy] Print the pass name next to the
>> result
>> 
>> Author: gramanas
>> Date: Tue May 15 16:38:05 2018
>> New Revision: 332416
>> 
>> URL: http://llvm.org/viewvc/llvm-project?rev=332416&view=rev
>> Log:
>> [Debugfiy] Print the pass name next to the result
>> 
>> CheckDebugify now prints the pass name right next to the result of the
>> check.
>> 
>> Differential Revision: https://reviews.llvm.org/D46908
>> 
>> Modified:
>>    llvm/trunk/test/DebugInfo/debugify-each.ll
>>    llvm/trunk/test/DebugInfo/debugify.ll
>>    llvm/trunk/tools/opt/Debugify.cpp
>>    llvm/trunk/tools/opt/PassPrinters.h
>>    llvm/trunk/tools/opt/opt.cpp
>> 
>> Modified: llvm/trunk/test/DebugInfo/debugify-each.ll
>> URL: http://llvm.org/viewvc/llvm-
>> project/llvm/trunk/test/DebugInfo/debugify-
>> each.ll?rev=332416&r1=332415&r2=332416&view=diff
>> ==========================================================================
>> ====
>> --- llvm/trunk/test/DebugInfo/debugify-each.ll (original)
>> +++ llvm/trunk/test/DebugInfo/debugify-each.ll Tue May 15 16:38:05 2018
>> @@ -11,14 +11,14 @@ define void @bar() {
>> 
>> ; Verify that the module & function (check-)debugify passes run at least
>> twice.
>> 
>> -; CHECK-DAG: CheckModuleDebugify: PASS
>> -; CHECK-DAG: CheckFunctionDebugify: PASS
>> -; CHECK-DAG: CheckFunctionDebugify: PASS
>> -; CHECK-DAG: CheckFunctionDebugify: PASS
>> -; CHECK-DAG: CheckFunctionDebugify: PASS
>> +; CHECK-DAG: CheckModuleDebugify [{{.*}}]: PASS
>> +; CHECK-DAG: CheckFunctionDebugify [{{.*}}]: PASS
>> +; CHECK-DAG: CheckFunctionDebugify [{{.*}}]: PASS
>> +; CHECK-DAG: CheckFunctionDebugify [{{.*}}]: PASS
>> +; CHECK-DAG: CheckFunctionDebugify [{{.*}}]: PASS
> 
> I won't say this change is wrong, but the test wasn't doing
> the intuitive thing in the first place.  Repeated CHECK-DAG
> directives will match the same string over and over, not
> verify that it occurs N times.
> 
> See Joel Denny's RFC about CHECK-DAG, with that change to
> FileCheck this test will probably start doing what you want.
> http://lists.llvm.org/pipermail/llvm-dev/2018-May/123010.html <http://lists.llvm.org/pipermail/llvm-dev/2018-May/123010.html>
> --paulr
> 
>> 
>> -; CHECK-DAG: CheckModuleDebugify: PASS
>> -; CHECK-DAG: CheckFunctionDebugify: PASS
>> -; CHECK-DAG: CheckFunctionDebugify: PASS
>> -; CHECK-DAG: CheckFunctionDebugify: PASS
>> -; CHECK-DAG: CheckFunctionDebugify: PASS
>> +; CHECK-DAG: CheckModuleDebugify [{{.*}}]: PASS
>> +; CHECK-DAG: CheckFunctionDebugify [{{.*}}]: PASS
>> +; CHECK-DAG: CheckFunctionDebugify [{{.*}}]: PASS
>> +; CHECK-DAG: CheckFunctionDebugify [{{.*}}]: PASS
>> +; CHECK-DAG: CheckFunctionDebugify [{{.*}}]: PASS
>> 
>> Modified: llvm/trunk/test/DebugInfo/debugify.ll
>> URL: http://llvm.org/viewvc/llvm-
>> project/llvm/trunk/test/DebugInfo/debugify.ll?rev=332416&r1=332415&r2=3324
>> 16&view=diff
>> ==========================================================================
>> ====
>> --- llvm/trunk/test/DebugInfo/debugify.ll (original)
>> +++ llvm/trunk/test/DebugInfo/debugify.ll Tue May 15 16:38:05 2018
>> @@ -80,6 +80,6 @@ define weak_odr zeroext i1 @baz() {
>> ; CHECK-FAIL: WARNING: Missing line 3
>> ; CHECK-FAIL: WARNING: Missing line 4
>> ; CHECK-FAIL: ERROR: Missing variable 1
>> -; CHECK-FAIL: CheckModuleDebugify: FAIL
>> +; CHECK-FAIL: CheckModuleDebugify [{{.*}}]: FAIL
>> 
>> -; PASS: CheckModuleDebugify: PASS
>> +; PASS: CheckModuleDebugify [{{.*}}]: PASS
>> 
>> Modified: llvm/trunk/tools/opt/Debugify.cpp
>> URL: http://llvm.org/viewvc/llvm-
>> project/llvm/trunk/tools/opt/Debugify.cpp?rev=332416&r1=332415&r2=332416&v
>> iew=diff
>> ==========================================================================
>> ====
>> --- llvm/trunk/tools/opt/Debugify.cpp (original)
>> +++ llvm/trunk/tools/opt/Debugify.cpp Tue May 15 16:38:05 2018
>> @@ -126,6 +126,7 @@ bool applyDebugifyMetadata(Module &M,
>> 
>> bool checkDebugifyMetadata(Module &M,
>>                            iterator_range<Module::iterator> Functions,
>> +                           StringRef NameOfWrappedPass,
>>                            StringRef Banner,
>>                            bool Strip) {
>>   // Skip modules without debugify metadata.
>> @@ -190,7 +191,8 @@ bool checkDebugifyMetadata(Module &M,
>>     outs() << "ERROR: Missing variable " << Idx + 1 << "\n";
>>   HasErrors |= MissingVars.count() > 0;
>> 
>> -  outs() << Banner << (HasErrors ? "FAIL" : "PASS") << '\n';
>> +  outs() << Banner << " [" << NameOfWrappedPass << "]: "
>> +         << (HasErrors ? "FAIL" : "PASS") << '\n';
>>   if (HasErrors) {
>>     outs() << "Module IR Dump\n";
>>     M.print(outs(), nullptr, false);
>> @@ -245,16 +247,18 @@ struct DebugifyFunctionPass : public Fun
>> /// legacy module pass manager.
>> struct CheckDebugifyModulePass : public ModulePass {
>>   bool runOnModule(Module &M) override {
>> -    return checkDebugifyMetadata(M, M.functions(), "CheckModuleDebugify:
>> ",
>> -                                 Strip);
>> +    return checkDebugifyMetadata(M, M.functions(), NameOfWrappedPass,
>> +                                 "CheckModuleDebugify", Strip);
>>   }
>> 
>> -  CheckDebugifyModulePass(bool Strip = false) : ModulePass(ID),
>> Strip(Strip) {}
>> +  CheckDebugifyModulePass(bool Strip = false, StringRef NameOfWrappedPass
>> = "")
>> +      : ModulePass(ID), Strip(Strip),
>> NameOfWrappedPass(NameOfWrappedPass) {}
>> 
>>   static char ID; // Pass identification.
>> 
>> private:
>>   bool Strip;
>> +  StringRef NameOfWrappedPass;
>> };
>> 
>> /// FunctionPass for checking debug info inserted by -debugify-function,
>> used
>> @@ -264,10 +268,11 @@ struct CheckDebugifyFunctionPass : publi
>>     Module &M = *F.getParent();
>>     auto FuncIt = F.getIterator();
>>     return checkDebugifyMetadata(M, make_range(FuncIt,
>> std::next(FuncIt)),
>> -                     "CheckFunctionDebugify: ", Strip);
>> +                                 NameOfWrappedPass,
>> "CheckFunctionDebugify", Strip);
>>   }
>> 
>> -  CheckDebugifyFunctionPass(bool Strip = false) : FunctionPass(ID),
>> Strip(Strip) {}
>> +  CheckDebugifyFunctionPass(bool Strip = false, StringRef
>> NameOfWrappedPass = "")
>> +      : FunctionPass(ID), Strip(Strip),
>> NameOfWrappedPass(NameOfWrappedPass) {}
>> 
>>   void getAnalysisUsage(AnalysisUsage &AU) const override {
>>     AU.setPreservesAll();
>> @@ -277,6 +282,7 @@ struct CheckDebugifyFunctionPass : publi
>> 
>> private:
>>   bool Strip;
>> +  StringRef NameOfWrappedPass;
>> };
>> 
>> } // end anonymous namespace
>> @@ -294,17 +300,17 @@ PreservedAnalyses NewPMDebugifyPass::run
>>   return PreservedAnalyses::all();
>> }
>> 
>> -ModulePass *createCheckDebugifyModulePass(bool Strip) {
>> -  return new CheckDebugifyModulePass(Strip);
>> +ModulePass *createCheckDebugifyModulePass(bool Strip, StringRef
>> NameOfWrappedPass) {
>> +  return new CheckDebugifyModulePass(Strip, NameOfWrappedPass);
>> }
>> 
>> -FunctionPass *createCheckDebugifyFunctionPass(bool Strip) {
>> -  return new CheckDebugifyFunctionPass(Strip);
>> +FunctionPass *createCheckDebugifyFunctionPass(bool Strip, StringRef
>> NameOfWrappedPass) {
>> +  return new CheckDebugifyFunctionPass(Strip, NameOfWrappedPass);
>> }
>> 
>> PreservedAnalyses NewPMCheckDebugifyPass::run(Module &M,
>>                                               ModuleAnalysisManager &) {
>> -  checkDebugifyMetadata(M, M.functions(), "CheckModuleDebugify: ",
>> false);
>> +  checkDebugifyMetadata(M, M.functions(), "", "CheckModuleDebugify",
>> false);
>>   return PreservedAnalyses::all();
>> }
>> 
>> 
>> Modified: llvm/trunk/tools/opt/PassPrinters.h
>> URL: http://llvm.org/viewvc/llvm-
>> project/llvm/trunk/tools/opt/PassPrinters.h?rev=332416&r1=332415&r2=332416
>> &view=diff
>> ==========================================================================
>> ====
>> --- llvm/trunk/tools/opt/PassPrinters.h (original)
>> +++ llvm/trunk/tools/opt/PassPrinters.h Tue May 15 16:38:05 2018
>> @@ -56,8 +56,13 @@ struct NewPMDebugifyPass : public llvm::
>>   llvm::PreservedAnalyses run(llvm::Module &M,
>> llvm::ModuleAnalysisManager &AM);
>> };
>> 
>> -llvm::ModulePass *createCheckDebugifyModulePass(bool Strip = false);
>> -llvm::FunctionPass *createCheckDebugifyFunctionPass(bool Strip = false);
>> +llvm::ModulePass *
>> +createCheckDebugifyModulePass(bool Strip = false,
>> +                              llvm::StringRef NameOfWrappedPass = "");
>> +
>> +llvm::FunctionPass *
>> +createCheckDebugifyFunctionPass(bool Strip = false,
>> +                                llvm::StringRef NameOfWrappedPass = "");
>> 
>> struct NewPMCheckDebugifyPass
>>     : public llvm::PassInfoMixin<NewPMCheckDebugifyPass> {
>> 
>> Modified: llvm/trunk/tools/opt/opt.cpp
>> URL: http://llvm.org/viewvc/llvm-
>> project/llvm/trunk/tools/opt/opt.cpp?rev=332416&r1=332415&r2=332416&view=d
>> iff
>> ==========================================================================
>> ====
>> --- llvm/trunk/tools/opt/opt.cpp (original)
>> +++ llvm/trunk/tools/opt/opt.cpp Tue May 15 16:38:05 2018
>> @@ -278,12 +278,12 @@ public:
>>       case PT_Function:
>>         super::add(createDebugifyFunctionPass());
>>         super::add(P);
>> -        super::add(createCheckDebugifyFunctionPass(true));
>> +        super::add(createCheckDebugifyFunctionPass(true, P-
>>> getPassName()));
>>         break;
>>       case PT_Module:
>>         super::add(createDebugifyModulePass());
>>         super::add(P);
>> -        super::add(createCheckDebugifyModulePass(true));
>> +        super::add(createCheckDebugifyModulePass(true, P-
>>> getPassName()));
>>         break;
>>       default:
>>         super::add(P);
>> 
>> 
>> _______________________________________________
>> llvm-commits mailing list
>> llvm-commits at lists.llvm.org
>> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org <mailto:llvm-commits at lists.llvm.org>
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits <http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180516/ea092f3c/attachment.html>


More information about the llvm-commits mailing list