Index: lib/CodeGen/ModuleBuilder.cpp =================================================================== --- lib/CodeGen/ModuleBuilder.cpp +++ lib/CodeGen/ModuleBuilder.cpp @@ -131,6 +131,18 @@ Ctx = &Context; M->setTargetTriple(Ctx->getTargetInfo().getTriple().getTriple()); + + // The target device information is represented as module level + // attribute. + SmallString<128> Res; + for (auto &Device : Ctx->getLangOpts().OMPTargetTriples) { + if (!Res.empty()) + Res += ","; + Res += Device.getTriple(); + } + if (!Res.empty()) + M->setTargetDevices(Res); + M->setDataLayout(Ctx->getTargetInfo().getDataLayout()); Builder.reset(new CodeGen::CodeGenModule(Context, HeaderSearchOpts, PreprocessorOpts, CodeGenOpts,