This is an archive of the discontinued LLVM Phabricator instance.

[llvm-mca] Fix class dominance warnings for parseCodeRegions
ClosedPublic

Authored by michaelmaitland on Nov 21 2022, 4:11 PM.

Details

Summary

Fixes issue 59091.

CodeRegionGenerator::parseCodeRegions is implemented by AsmCodeRegionGenerator.
If it were to be implemented in AnalysisRegionGenerator or InstrumentRegionGenerator,
then parseCodeRegions from an AsmAnalysisRegionGenerator or AsmInstrumentRegionGenerator
object would be ambiguous. To solve this, AsmAnalysisRegionGenerator and
AsmInstrumentRegionGenerator qualify their call to AsmCodeRegionGenerator::parseCodeRegions.

Diff Detail

Event Timeline

Herald added a project: Restricted Project. · View Herald TranscriptNov 21 2022, 4:11 PM
Herald added a subscriber: gbedwell. · View Herald Transcript
michaelmaitland requested review of this revision.Nov 21 2022, 4:11 PM
Herald added a project: Restricted Project. · View Herald TranscriptNov 21 2022, 4:11 PM

@RKSimon, I'm not quite sure how to make one of these MSVC builds. But I used godbolt.org with the following snippet to verify the issue went away:

#include <stdio.h>
struct CRG {
   virtual void func() = 0;
};
struct AnalysisCRG : public virtual CRG {};
struct InstCRG : public virtual CRG {};
struct AsmCRG : public virtual CRG {
    void func() { printf("dominant::func\n"); }
};

struct AsmAnalysisCRG final : public AnalysisCRG, public AsmCRG {
     void func() { AsmCRG::func(); }
};
struct AsmInstCRG final : public InstCRG, public AsmCRG {
    void func() { AsmCRG::func(); }
};

int main() {
   AsmAnalysisCRG a;
   AsmInstCRG i;

   a.func();   // C4250 should go away now
   i.func(); // C4250 should go away now
}
myhsu accepted this revision.Nov 21 2022, 9:44 PM

I just quickly tried this with /W3 on MSVC 2019 and the warning no longer appears. Cheers

This revision is now accepted and ready to land.Nov 21 2022, 9:44 PM
This revision was landed with ongoing or failed builds.Nov 22 2022, 12:31 PM
This revision was automatically updated to reflect the committed changes.