Index: lib/CodeGen/GlobalISel/Legalizer.cpp =================================================================== --- lib/CodeGen/GlobalISel/Legalizer.cpp +++ lib/CodeGen/GlobalISel/Legalizer.cpp @@ -185,7 +185,13 @@ LegalizerHelper::LegalizeResult Res; unsigned Idx = 0; do { - Res = Helper.legalizeInstrStep(*WorkList[Idx]); + // Only legalize pre-isel generic instructions. + // Legalization process could generate Target specific pseudo + // instructions with generic types. Don't legalize them + if (!isPreISelGenericOpcode(WorkList[Idx]->getOpcode())) + Res = LegalizerHelper::AlreadyLegal; + else + Res = Helper.legalizeInstrStep(*WorkList[Idx]); // Error out if we couldn't legalize this instruction. We may want to // fall back to DAG ISel instead in the future. if (Res == LegalizerHelper::UnableToLegalize) {