File tree Expand file tree Collapse file tree 1 file changed +12
-1
lines changed
Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -78,8 +78,19 @@ bool StaticDataAnnotator::runOnModule(Module &M) {
7878 if (!llvm::memprof::IsAnnotationOK (GV))
7979 continue ;
8080
81+ // The implementation below assumes prior passes don't set section prefixes,
82+ // and specifically do 'assign' rather than 'update'. So report error if a
83+ // section prefix is already set.
84+ if (auto maybeSectionPrefix = GV.getSectionPrefix ();
85+ maybeSectionPrefix && !maybeSectionPrefix->empty ())
86+ llvm::report_fatal_error (" Global variable " + GV.getName () +
87+ " already has a section prefix " +
88+ *maybeSectionPrefix);
89+
8190 StringRef SectionPrefix = SDPI->getConstantSectionPrefix (&GV, PSI);
82- // setSectionPrefix returns true if the section prefix is changed.
91+ if (SectionPrefix.empty ())
92+ continue ;
93+
8394 Changed |= GV.setSectionPrefix (SectionPrefix);
8495 }
8596
You can’t perform that action at this time.
0 commit comments