diff --git a/cbackend.cpp b/cbackend.cpp index 7a8f7c78..ad0ba32a 100644 --- a/cbackend.cpp +++ b/cbackend.cpp @@ -198,7 +198,6 @@ inline constant_iterator constant_end(const llvm::Function *F) { } /////////////////////////////////////////////////////////////////////////////// - // FIXME: namespace { /// TypeFinder - Walk over a module, identifying all of the types that are @@ -1811,10 +1810,21 @@ void CWriter::printConstant(llvm::Constant *CPV, bool Static) { } else { Out << '('; if (CPV->getNumOperands()) { + // It is a kludge. It is needed because we cannot support short vectors + // when generating code for knl-generic in multitarget mode. + // Short vectors are mapped to "native" vectors and cause AVX-512 code + // generation in static block initialization (__vec16_* in ::init function). + bool isGenericKNL = g->target->getISA() == Target::GENERIC && + !g->target->getTreatGenericAsSmth().empty() && + g->mangleFunctionsWithTarget; + if (isGenericKNL && CPV->getOperand(0)->getType()->isVectorTy()) + llvm::report_fatal_error("knl-generic-* target doesn's support short vectors"); Out << ' '; printConstant(llvm::cast(CPV->getOperand(0)), Static); for (unsigned i = 1, e = CPV->getNumOperands(); i != e; ++i) { Out << ", "; + if (isGenericKNL && CPV->getOperand(i)->getType()->isVectorTy()) + llvm::report_fatal_error("knl-generic-* target doesn's support short vectors"); printConstant(llvm::cast(CPV->getOperand(i)), Static); } }