diff --git a/utils/TableGen/GICombinerEmitter.cpp b/utils/TableGen/GICombinerEmitter.cpp index 7a9c87b6b93..a85462b5aa8 100644 --- a/utils/TableGen/GICombinerEmitter.cpp +++ b/utils/TableGen/GICombinerEmitter.cpp @@ -31,7 +31,8 @@ class GICombinerEmitter { StringRef Name; Record *Combiner; public: - explicit GICombinerEmitter(RecordKeeper &RK, StringRef Name); + explicit GICombinerEmitter(RecordKeeper &RK, StringRef Name, + Record *Combiner); ~GICombinerEmitter() {} StringRef getClassName() const { @@ -41,8 +42,9 @@ public: }; -GICombinerEmitter::GICombinerEmitter(RecordKeeper &RK, StringRef Name) - : Name(Name), Combiner(RK.getDef(Name)) {} +GICombinerEmitter::GICombinerEmitter(RecordKeeper &RK, StringRef Name, + Record *Combiner) + : Name(Name), Combiner(Combiner) {} void GICombinerEmitter::run(raw_ostream &OS) { NamedRegionTimer T("Emit", "Time spent emitting the combiner", @@ -87,8 +89,12 @@ void EmitGICombiner(RecordKeeper &RK, raw_ostream &OS) { if (SelectedCombiners.empty()) PrintFatalError("No combiners selected with -combiners"); - for (const auto &Combiner : SelectedCombiners) - GICombinerEmitter(RK, Combiner).run(OS); + for (const auto &Combiner : SelectedCombiners) { + Record *CombinerDef = RK.getDef(Combiner); + if (!CombinerDef) + PrintFatalError("Could not find " + Combiner); + GICombinerEmitter(RK, Combiner, CombinerDef).run(OS); + } } } // namespace llvm