Skip to content

[flang] Implement -mcmodel flag #95411

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Jul 3, 2024
Merged

Conversation

DavidTruby
Copy link
Member

@DavidTruby DavidTruby commented Jun 13, 2024

This patch implements the -mcmodel flag from clang, allowing the Code Model to
be changed for the LLVM module. The same set of mcmodel flags are accepted as
in clang and the same Code Model attributes are added to the LLVM module for
those flags.

Also add -mlarge-data-threshold for x86-64, which is automatically set by the shared command-line
code (see below). This is also added as an attribute into the LLVM moduel and on the target machine.

A function is created for addMCModel that is copied out of clang's argument handling
so that it can be shared with flang.

This patch implements the -mcmodel flag from clang, allowing the Code Model to
be changed for the LLVM module. The same set of mcmodel flags are accepted as
in clang and the same Code Model attributes are added to the LLVM module for
those flags.
@DavidTruby DavidTruby requested a review from banach-space June 13, 2024 14:05
@llvmbot llvmbot added clang Clang issues not falling into any other category clang:driver 'clang' and 'clang++' user-facing binaries. Not 'clang-cl' flang:driver flang Flang issues not falling into any other category flang:fir-hlfir labels Jun 13, 2024
@llvmbot
Copy link
Member

llvmbot commented Jun 13, 2024

@llvm/pr-subscribers-clang
@llvm/pr-subscribers-flang-fir-hlfir

@llvm/pr-subscribers-flang-driver

Author: David Truby (DavidTruby)

Changes

This patch implements the -mcmodel flag from clang, allowing the Code Model to
be changed for the LLVM module. The same set of mcmodel flags are accepted as
in clang and the same Code Model attributes are added to the LLVM module for
those flags.


Full diff: https://github.com/llvm/llvm-project/pull/95411.diff

10 Files Affected:

  • (modified) clang/include/clang/Driver/Options.td (+1-1)
  • (modified) clang/lib/Driver/ToolChains/Clang.cpp (+1-75)
  • (modified) clang/lib/Driver/ToolChains/CommonArgs.cpp (+81)
  • (modified) clang/lib/Driver/ToolChains/CommonArgs.h (+4)
  • (modified) clang/lib/Driver/ToolChains/Flang.cpp (+5)
  • (modified) flang/include/flang/Frontend/CodeGenOptions.def (+1)
  • (modified) flang/lib/Frontend/CompilerInvocation.cpp (+21)
  • (modified) flang/lib/Frontend/FrontendActions.cpp (+3)
  • (added) flang/test/Driver/mcmodel.f90 (+44)
  • (added) flang/test/Lower/mcmodel.f90 (+16)
diff --git a/clang/include/clang/Driver/Options.td b/clang/include/clang/Driver/Options.td
index 9f7904dd94b94..4087d3b95cc39 100644
--- a/clang/include/clang/Driver/Options.td
+++ b/clang/include/clang/Driver/Options.td
@@ -4600,7 +4600,7 @@ def inline_asm_EQ : Joined<["-"], "inline-asm=">, Group<m_Group>,
   NormalizedValuesScope<"CodeGenOptions">, NormalizedValues<["IAD_ATT", "IAD_Intel"]>,
   MarshallingInfoEnum<CodeGenOpts<"InlineAsmDialect">, "IAD_ATT">;
 def mcmodel_EQ : Joined<["-"], "mcmodel=">, Group<m_Group>,
-  Visibility<[ClangOption, CC1Option]>,
+  Visibility<[ClangOption, CC1Option, FlangOption, FC1Option]>,
   MarshallingInfoString<TargetOpts<"CodeModel">, [{"default"}]>;
 def mlarge_data_threshold_EQ : Joined<["-"], "mlarge-data-threshold=">, Group<m_Group>,
   Flags<[TargetSpecific]>, Visibility<[ClangOption, CC1Option]>,
diff --git a/clang/lib/Driver/ToolChains/Clang.cpp b/clang/lib/Driver/ToolChains/Clang.cpp
index 1f8591537b6c8..0447581128cd1 100644
--- a/clang/lib/Driver/ToolChains/Clang.cpp
+++ b/clang/lib/Driver/ToolChains/Clang.cpp
@@ -5908,81 +5908,7 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
 
   TC.addClangTargetOptions(Args, CmdArgs, JA.getOffloadingDeviceKind());
 
-  if (Arg *A = Args.getLastArg(options::OPT_mcmodel_EQ)) {
-    StringRef CM = A->getValue();
-    bool Ok = false;
-    if (Triple.isOSAIX() && CM == "medium")
-      CM = "large";
-    if (Triple.isAArch64(64)) {
-      Ok = CM == "tiny" || CM == "small" || CM == "large";
-      if (CM == "large" && !Triple.isOSBinFormatMachO() &&
-          RelocationModel != llvm::Reloc::Static)
-        D.Diag(diag::err_drv_argument_only_allowed_with)
-            << A->getAsString(Args) << "-fno-pic";
-    } else if (Triple.isLoongArch()) {
-      if (CM == "extreme" &&
-          Args.hasFlagNoClaim(options::OPT_fplt, options::OPT_fno_plt, false))
-        D.Diag(diag::err_drv_argument_not_allowed_with)
-            << A->getAsString(Args) << "-fplt";
-      Ok = CM == "normal" || CM == "medium" || CM == "extreme";
-      // Convert to LLVM recognizable names.
-      if (Ok)
-        CM = llvm::StringSwitch<StringRef>(CM)
-                 .Case("normal", "small")
-                 .Case("extreme", "large")
-                 .Default(CM);
-    } else if (Triple.isPPC64() || Triple.isOSAIX()) {
-      Ok = CM == "small" || CM == "medium" || CM == "large";
-    } else if (Triple.isRISCV()) {
-      if (CM == "medlow")
-        CM = "small";
-      else if (CM == "medany")
-        CM = "medium";
-      Ok = CM == "small" || CM == "medium";
-    } else if (Triple.getArch() == llvm::Triple::x86_64) {
-      Ok = llvm::is_contained({"small", "kernel", "medium", "large", "tiny"},
-                              CM);
-    } else if (Triple.isNVPTX() || Triple.isAMDGPU() || Triple.isSPIRV()) {
-      // NVPTX/AMDGPU/SPIRV does not care about the code model and will accept
-      // whatever works for the host.
-      Ok = true;
-    } else if (Triple.isSPARC64()) {
-      if (CM == "medlow")
-        CM = "small";
-      else if (CM == "medmid")
-        CM = "medium";
-      else if (CM == "medany")
-        CM = "large";
-      Ok = CM == "small" || CM == "medium" || CM == "large";
-    }
-    if (Ok) {
-      CmdArgs.push_back(Args.MakeArgString("-mcmodel=" + CM));
-    } else {
-      D.Diag(diag::err_drv_unsupported_option_argument_for_target)
-          << A->getSpelling() << CM << TripleStr;
-    }
-  }
-
-  if (Triple.getArch() == llvm::Triple::x86_64) {
-    bool IsMediumCM = false;
-    bool IsLargeCM = false;
-    if (Arg *A = Args.getLastArg(options::OPT_mcmodel_EQ)) {
-      IsMediumCM = StringRef(A->getValue()) == "medium";
-      IsLargeCM = StringRef(A->getValue()) == "large";
-    }
-    if (Arg *A = Args.getLastArg(options::OPT_mlarge_data_threshold_EQ)) {
-      if (!IsMediumCM && !IsLargeCM) {
-        D.Diag(diag::warn_drv_large_data_threshold_invalid_code_model)
-            << A->getOption().getRenderName();
-      } else {
-        A->render(Args, CmdArgs);
-      }
-    } else if (IsMediumCM) {
-      CmdArgs.push_back("-mlarge-data-threshold=65536");
-    } else if (IsLargeCM) {
-      CmdArgs.push_back("-mlarge-data-threshold=0");
-    }
-  }
+  addMCModel(D, Args, Triple, RelocationModel, CmdArgs);
 
   if (Arg *A = Args.getLastArg(options::OPT_mtls_size_EQ)) {
     StringRef Value = A->getValue();
diff --git a/clang/lib/Driver/ToolChains/CommonArgs.cpp b/clang/lib/Driver/ToolChains/CommonArgs.cpp
index 2a4c1369f5a73..a33975e14c541 100644
--- a/clang/lib/Driver/ToolChains/CommonArgs.cpp
+++ b/clang/lib/Driver/ToolChains/CommonArgs.cpp
@@ -2823,3 +2823,84 @@ void tools::addOffloadCompressArgs(const llvm::opt::ArgList &TCArgs,
     CmdArgs.push_back(
         TCArgs.MakeArgString(Twine("-compression-level=") + Arg->getValue()));
 }
+
+void tools::addMCModel(const Driver &D, const llvm::opt::ArgList &Args,
+                       const llvm::Triple &Triple,
+                       const llvm::Reloc::Model &RelocationModel,
+                       llvm::opt::ArgStringList &CmdArgs) {
+  if (Arg *A = Args.getLastArg(options::OPT_mcmodel_EQ)) {
+    StringRef CM = A->getValue();
+    bool Ok = false;
+    if (Triple.isOSAIX() && CM == "medium")
+      CM = "large";
+    if (Triple.isAArch64(64)) {
+      Ok = CM == "tiny" || CM == "small" || CM == "large";
+      if (CM == "large" && !Triple.isOSBinFormatMachO() &&
+          RelocationModel != llvm::Reloc::Static)
+        D.Diag(diag::err_drv_argument_only_allowed_with)
+            << A->getAsString(Args) << "-fno-pic";
+    } else if (Triple.isLoongArch()) {
+      if (CM == "extreme" &&
+          Args.hasFlagNoClaim(options::OPT_fplt, options::OPT_fno_plt, false))
+        D.Diag(diag::err_drv_argument_not_allowed_with)
+            << A->getAsString(Args) << "-fplt";
+      Ok = CM == "normal" || CM == "medium" || CM == "extreme";
+      // Convert to LLVM recognizable names.
+      if (Ok)
+        CM = llvm::StringSwitch<StringRef>(CM)
+                 .Case("normal", "small")
+                 .Case("extreme", "large")
+                 .Default(CM);
+    } else if (Triple.isPPC64() || Triple.isOSAIX()) {
+      Ok = CM == "small" || CM == "medium" || CM == "large";
+    } else if (Triple.isRISCV()) {
+      if (CM == "medlow")
+        CM = "small";
+      else if (CM == "medany")
+        CM = "medium";
+      Ok = CM == "small" || CM == "medium";
+    } else if (Triple.getArch() == llvm::Triple::x86_64) {
+      Ok = llvm::is_contained({"small", "kernel", "medium", "large", "tiny"},
+                              CM);
+    } else if (Triple.isNVPTX() || Triple.isAMDGPU() || Triple.isSPIRV()) {
+      // NVPTX/AMDGPU/SPIRV does not care about the code model and will accept
+      // whatever works for the host.
+      Ok = true;
+    } else if (Triple.isSPARC64()) {
+      if (CM == "medlow")
+        CM = "small";
+      else if (CM == "medmid")
+        CM = "medium";
+      else if (CM == "medany")
+        CM = "large";
+      Ok = CM == "small" || CM == "medium" || CM == "large";
+    }
+    if (Ok) {
+      CmdArgs.push_back(Args.MakeArgString("-mcmodel=" + CM));
+    } else {
+      D.Diag(diag::err_drv_unsupported_option_argument_for_target)
+          << A->getSpelling() << CM << Triple.getTriple();
+    }
+  }
+
+  if (Triple.getArch() == llvm::Triple::x86_64) {
+    bool IsMediumCM = false;
+    bool IsLargeCM = false;
+    if (Arg *A = Args.getLastArg(options::OPT_mcmodel_EQ)) {
+      IsMediumCM = StringRef(A->getValue()) == "medium";
+      IsLargeCM = StringRef(A->getValue()) == "large";
+    }
+    if (Arg *A = Args.getLastArg(options::OPT_mlarge_data_threshold_EQ)) {
+      if (!IsMediumCM && !IsLargeCM) {
+        D.Diag(diag::warn_drv_large_data_threshold_invalid_code_model)
+            << A->getOption().getRenderName();
+      } else {
+        A->render(Args, CmdArgs);
+      }
+    } else if (IsMediumCM) {
+      CmdArgs.push_back("-mlarge-data-threshold=65536");
+    } else if (IsLargeCM) {
+      CmdArgs.push_back("-mlarge-data-threshold=0");
+    }
+  }
+}
diff --git a/clang/lib/Driver/ToolChains/CommonArgs.h b/clang/lib/Driver/ToolChains/CommonArgs.h
index 5581905db3114..52818ecde924b 100644
--- a/clang/lib/Driver/ToolChains/CommonArgs.h
+++ b/clang/lib/Driver/ToolChains/CommonArgs.h
@@ -223,6 +223,10 @@ void addOutlineAtomicsArgs(const Driver &D, const ToolChain &TC,
                            const llvm::Triple &Triple);
 void addOffloadCompressArgs(const llvm::opt::ArgList &TCArgs,
                             llvm::opt::ArgStringList &CmdArgs);
+void addMCModel(const Driver &D, const llvm::opt::ArgList &Args,
+                const llvm::Triple &Triple,
+                const llvm::Reloc::Model &RelocationModel,
+                llvm::opt::ArgStringList &CmdArgs);
 
 } // end namespace tools
 } // end namespace driver
diff --git a/clang/lib/Driver/ToolChains/Flang.cpp b/clang/lib/Driver/ToolChains/Flang.cpp
index 42b45dba2bd31..962a6c2c6b298 100644
--- a/clang/lib/Driver/ToolChains/Flang.cpp
+++ b/clang/lib/Driver/ToolChains/Flang.cpp
@@ -735,6 +735,11 @@ void Flang::ConstructJob(Compilation &C, const JobAction &JA,
   // Add target args, features, etc.
   addTargetOptions(Args, CmdArgs);
 
+  llvm::Reloc::Model RelocationModel =
+      std::get<0>(ParsePICArgs(getToolChain(), Args));
+  // Add MCModel information
+  addMCModel(D, Args, Triple, RelocationModel, CmdArgs);
+
   // Add Codegen options
   addCodegenOptions(Args, CmdArgs);
 
diff --git a/flang/include/flang/Frontend/CodeGenOptions.def b/flang/include/flang/Frontend/CodeGenOptions.def
index 9d03ec88a56b8..5d364e6655b99 100644
--- a/flang/include/flang/Frontend/CodeGenOptions.def
+++ b/flang/include/flang/Frontend/CodeGenOptions.def
@@ -39,6 +39,7 @@ ENUM_CODEGENOPT(RelocationModel, llvm::Reloc::Model, 3, llvm::Reloc::PIC_) ///<
 ENUM_CODEGENOPT(DebugInfo,  llvm::codegenoptions::DebugInfoKind, 4,  llvm::codegenoptions::NoDebugInfo) ///< Level of debug info to generate
 ENUM_CODEGENOPT(VecLib, llvm::driver::VectorLibrary, 3, llvm::driver::VectorLibrary::NoLibrary) ///< Vector functions library to use
 ENUM_CODEGENOPT(FramePointer, llvm::FramePointerKind, 2, llvm::FramePointerKind::None) ///< Enable the usage of frame pointers
+ENUM_CODEGENOPT(CodeModel, llvm::CodeModel::Model, 5, llvm::CodeModel::Model::Small)
 
 #undef CODEGENOPT
 #undef ENUM_CODEGENOPT
diff --git a/flang/lib/Frontend/CompilerInvocation.cpp b/flang/lib/Frontend/CompilerInvocation.cpp
index f64a939b785ef..5c27088ec3890 100644
--- a/flang/lib/Frontend/CompilerInvocation.cpp
+++ b/flang/lib/Frontend/CompilerInvocation.cpp
@@ -32,6 +32,7 @@
 #include "llvm/Option/Arg.h"
 #include "llvm/Option/ArgList.h"
 #include "llvm/Option/OptTable.h"
+#include "llvm/Support/CodeGen.h"
 #include "llvm/Support/FileSystem.h"
 #include "llvm/Support/FileUtilities.h"
 #include "llvm/Support/Path.h"
@@ -381,6 +382,26 @@ static void parseCodeGenArgs(Fortran::frontend::CodeGenOptions &opts,
       opts.IsPIE = 1;
   }
 
+  // -mcmodel option.
+  if (const llvm::opt::Arg *a =
+          args.getLastArg(clang::driver::options::OPT_mcmodel_EQ)) {
+    llvm::StringRef modelName = a->getValue();
+    auto codeModel =
+        llvm::StringSwitch<std::optional<llvm::CodeModel::Model>>(modelName)
+            .Case("tiny", llvm::CodeModel::Model::Tiny)
+            .Case("small", llvm::CodeModel::Model::Small)
+            .Case("kernel", llvm::CodeModel::Model::Kernel)
+            .Case("medium", llvm::CodeModel::Model::Medium)
+            .Case("large", llvm::CodeModel::Model::Large)
+            .Default(std::nullopt);
+
+    if (codeModel.has_value())
+      opts.setCodeModel(*codeModel);
+    else
+      diags.Report(clang::diag::err_drv_invalid_value)
+          << a->getAsString(args) << modelName;
+  }
+
   // This option is compatible with -f[no-]underscoring in gfortran.
   if (args.hasFlag(clang::driver::options::OPT_fno_underscoring,
                    clang::driver::options::OPT_funderscoring, false)) {
diff --git a/flang/lib/Frontend/FrontendActions.cpp b/flang/lib/Frontend/FrontendActions.cpp
index b1b6391f1439c..b5c1792850fe3 100644
--- a/flang/lib/Frontend/FrontendActions.cpp
+++ b/flang/lib/Frontend/FrontendActions.cpp
@@ -861,6 +861,9 @@ void CodeGenAction::generateLLVMIR() {
       llvmModule->setPIELevel(
           static_cast<llvm::PIELevel::Level>(opts.PICLevel));
   }
+
+  // Set mcmodel level LLVM module flags
+  llvmModule->setCodeModel(opts.getCodeModel());
 }
 
 static std::unique_ptr<llvm::raw_pwrite_stream>
diff --git a/flang/test/Driver/mcmodel.f90 b/flang/test/Driver/mcmodel.f90
new file mode 100644
index 0000000000000..12d90ece2f24f
--- /dev/null
+++ b/flang/test/Driver/mcmodel.f90
@@ -0,0 +1,44 @@
+! RUN: not %flang -### -c --target=i686 -mcmodel=medium %s 2>&1 | FileCheck --check-prefix=ERR-MEDIUM %s
+! RUN: %flang --target=x86_64 -### -c -mcmodel=tiny %s 2>&1 | FileCheck --check-prefix=TINY %s
+! RUN: %flang --target=x86_64 -### -c -mcmodel=small %s 2>&1 | FileCheck --check-prefix=SMALL %s
+! RUN: %flang --target=x86_64 -### -S -mcmodel=kernel %s 2>&1 | FileCheck --check-prefix=KERNEL %s
+! RUN: %flang --target=x86_64 -### -c -mcmodel=medium %s 2>&1 | FileCheck --check-prefix=MEDIUM %s
+! RUN: %flang --target=x86_64 -### -S -mcmodel=large %s 2>&1 | FileCheck --check-prefix=LARGE %s
+! RUN: not %flang -### -c --target=powerpc-linux-gnu -mcmodel=medium %s 2>&1 | FileCheck --check-prefix=ERR-MEDIUM %s
+! RUN: %flang --target=powerpc-unknown-aix -### -S -mcmodel=small %s 2>&1 | FileCheck --check-prefix=SMALL %s
+! RUN: %flang --target=powerpc-unknown-aix -### -S -mcmodel=large %s 2>&1 | FileCheck --check-prefix=LARGE %s
+! RUN: %flang --target=powerpc-unknown-aix -### -S -mcmodel=medium %s 2> %t.log
+! RUN: FileCheck --check-prefix=AIX-MCMEDIUM-OVERRIDE %s < %t.log
+! RUN: not %flang -### -c -mcmodel=lager %s 2>&1 | FileCheck --check-prefix=INVALID %s
+! RUN: %flang --target=aarch64 -### -S -mcmodel=large -fno-pic %s 2>&1 | FileCheck --check-prefix=LARGE %s
+! RUN: %flang --target=aarch64-apple-macosx -### -S -mcmodel=large %s 2>&1 | FileCheck --check-prefix=LARGE %s
+! RUN: not %flang --target=aarch64 -### -S -mcmodel=large -fpic %s 2>&1 | FileCheck --check-prefix=AARCH64-PIC-LARGE %s
+! RUN: not %flang -### -c --target=aarch64 -mcmodel=medium %s 2>&1 | FileCheck --check-prefix=ERR-MEDIUM %s
+! RUN: not %flang -### -c --target=aarch64 -mcmodel=kernel %s 2>&1 | FileCheck --check-prefix=ERR-KERNEL %s
+! RUN: not %flang --target=aarch64_32-linux -### -S -mcmodel=small %s 2>&1 | FileCheck --check-prefix=ERR-AARCH64_32 %s
+! RUN: %flang --target=loongarch64 -### -S -mcmodel=normal %s 2>&1 | FileCheck --check-prefix=SMALL %s
+! RUN: %flang --target=loongarch64 -### -S -mcmodel=medium %s 2>&1 | FileCheck --check-prefix=MEDIUM %s
+! RUN: %flang --target=loongarch64 -### -S -mcmodel=extreme %s 2>&1 | FileCheck --check-prefix=LARGE %s
+! RUN: not %flang --target=loongarch64 -### -S -mcmodel=tiny %s 2>&1 | FileCheck --check-prefix=ERR-TINY %s
+! RUN: not %flang --target=loongarch64 -### -S -mcmodel=small %s 2>&1 | FileCheck --check-prefix=ERR-SMALL %s
+! RUN: not %flang --target=loongarch64 -### -S -mcmodel=kernel %s 2>&1 | FileCheck --check-prefix=ERR-KERNEL %s
+! RUN: not %flang --target=loongarch64 -### -S -mcmodel=large %s 2>&1 | FileCheck --check-prefix=ERR-LARGE %s
+
+! TINY: "-mcmodel=tiny"
+! SMALL: "-mcmodel=small"
+! KERNEL: "-mcmodel=kernel"
+! MEDIUM: "-mcmodel=medium"
+! LARGE: "-mcmodel=large"
+! AIX-MCMEDIUM-OVERRIDE: "-mcmodel=large"
+
+! INVALID: error: unsupported argument 'lager' to option '-mcmodel=' for target '{{.*}}'
+
+! ERR-TINY:   error: unsupported argument 'tiny' to option '-mcmodel=' for target '{{.*}}'
+! ERR-SMALL:  error: unsupported argument 'small' to option '-mcmodel=' for target '{{.*}}'
+! ERR-MEDIUM: error: unsupported argument 'medium' to option '-mcmodel=' for target '{{.*}}'
+! ERR-KERNEL: error: unsupported argument 'kernel' to option '-mcmodel=' for target '{{.*}}'
+! ERR-LARGE:  error: unsupported argument 'large' to option '-mcmodel=' for target '{{.*}}'
+
+! AARCH64-PIC-LARGE: error: invalid argument '-mcmodel=large' only allowed with '-fno-pic'
+! ERR-AARCH64_32: error: unsupported argument 'small' to option '-mcmodel=' for target 'aarch64_32-unknown-linux'
+
diff --git a/flang/test/Lower/mcmodel.f90 b/flang/test/Lower/mcmodel.f90
new file mode 100644
index 0000000000000..dd9eb145f5e2a
--- /dev/null
+++ b/flang/test/Lower/mcmodel.f90
@@ -0,0 +1,16 @@
+! RUN: %flang_fc1 -triple aarch64 -emit-llvm -mcmodel=tiny %s -o - | FileCheck %s -check-prefix=CHECK-TINY
+! RUN: %flang_fc1 -emit-llvm -mcmodel=small %s -o - | FileCheck %s -check-prefix=CHECK-SMALL
+! RUN: %flang_fc1 -triple x86_64-unknown-linux-gnu -emit-llvm -mcmodel=kernel %s -o - | FileCheck %s -check-prefix=CHECK-KERNEL
+! RUN: %flang_fc1 -triple x86_64-unknown-linux-gnu -emit-llvm -mcmodel=medium %s -o - | FileCheck %s -check-prefix=CHECK-MEDIUM
+! RUN: %flang_fc1 -emit-llvm -mcmodel=large %s -o - | FileCheck %s -check-prefix=CHECK-LARGE
+
+! CHECK-TINY: !llvm.module.flags = !{{{.*}}}
+! CHECK-TINY: !{{[0-9]+}} = !{i32 1, !"Code Model", i32 0}
+! CHECK-SMALL: !llvm.module.flags = !{{{.*}}}
+! CHECK-SMALL: !{{[0-9]+}} = !{i32 1, !"Code Model", i32 1}
+! CHECK-KERNEL: !llvm.module.flags = !{{{.*}}}
+! CHECK-KERNEL: !{{[0-9]+}} = !{i32 1, !"Code Model", i32 2}
+! CHECK-MEDIUM: !llvm.module.flags = !{{{.*}}}
+! CHECK-MEDIUM: !{{[0-9]+}} = !{i32 1, !"Code Model", i32 3}
+! CHECK-LARGE: !llvm.module.flags = !{{{.*}}}
+! CHECK-LARGE: !{{[0-9]+}} = !{i32 1, !"Code Model", i32 4}

Copy link
Contributor

@banach-space banach-space left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The high-level stuff makes sense to me, thanks! I'm not familiar with -mcmodel, so can't tell for sure whether the tests are correct 😅 Ideally one more person would take a look - @tblah or @pawosm-arm ?

@@ -2823,3 +2823,84 @@ void tools::addOffloadCompressArgs(const llvm::opt::ArgList &TCArgs,
CmdArgs.push_back(
TCArgs.MakeArgString(Twine("-compression-level=") + Arg->getValue()));
}

void tools::addMCModel(const Driver &D, const llvm::opt::ArgList &Args,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this taken verbatim from Clang? Would you mind documenting that in the summary?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it is a direct copy, aside from not using a "cached" TripleStr and instead calling getTriple() on the Triple. [I just compared the two versions].

@@ -0,0 +1,16 @@
! RUN: %flang_fc1 -triple aarch64 -emit-llvm -mcmodel=tiny %s -o - | FileCheck %s -check-prefix=CHECK-TINY
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nit] IMHO, using CHECK for prefixes in a test with multiple prefixes is just noise. Why not drop CHECK?

@sscalpone sscalpone requested a review from AlexisPerry June 17, 2024 16:53
@Thirumalai-Shaktivel
Copy link
Member

Thirumalai-Shaktivel commented Jun 19, 2024

Hey @DavidTruby,
This seems to introduce a -mcmodel flag, thanks for that.
But, when I do flang-new -mcmodel=medium x.f90, I get another unknown argument issue.

$ flang-new -mcmodel=medium x.f90
error: unknown argument: '-mlarge-data-threshold=65536'

What might be the issue?

@DavidTruby
Copy link
Member Author

It looks like -mcmodel=medium implies another flag on x86-64 that I haven't implemented. I will post another patch implementing -mlarge-data-threshold and endeavour to merge that before this patch so that this works on x86-64.

@Thirumalai-Shaktivel
Copy link
Member

Yes, thank you!

Copy link

github-actions bot commented Jul 1, 2024

✅ With the latest revision this PR passed the C/C++ code formatter.

@Leporacanthicus
Copy link
Contributor

Yes, thank you!

This is now part of this PR.

Copy link
Contributor

@tblah tblah left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thanks for picking this up Mats.

Ideally, wait for @Thirumalai-Shaktivel to have another look before merging.

@Thirumalai-Shaktivel
Copy link
Member

Yes, I tested it. It works fine.

Thank you!

@Leporacanthicus Leporacanthicus merged commit 9e6b46a into llvm:main Jul 3, 2024
7 checks passed
@llvm-ci
Copy link
Collaborator

llvm-ci commented Jul 3, 2024

LLVM Buildbot has detected a new failure on builder libc-x86_64-debian-gcc-fullbuild-dbg running on libc-x86_64-debian-fullbuild while building clang,flang at step 4 "annotate".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/131/builds/1365

Here is the relevant piece of the build log for the reference:

Step 4 (annotate) failure: 'python ../llvm-zorg/zorg/buildbot/builders/annotated/libc-linux.py ...' (failure)
...
-- lldb project is disabled
-- mlir project is disabled
-- openmp project is disabled
-- polly project is disabled
-- pstl project is disabled
-- flang project is disabled
-- Could NOT find LibEdit (missing: LibEdit_INCLUDE_DIRS LibEdit_LIBRARIES) 
Change Dir: /home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-gcc-fullbuild-dbg/build/CMakeFiles/CMakeTmp

Run Build Command(s):/usr/bin/ninja cmTC_abf7f && [1/2] Building CXX object CMakeFiles/cmTC_abf7f.dir/getErrc.cpp.o
FAILED: CMakeFiles/cmTC_abf7f.dir/getErrc.cpp.o 
/usr/bin/g++   -g -std=c++17 -o CMakeFiles/cmTC_abf7f.dir/getErrc.cpp.o -c /home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-gcc-fullbuild-dbg/build/CMakeFiles/CMakeTmp/getErrc.cpp
/home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-gcc-fullbuild-dbg/build/CMakeFiles/CMakeTmp/getErrc.cpp:15:9: fatal error: error writing to /tmp/ccJpSZaj.s: No space left on device
   15 |         }
      |         ^
compilation terminated.
ninja: build stopped: subcommand failed.


-- Failed to get errc messages
-- LLVM host triple: x86_64-unknown-linux-gnu
-- Native target architecture is X86
-- Threads enabled.
-- Doxygen disabled.
-- Ninja version: 1.11.1
-- Could NOT find OCaml (missing: OCAMLFIND OCAML_VERSION OCAML_STDLIB_PATH) 
-- Could NOT find OCaml (missing: OCAMLFIND OCAML_VERSION OCAML_STDLIB_PATH) 
-- OCaml bindings disabled.
-- LLVM default target triple: x86_64-unknown-linux-gnu
-- Building with -fPIC
-- Targeting AArch64
-- Targeting AMDGPU
-- Targeting ARM
-- Targeting AVR
-- Targeting BPF
-- Targeting Hexagon
-- Targeting Lanai
-- Targeting LoongArch
-- Targeting Mips
-- Targeting MSP430
-- Targeting NVPTX
-- Targeting PowerPC
-- Targeting RISCV
-- Targeting Sparc
-- Targeting SystemZ
-- Targeting VE
-- Targeting WebAssembly
-- Targeting X86
-- Targeting XCore

@llvm-ci
Copy link
Collaborator

llvm-ci commented Jul 3, 2024

LLVM Buildbot has detected a new failure on builder openmp-offload-sles-build-only running on rocm-worker-hw-04-sles while building clang,flang at step 7 "Add check check-flang".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/140/builds/1368

Here is the relevant piece of the build log for the reference:

Step 7 (Add check check-flang) failure: test (failure)
******************** TEST 'Flang :: Lower/mcmodel.f90' FAILED ********************
Exit Code: 2

Command Output (stderr):
--
RUN: at line 1: /home/botworker/bbot/builds/openmp-offload-sles-build/llvm.build/bin/flang-new -fc1 -triple aarch64 -emit-llvm -mcmodel=tiny /home/botworker/bbot/builds/openmp-offload-sles-build/llvm.src/flang/test/Lower/mcmodel.f90 -o - | /home/botworker/bbot/builds/openmp-offload-sles-build/llvm.build/bin/FileCheck /home/botworker/bbot/builds/openmp-offload-sles-build/llvm.src/flang/test/Lower/mcmodel.f90 -check-prefix=CHECK-TINY
+ /home/botworker/bbot/builds/openmp-offload-sles-build/llvm.build/bin/flang-new -fc1 -triple aarch64 -emit-llvm -mcmodel=tiny /home/botworker/bbot/builds/openmp-offload-sles-build/llvm.src/flang/test/Lower/mcmodel.f90 -o -
+ /home/botworker/bbot/builds/openmp-offload-sles-build/llvm.build/bin/FileCheck /home/botworker/bbot/builds/openmp-offload-sles-build/llvm.src/flang/test/Lower/mcmodel.f90 -check-prefix=CHECK-TINY
error: unable to create target: 'No available targets are compatible with triple "aarch64"'
FileCheck error: '<stdin>' is empty.
FileCheck command line:  /home/botworker/bbot/builds/openmp-offload-sles-build/llvm.build/bin/FileCheck /home/botworker/bbot/builds/openmp-offload-sles-build/llvm.src/flang/test/Lower/mcmodel.f90 -check-prefix=CHECK-TINY

--

********************


@llvm-ci
Copy link
Collaborator

llvm-ci commented Jul 3, 2024

LLVM Buildbot has detected a new failure on builder flang-aarch64-libcxx running on linaro-flang-aarch64-libcxx while building clang,flang at step 6 "test-build-unified-tree-check-flang".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/89/builds/1377

Here is the relevant piece of the build log for the reference:

Step 6 (test-build-unified-tree-check-flang) failure: test (failure)
******************** TEST 'Flang :: Lower/mcmodel.f90' FAILED ********************
Exit Code: 2

Command Output (stderr):
--
RUN: at line 1: /home/tcwg-buildbot/worker/flang-aarch64-libcxx/build/bin/flang-new -fc1 -triple aarch64 -emit-llvm -mcmodel=tiny /home/tcwg-buildbot/worker/flang-aarch64-libcxx/llvm-project/flang/test/Lower/mcmodel.f90 -o - | /home/tcwg-buildbot/worker/flang-aarch64-libcxx/build/bin/FileCheck /home/tcwg-buildbot/worker/flang-aarch64-libcxx/llvm-project/flang/test/Lower/mcmodel.f90 -check-prefix=CHECK-TINY
+ /home/tcwg-buildbot/worker/flang-aarch64-libcxx/build/bin/flang-new -fc1 -triple aarch64 -emit-llvm -mcmodel=tiny /home/tcwg-buildbot/worker/flang-aarch64-libcxx/llvm-project/flang/test/Lower/mcmodel.f90 -o -
+ /home/tcwg-buildbot/worker/flang-aarch64-libcxx/build/bin/FileCheck /home/tcwg-buildbot/worker/flang-aarch64-libcxx/llvm-project/flang/test/Lower/mcmodel.f90 -check-prefix=CHECK-TINY
RUN: at line 2: /home/tcwg-buildbot/worker/flang-aarch64-libcxx/build/bin/flang-new -fc1 -emit-llvm -mcmodel=small /home/tcwg-buildbot/worker/flang-aarch64-libcxx/llvm-project/flang/test/Lower/mcmodel.f90 -o - | /home/tcwg-buildbot/worker/flang-aarch64-libcxx/build/bin/FileCheck /home/tcwg-buildbot/worker/flang-aarch64-libcxx/llvm-project/flang/test/Lower/mcmodel.f90 -check-prefix=CHECK-SMALL
+ /home/tcwg-buildbot/worker/flang-aarch64-libcxx/build/bin/flang-new -fc1 -emit-llvm -mcmodel=small /home/tcwg-buildbot/worker/flang-aarch64-libcxx/llvm-project/flang/test/Lower/mcmodel.f90 -o -
+ /home/tcwg-buildbot/worker/flang-aarch64-libcxx/build/bin/FileCheck /home/tcwg-buildbot/worker/flang-aarch64-libcxx/llvm-project/flang/test/Lower/mcmodel.f90 -check-prefix=CHECK-SMALL
RUN: at line 3: /home/tcwg-buildbot/worker/flang-aarch64-libcxx/build/bin/flang-new -fc1 -triple x86_64-unknown-linux-gnu -emit-llvm -mcmodel=kernel /home/tcwg-buildbot/worker/flang-aarch64-libcxx/llvm-project/flang/test/Lower/mcmodel.f90 -o - | /home/tcwg-buildbot/worker/flang-aarch64-libcxx/build/bin/FileCheck /home/tcwg-buildbot/worker/flang-aarch64-libcxx/llvm-project/flang/test/Lower/mcmodel.f90 -check-prefix=CHECK-KERNEL
+ /home/tcwg-buildbot/worker/flang-aarch64-libcxx/build/bin/flang-new -fc1 -triple x86_64-unknown-linux-gnu -emit-llvm -mcmodel=kernel /home/tcwg-buildbot/worker/flang-aarch64-libcxx/llvm-project/flang/test/Lower/mcmodel.f90 -o -
+ /home/tcwg-buildbot/worker/flang-aarch64-libcxx/build/bin/FileCheck /home/tcwg-buildbot/worker/flang-aarch64-libcxx/llvm-project/flang/test/Lower/mcmodel.f90 -check-prefix=CHECK-KERNEL
error: unable to create target: 'No available targets are compatible with triple "x86_64-unknown-linux-gnu"'
FileCheck error: '<stdin>' is empty.
FileCheck command line:  /home/tcwg-buildbot/worker/flang-aarch64-libcxx/build/bin/FileCheck /home/tcwg-buildbot/worker/flang-aarch64-libcxx/llvm-project/flang/test/Lower/mcmodel.f90 -check-prefix=CHECK-KERNEL

--

********************


@llvm-ci
Copy link
Collaborator

llvm-ci commented Jul 3, 2024

LLVM Buildbot has detected a new failure on builder ppc64le-flang-rhel-clang running on ppc64le-flang-rhel-test while building clang,flang at step 6 "test-build-unified-tree-check-flang".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/157/builds/1737

Here is the relevant piece of the build log for the reference:

Step 6 (test-build-unified-tree-check-flang) failure: test (failure)
******************** TEST 'Flang :: Lower/mcmodel.f90' FAILED ********************
Exit Code: 2

Command Output (stderr):
--
RUN: at line 1: /home/buildbots/llvm-external-buildbots/workers/ppc64le-flang-rhel-test/ppc64le-flang-rhel-clang-build/build/bin/flang-new -fc1 -triple aarch64 -emit-llvm -mcmodel=tiny /home/buildbots/llvm-external-buildbots/workers/ppc64le-flang-rhel-test/ppc64le-flang-rhel-clang-build/llvm-project/flang/test/Lower/mcmodel.f90 -o - | /home/buildbots/llvm-external-buildbots/workers/ppc64le-flang-rhel-test/ppc64le-flang-rhel-clang-build/build/bin/FileCheck /home/buildbots/llvm-external-buildbots/workers/ppc64le-flang-rhel-test/ppc64le-flang-rhel-clang-build/llvm-project/flang/test/Lower/mcmodel.f90 -check-prefix=CHECK-TINY
+ /home/buildbots/llvm-external-buildbots/workers/ppc64le-flang-rhel-test/ppc64le-flang-rhel-clang-build/build/bin/flang-new -fc1 -triple aarch64 -emit-llvm -mcmodel=tiny /home/buildbots/llvm-external-buildbots/workers/ppc64le-flang-rhel-test/ppc64le-flang-rhel-clang-build/llvm-project/flang/test/Lower/mcmodel.f90 -o -
+ /home/buildbots/llvm-external-buildbots/workers/ppc64le-flang-rhel-test/ppc64le-flang-rhel-clang-build/build/bin/FileCheck /home/buildbots/llvm-external-buildbots/workers/ppc64le-flang-rhel-test/ppc64le-flang-rhel-clang-build/llvm-project/flang/test/Lower/mcmodel.f90 -check-prefix=CHECK-TINY
error: unable to create target: 'No available targets are compatible with triple "aarch64"'
FileCheck error: '<stdin>' is empty.
FileCheck command line:  /home/buildbots/llvm-external-buildbots/workers/ppc64le-flang-rhel-test/ppc64le-flang-rhel-clang-build/build/bin/FileCheck /home/buildbots/llvm-external-buildbots/workers/ppc64le-flang-rhel-test/ppc64le-flang-rhel-clang-build/llvm-project/flang/test/Lower/mcmodel.f90 -check-prefix=CHECK-TINY

--

********************


@llvm-ci
Copy link
Collaborator

llvm-ci commented Jul 3, 2024

LLVM Buildbot has detected a new failure on builder flang-aarch64-out-of-tree running on linaro-flang-aarch64-out-of-tree while building clang,flang at step 8 "test-build-flang-unified-tree-check-flang".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/53/builds/883

Here is the relevant piece of the build log for the reference:

Step 8 (test-build-flang-unified-tree-check-flang) failure: test (failure)
******************** TEST 'Flang :: Lower/mcmodel.f90' FAILED ********************
Exit Code: 2

Command Output (stderr):
--
RUN: at line 1: /home/tcwg-buildbot/worker/flang-aarch64-out-of-tree/build_flang/bin/flang-new -fc1 -triple aarch64 -emit-llvm -mcmodel=tiny /home/tcwg-buildbot/worker/flang-aarch64-out-of-tree/llvm-project/flang/test/Lower/mcmodel.f90 -o - | /home/tcwg-buildbot/worker/flang-aarch64-out-of-tree/build_llvm/bin/FileCheck /home/tcwg-buildbot/worker/flang-aarch64-out-of-tree/llvm-project/flang/test/Lower/mcmodel.f90 -check-prefix=CHECK-TINY
+ /home/tcwg-buildbot/worker/flang-aarch64-out-of-tree/build_flang/bin/flang-new -fc1 -triple aarch64 -emit-llvm -mcmodel=tiny /home/tcwg-buildbot/worker/flang-aarch64-out-of-tree/llvm-project/flang/test/Lower/mcmodel.f90 -o -
+ /home/tcwg-buildbot/worker/flang-aarch64-out-of-tree/build_llvm/bin/FileCheck /home/tcwg-buildbot/worker/flang-aarch64-out-of-tree/llvm-project/flang/test/Lower/mcmodel.f90 -check-prefix=CHECK-TINY
RUN: at line 2: /home/tcwg-buildbot/worker/flang-aarch64-out-of-tree/build_flang/bin/flang-new -fc1 -emit-llvm -mcmodel=small /home/tcwg-buildbot/worker/flang-aarch64-out-of-tree/llvm-project/flang/test/Lower/mcmodel.f90 -o - | /home/tcwg-buildbot/worker/flang-aarch64-out-of-tree/build_llvm/bin/FileCheck /home/tcwg-buildbot/worker/flang-aarch64-out-of-tree/llvm-project/flang/test/Lower/mcmodel.f90 -check-prefix=CHECK-SMALL
+ /home/tcwg-buildbot/worker/flang-aarch64-out-of-tree/build_flang/bin/flang-new -fc1 -emit-llvm -mcmodel=small /home/tcwg-buildbot/worker/flang-aarch64-out-of-tree/llvm-project/flang/test/Lower/mcmodel.f90 -o -
+ /home/tcwg-buildbot/worker/flang-aarch64-out-of-tree/build_llvm/bin/FileCheck /home/tcwg-buildbot/worker/flang-aarch64-out-of-tree/llvm-project/flang/test/Lower/mcmodel.f90 -check-prefix=CHECK-SMALL
RUN: at line 3: /home/tcwg-buildbot/worker/flang-aarch64-out-of-tree/build_flang/bin/flang-new -fc1 -triple x86_64-unknown-linux-gnu -emit-llvm -mcmodel=kernel /home/tcwg-buildbot/worker/flang-aarch64-out-of-tree/llvm-project/flang/test/Lower/mcmodel.f90 -o - | /home/tcwg-buildbot/worker/flang-aarch64-out-of-tree/build_llvm/bin/FileCheck /home/tcwg-buildbot/worker/flang-aarch64-out-of-tree/llvm-project/flang/test/Lower/mcmodel.f90 -check-prefix=CHECK-KERNEL
+ /home/tcwg-buildbot/worker/flang-aarch64-out-of-tree/build_flang/bin/flang-new -fc1 -triple x86_64-unknown-linux-gnu -emit-llvm -mcmodel=kernel /home/tcwg-buildbot/worker/flang-aarch64-out-of-tree/llvm-project/flang/test/Lower/mcmodel.f90 -o -
+ /home/tcwg-buildbot/worker/flang-aarch64-out-of-tree/build_llvm/bin/FileCheck /home/tcwg-buildbot/worker/flang-aarch64-out-of-tree/llvm-project/flang/test/Lower/mcmodel.f90 -check-prefix=CHECK-KERNEL
error: unable to create target: 'No available targets are compatible with triple "x86_64-unknown-linux-gnu"'
FileCheck error: '<stdin>' is empty.
FileCheck command line:  /home/tcwg-buildbot/worker/flang-aarch64-out-of-tree/build_llvm/bin/FileCheck /home/tcwg-buildbot/worker/flang-aarch64-out-of-tree/llvm-project/flang/test/Lower/mcmodel.f90 -check-prefix=CHECK-KERNEL

--

********************


@llvm-ci
Copy link
Collaborator

llvm-ci commented Jul 3, 2024

LLVM Buildbot has detected a new failure on builder flang-aarch64-latest-gcc running on linaro-flang-aarch64-latest-gcc while building clang,flang at step 6 "test-build-unified-tree-check-flang".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/130/builds/647

Here is the relevant piece of the build log for the reference:

Step 6 (test-build-unified-tree-check-flang) failure: test (failure)
******************** TEST 'Flang :: Lower/mcmodel.f90' FAILED ********************
Exit Code: 2

Command Output (stderr):
--
RUN: at line 1: /home/tcwg-buildbot/worker/flang-aarch64-latest-gcc/build/bin/flang-new -fc1 -triple aarch64 -emit-llvm -mcmodel=tiny /home/tcwg-buildbot/worker/flang-aarch64-latest-gcc/llvm-project/flang/test/Lower/mcmodel.f90 -o - | /home/tcwg-buildbot/worker/flang-aarch64-latest-gcc/build/bin/FileCheck /home/tcwg-buildbot/worker/flang-aarch64-latest-gcc/llvm-project/flang/test/Lower/mcmodel.f90 -check-prefix=CHECK-TINY
+ /home/tcwg-buildbot/worker/flang-aarch64-latest-gcc/build/bin/flang-new -fc1 -triple aarch64 -emit-llvm -mcmodel=tiny /home/tcwg-buildbot/worker/flang-aarch64-latest-gcc/llvm-project/flang/test/Lower/mcmodel.f90 -o -
+ /home/tcwg-buildbot/worker/flang-aarch64-latest-gcc/build/bin/FileCheck /home/tcwg-buildbot/worker/flang-aarch64-latest-gcc/llvm-project/flang/test/Lower/mcmodel.f90 -check-prefix=CHECK-TINY
RUN: at line 2: /home/tcwg-buildbot/worker/flang-aarch64-latest-gcc/build/bin/flang-new -fc1 -emit-llvm -mcmodel=small /home/tcwg-buildbot/worker/flang-aarch64-latest-gcc/llvm-project/flang/test/Lower/mcmodel.f90 -o - | /home/tcwg-buildbot/worker/flang-aarch64-latest-gcc/build/bin/FileCheck /home/tcwg-buildbot/worker/flang-aarch64-latest-gcc/llvm-project/flang/test/Lower/mcmodel.f90 -check-prefix=CHECK-SMALL
+ /home/tcwg-buildbot/worker/flang-aarch64-latest-gcc/build/bin/flang-new -fc1 -emit-llvm -mcmodel=small /home/tcwg-buildbot/worker/flang-aarch64-latest-gcc/llvm-project/flang/test/Lower/mcmodel.f90 -o -
+ /home/tcwg-buildbot/worker/flang-aarch64-latest-gcc/build/bin/FileCheck /home/tcwg-buildbot/worker/flang-aarch64-latest-gcc/llvm-project/flang/test/Lower/mcmodel.f90 -check-prefix=CHECK-SMALL
RUN: at line 3: /home/tcwg-buildbot/worker/flang-aarch64-latest-gcc/build/bin/flang-new -fc1 -triple x86_64-unknown-linux-gnu -emit-llvm -mcmodel=kernel /home/tcwg-buildbot/worker/flang-aarch64-latest-gcc/llvm-project/flang/test/Lower/mcmodel.f90 -o - | /home/tcwg-buildbot/worker/flang-aarch64-latest-gcc/build/bin/FileCheck /home/tcwg-buildbot/worker/flang-aarch64-latest-gcc/llvm-project/flang/test/Lower/mcmodel.f90 -check-prefix=CHECK-KERNEL
+ /home/tcwg-buildbot/worker/flang-aarch64-latest-gcc/build/bin/FileCheck /home/tcwg-buildbot/worker/flang-aarch64-latest-gcc/llvm-project/flang/test/Lower/mcmodel.f90 -check-prefix=CHECK-KERNEL
+ /home/tcwg-buildbot/worker/flang-aarch64-latest-gcc/build/bin/flang-new -fc1 -triple x86_64-unknown-linux-gnu -emit-llvm -mcmodel=kernel /home/tcwg-buildbot/worker/flang-aarch64-latest-gcc/llvm-project/flang/test/Lower/mcmodel.f90 -o -
error: unable to create target: 'No available targets are compatible with triple "x86_64-unknown-linux-gnu"'
FileCheck error: '<stdin>' is empty.
FileCheck command line:  /home/tcwg-buildbot/worker/flang-aarch64-latest-gcc/build/bin/FileCheck /home/tcwg-buildbot/worker/flang-aarch64-latest-gcc/llvm-project/flang/test/Lower/mcmodel.f90 -check-prefix=CHECK-KERNEL

--

********************


@llvm-ci
Copy link
Collaborator

llvm-ci commented Jul 3, 2024

LLVM Buildbot has detected a new failure on builder flang-aarch64-sharedlibs running on linaro-flang-aarch64-sharedlibs while building clang,flang at step 6 "test-build-unified-tree-check-flang".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/80/builds/701

Here is the relevant piece of the build log for the reference:

Step 6 (test-build-unified-tree-check-flang) failure: test (failure)
******************** TEST 'Flang :: Lower/mcmodel.f90' FAILED ********************
Exit Code: 2

Command Output (stderr):
--
RUN: at line 1: /home/tcwg-buildbot/worker/flang-aarch64-sharedlibs/build/bin/flang-new -fc1 -triple aarch64 -emit-llvm -mcmodel=tiny /home/tcwg-buildbot/worker/flang-aarch64-sharedlibs/llvm-project/flang/test/Lower/mcmodel.f90 -o - | /home/tcwg-buildbot/worker/flang-aarch64-sharedlibs/build/bin/FileCheck /home/tcwg-buildbot/worker/flang-aarch64-sharedlibs/llvm-project/flang/test/Lower/mcmodel.f90 -check-prefix=CHECK-TINY
+ /home/tcwg-buildbot/worker/flang-aarch64-sharedlibs/build/bin/FileCheck /home/tcwg-buildbot/worker/flang-aarch64-sharedlibs/llvm-project/flang/test/Lower/mcmodel.f90 -check-prefix=CHECK-TINY
+ /home/tcwg-buildbot/worker/flang-aarch64-sharedlibs/build/bin/flang-new -fc1 -triple aarch64 -emit-llvm -mcmodel=tiny /home/tcwg-buildbot/worker/flang-aarch64-sharedlibs/llvm-project/flang/test/Lower/mcmodel.f90 -o -
RUN: at line 2: /home/tcwg-buildbot/worker/flang-aarch64-sharedlibs/build/bin/flang-new -fc1 -emit-llvm -mcmodel=small /home/tcwg-buildbot/worker/flang-aarch64-sharedlibs/llvm-project/flang/test/Lower/mcmodel.f90 -o - | /home/tcwg-buildbot/worker/flang-aarch64-sharedlibs/build/bin/FileCheck /home/tcwg-buildbot/worker/flang-aarch64-sharedlibs/llvm-project/flang/test/Lower/mcmodel.f90 -check-prefix=CHECK-SMALL
+ /home/tcwg-buildbot/worker/flang-aarch64-sharedlibs/build/bin/flang-new -fc1 -emit-llvm -mcmodel=small /home/tcwg-buildbot/worker/flang-aarch64-sharedlibs/llvm-project/flang/test/Lower/mcmodel.f90 -o -
+ /home/tcwg-buildbot/worker/flang-aarch64-sharedlibs/build/bin/FileCheck /home/tcwg-buildbot/worker/flang-aarch64-sharedlibs/llvm-project/flang/test/Lower/mcmodel.f90 -check-prefix=CHECK-SMALL
RUN: at line 3: /home/tcwg-buildbot/worker/flang-aarch64-sharedlibs/build/bin/flang-new -fc1 -triple x86_64-unknown-linux-gnu -emit-llvm -mcmodel=kernel /home/tcwg-buildbot/worker/flang-aarch64-sharedlibs/llvm-project/flang/test/Lower/mcmodel.f90 -o - | /home/tcwg-buildbot/worker/flang-aarch64-sharedlibs/build/bin/FileCheck /home/tcwg-buildbot/worker/flang-aarch64-sharedlibs/llvm-project/flang/test/Lower/mcmodel.f90 -check-prefix=CHECK-KERNEL
+ /home/tcwg-buildbot/worker/flang-aarch64-sharedlibs/build/bin/FileCheck /home/tcwg-buildbot/worker/flang-aarch64-sharedlibs/llvm-project/flang/test/Lower/mcmodel.f90 -check-prefix=CHECK-KERNEL
+ /home/tcwg-buildbot/worker/flang-aarch64-sharedlibs/build/bin/flang-new -fc1 -triple x86_64-unknown-linux-gnu -emit-llvm -mcmodel=kernel /home/tcwg-buildbot/worker/flang-aarch64-sharedlibs/llvm-project/flang/test/Lower/mcmodel.f90 -o -
error: unable to create target: 'No available targets are compatible with triple "x86_64-unknown-linux-gnu"'
FileCheck error: '<stdin>' is empty.
FileCheck command line:  /home/tcwg-buildbot/worker/flang-aarch64-sharedlibs/build/bin/FileCheck /home/tcwg-buildbot/worker/flang-aarch64-sharedlibs/llvm-project/flang/test/Lower/mcmodel.f90 -check-prefix=CHECK-KERNEL

--

********************


@llvm-ci
Copy link
Collaborator

llvm-ci commented Jul 3, 2024

LLVM Buildbot has detected a new failure on builder flang-aarch64-release running on linaro-flang-aarch64-release while building clang,flang at step 6 "test-build-unified-tree-check-flang".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/172/builds/636

Here is the relevant piece of the build log for the reference:

Step 6 (test-build-unified-tree-check-flang) failure: test (failure)
******************** TEST 'Flang :: Lower/mcmodel.f90' FAILED ********************
Exit Code: 2

Command Output (stderr):
--
RUN: at line 1: /home/tcwg-buildbot/worker/flang-aarch64-release/build/bin/flang-new -fc1 -triple aarch64 -emit-llvm -mcmodel=tiny /home/tcwg-buildbot/worker/flang-aarch64-release/llvm-project/flang/test/Lower/mcmodel.f90 -o - | /home/tcwg-buildbot/worker/flang-aarch64-release/build/bin/FileCheck /home/tcwg-buildbot/worker/flang-aarch64-release/llvm-project/flang/test/Lower/mcmodel.f90 -check-prefix=CHECK-TINY
+ /home/tcwg-buildbot/worker/flang-aarch64-release/build/bin/flang-new -fc1 -triple aarch64 -emit-llvm -mcmodel=tiny /home/tcwg-buildbot/worker/flang-aarch64-release/llvm-project/flang/test/Lower/mcmodel.f90 -o -
+ /home/tcwg-buildbot/worker/flang-aarch64-release/build/bin/FileCheck /home/tcwg-buildbot/worker/flang-aarch64-release/llvm-project/flang/test/Lower/mcmodel.f90 -check-prefix=CHECK-TINY
RUN: at line 2: /home/tcwg-buildbot/worker/flang-aarch64-release/build/bin/flang-new -fc1 -emit-llvm -mcmodel=small /home/tcwg-buildbot/worker/flang-aarch64-release/llvm-project/flang/test/Lower/mcmodel.f90 -o - | /home/tcwg-buildbot/worker/flang-aarch64-release/build/bin/FileCheck /home/tcwg-buildbot/worker/flang-aarch64-release/llvm-project/flang/test/Lower/mcmodel.f90 -check-prefix=CHECK-SMALL
+ /home/tcwg-buildbot/worker/flang-aarch64-release/build/bin/FileCheck /home/tcwg-buildbot/worker/flang-aarch64-release/llvm-project/flang/test/Lower/mcmodel.f90 -check-prefix=CHECK-SMALL
+ /home/tcwg-buildbot/worker/flang-aarch64-release/build/bin/flang-new -fc1 -emit-llvm -mcmodel=small /home/tcwg-buildbot/worker/flang-aarch64-release/llvm-project/flang/test/Lower/mcmodel.f90 -o -
RUN: at line 3: /home/tcwg-buildbot/worker/flang-aarch64-release/build/bin/flang-new -fc1 -triple x86_64-unknown-linux-gnu -emit-llvm -mcmodel=kernel /home/tcwg-buildbot/worker/flang-aarch64-release/llvm-project/flang/test/Lower/mcmodel.f90 -o - | /home/tcwg-buildbot/worker/flang-aarch64-release/build/bin/FileCheck /home/tcwg-buildbot/worker/flang-aarch64-release/llvm-project/flang/test/Lower/mcmodel.f90 -check-prefix=CHECK-KERNEL
+ /home/tcwg-buildbot/worker/flang-aarch64-release/build/bin/FileCheck /home/tcwg-buildbot/worker/flang-aarch64-release/llvm-project/flang/test/Lower/mcmodel.f90 -check-prefix=CHECK-KERNEL
+ /home/tcwg-buildbot/worker/flang-aarch64-release/build/bin/flang-new -fc1 -triple x86_64-unknown-linux-gnu -emit-llvm -mcmodel=kernel /home/tcwg-buildbot/worker/flang-aarch64-release/llvm-project/flang/test/Lower/mcmodel.f90 -o -
error: unable to create target: 'No available targets are compatible with triple "x86_64-unknown-linux-gnu"'
FileCheck error: '<stdin>' is empty.
FileCheck command line:  /home/tcwg-buildbot/worker/flang-aarch64-release/build/bin/FileCheck /home/tcwg-buildbot/worker/flang-aarch64-release/llvm-project/flang/test/Lower/mcmodel.f90 -check-prefix=CHECK-KERNEL

--

********************


@llvm-ci
Copy link
Collaborator

llvm-ci commented Jul 3, 2024

LLVM Buildbot has detected a new failure on builder flang-aarch64-rel-assert running on linaro-flang-aarch64-rel-assert while building clang,flang at step 6 "test-build-unified-tree-check-flang".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/29/builds/721

Here is the relevant piece of the build log for the reference:

Step 6 (test-build-unified-tree-check-flang) failure: test (failure)
******************** TEST 'Flang :: Lower/mcmodel.f90' FAILED ********************
Exit Code: 2

Command Output (stderr):
--
RUN: at line 1: /home/tcwg-buildbot/worker/flang-aarch64-rel-assert/build/bin/flang-new -fc1 -triple aarch64 -emit-llvm -mcmodel=tiny /home/tcwg-buildbot/worker/flang-aarch64-rel-assert/llvm-project/flang/test/Lower/mcmodel.f90 -o - | /home/tcwg-buildbot/worker/flang-aarch64-rel-assert/build/bin/FileCheck /home/tcwg-buildbot/worker/flang-aarch64-rel-assert/llvm-project/flang/test/Lower/mcmodel.f90 -check-prefix=CHECK-TINY
+ /home/tcwg-buildbot/worker/flang-aarch64-rel-assert/build/bin/flang-new -fc1 -triple aarch64 -emit-llvm -mcmodel=tiny /home/tcwg-buildbot/worker/flang-aarch64-rel-assert/llvm-project/flang/test/Lower/mcmodel.f90 -o -
+ /home/tcwg-buildbot/worker/flang-aarch64-rel-assert/build/bin/FileCheck /home/tcwg-buildbot/worker/flang-aarch64-rel-assert/llvm-project/flang/test/Lower/mcmodel.f90 -check-prefix=CHECK-TINY
RUN: at line 2: /home/tcwg-buildbot/worker/flang-aarch64-rel-assert/build/bin/flang-new -fc1 -emit-llvm -mcmodel=small /home/tcwg-buildbot/worker/flang-aarch64-rel-assert/llvm-project/flang/test/Lower/mcmodel.f90 -o - | /home/tcwg-buildbot/worker/flang-aarch64-rel-assert/build/bin/FileCheck /home/tcwg-buildbot/worker/flang-aarch64-rel-assert/llvm-project/flang/test/Lower/mcmodel.f90 -check-prefix=CHECK-SMALL
+ /home/tcwg-buildbot/worker/flang-aarch64-rel-assert/build/bin/flang-new -fc1 -emit-llvm -mcmodel=small /home/tcwg-buildbot/worker/flang-aarch64-rel-assert/llvm-project/flang/test/Lower/mcmodel.f90 -o -
+ /home/tcwg-buildbot/worker/flang-aarch64-rel-assert/build/bin/FileCheck /home/tcwg-buildbot/worker/flang-aarch64-rel-assert/llvm-project/flang/test/Lower/mcmodel.f90 -check-prefix=CHECK-SMALL
RUN: at line 3: /home/tcwg-buildbot/worker/flang-aarch64-rel-assert/build/bin/flang-new -fc1 -triple x86_64-unknown-linux-gnu -emit-llvm -mcmodel=kernel /home/tcwg-buildbot/worker/flang-aarch64-rel-assert/llvm-project/flang/test/Lower/mcmodel.f90 -o - | /home/tcwg-buildbot/worker/flang-aarch64-rel-assert/build/bin/FileCheck /home/tcwg-buildbot/worker/flang-aarch64-rel-assert/llvm-project/flang/test/Lower/mcmodel.f90 -check-prefix=CHECK-KERNEL
+ /home/tcwg-buildbot/worker/flang-aarch64-rel-assert/build/bin/flang-new -fc1 -triple x86_64-unknown-linux-gnu -emit-llvm -mcmodel=kernel /home/tcwg-buildbot/worker/flang-aarch64-rel-assert/llvm-project/flang/test/Lower/mcmodel.f90 -o -
+ /home/tcwg-buildbot/worker/flang-aarch64-rel-assert/build/bin/FileCheck /home/tcwg-buildbot/worker/flang-aarch64-rel-assert/llvm-project/flang/test/Lower/mcmodel.f90 -check-prefix=CHECK-KERNEL
error: unable to create target: 'No available targets are compatible with triple "x86_64-unknown-linux-gnu"'
FileCheck error: '<stdin>' is empty.
FileCheck command line:  /home/tcwg-buildbot/worker/flang-aarch64-rel-assert/build/bin/FileCheck /home/tcwg-buildbot/worker/flang-aarch64-rel-assert/llvm-project/flang/test/Lower/mcmodel.f90 -check-prefix=CHECK-KERNEL

--

********************


@llvm-ci
Copy link
Collaborator

llvm-ci commented Jul 3, 2024

LLVM Buildbot has detected a new failure on builder flang-aarch64-dylib running on linaro-flang-aarch64-dylib while building clang,flang at step 6 "test-build-unified-tree-check-flang".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/50/builds/696

Here is the relevant piece of the build log for the reference:

Step 6 (test-build-unified-tree-check-flang) failure: test (failure)
******************** TEST 'Flang :: Lower/mcmodel.f90' FAILED ********************
Exit Code: 2

Command Output (stderr):
--
RUN: at line 1: /home/tcwg-buildbot/worker/flang-aarch64-dylib/build/bin/flang-new -fc1 -triple aarch64 -emit-llvm -mcmodel=tiny /home/tcwg-buildbot/worker/flang-aarch64-dylib/llvm-project/flang/test/Lower/mcmodel.f90 -o - | /home/tcwg-buildbot/worker/flang-aarch64-dylib/build/bin/FileCheck /home/tcwg-buildbot/worker/flang-aarch64-dylib/llvm-project/flang/test/Lower/mcmodel.f90 -check-prefix=CHECK-TINY
+ /home/tcwg-buildbot/worker/flang-aarch64-dylib/build/bin/flang-new -fc1 -triple aarch64 -emit-llvm -mcmodel=tiny /home/tcwg-buildbot/worker/flang-aarch64-dylib/llvm-project/flang/test/Lower/mcmodel.f90 -o -
+ /home/tcwg-buildbot/worker/flang-aarch64-dylib/build/bin/FileCheck /home/tcwg-buildbot/worker/flang-aarch64-dylib/llvm-project/flang/test/Lower/mcmodel.f90 -check-prefix=CHECK-TINY
RUN: at line 2: /home/tcwg-buildbot/worker/flang-aarch64-dylib/build/bin/flang-new -fc1 -emit-llvm -mcmodel=small /home/tcwg-buildbot/worker/flang-aarch64-dylib/llvm-project/flang/test/Lower/mcmodel.f90 -o - | /home/tcwg-buildbot/worker/flang-aarch64-dylib/build/bin/FileCheck /home/tcwg-buildbot/worker/flang-aarch64-dylib/llvm-project/flang/test/Lower/mcmodel.f90 -check-prefix=CHECK-SMALL
+ /home/tcwg-buildbot/worker/flang-aarch64-dylib/build/bin/flang-new -fc1 -emit-llvm -mcmodel=small /home/tcwg-buildbot/worker/flang-aarch64-dylib/llvm-project/flang/test/Lower/mcmodel.f90 -o -
+ /home/tcwg-buildbot/worker/flang-aarch64-dylib/build/bin/FileCheck /home/tcwg-buildbot/worker/flang-aarch64-dylib/llvm-project/flang/test/Lower/mcmodel.f90 -check-prefix=CHECK-SMALL
RUN: at line 3: /home/tcwg-buildbot/worker/flang-aarch64-dylib/build/bin/flang-new -fc1 -triple x86_64-unknown-linux-gnu -emit-llvm -mcmodel=kernel /home/tcwg-buildbot/worker/flang-aarch64-dylib/llvm-project/flang/test/Lower/mcmodel.f90 -o - | /home/tcwg-buildbot/worker/flang-aarch64-dylib/build/bin/FileCheck /home/tcwg-buildbot/worker/flang-aarch64-dylib/llvm-project/flang/test/Lower/mcmodel.f90 -check-prefix=CHECK-KERNEL
+ /home/tcwg-buildbot/worker/flang-aarch64-dylib/build/bin/flang-new -fc1 -triple x86_64-unknown-linux-gnu -emit-llvm -mcmodel=kernel /home/tcwg-buildbot/worker/flang-aarch64-dylib/llvm-project/flang/test/Lower/mcmodel.f90 -o -
+ /home/tcwg-buildbot/worker/flang-aarch64-dylib/build/bin/FileCheck /home/tcwg-buildbot/worker/flang-aarch64-dylib/llvm-project/flang/test/Lower/mcmodel.f90 -check-prefix=CHECK-KERNEL
error: unable to create target: 'No available targets are compatible with triple "x86_64-unknown-linux-gnu"'
FileCheck error: '<stdin>' is empty.
FileCheck command line:  /home/tcwg-buildbot/worker/flang-aarch64-dylib/build/bin/FileCheck /home/tcwg-buildbot/worker/flang-aarch64-dylib/llvm-project/flang/test/Lower/mcmodel.f90 -check-prefix=CHECK-KERNEL

--

********************


@llvm-ci
Copy link
Collaborator

llvm-ci commented Jul 3, 2024

LLVM Buildbot has detected a new failure on builder flang-aarch64-debug-reverse-iteration running on linaro-flang-aarch64-debug-reverse-iteration while building clang,flang at step 6 "test-build-unified-tree-check-flang".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/20/builds/598

Here is the relevant piece of the build log for the reference:

Step 6 (test-build-unified-tree-check-flang) failure: test (failure)
******************** TEST 'Flang :: Lower/mcmodel.f90' FAILED ********************
Exit Code: 2

Command Output (stderr):
--
RUN: at line 1: /home/tcwg-buildbot/worker/flang-aarch64-debug-reverse-iteration/build/bin/flang-new -fc1 -triple aarch64 -emit-llvm -mcmodel=tiny /home/tcwg-buildbot/worker/flang-aarch64-debug-reverse-iteration/llvm-project/flang/test/Lower/mcmodel.f90 -o - | /home/tcwg-buildbot/worker/flang-aarch64-debug-reverse-iteration/build/bin/FileCheck /home/tcwg-buildbot/worker/flang-aarch64-debug-reverse-iteration/llvm-project/flang/test/Lower/mcmodel.f90 -check-prefix=CHECK-TINY
+ /home/tcwg-buildbot/worker/flang-aarch64-debug-reverse-iteration/build/bin/FileCheck /home/tcwg-buildbot/worker/flang-aarch64-debug-reverse-iteration/llvm-project/flang/test/Lower/mcmodel.f90 -check-prefix=CHECK-TINY
+ /home/tcwg-buildbot/worker/flang-aarch64-debug-reverse-iteration/build/bin/flang-new -fc1 -triple aarch64 -emit-llvm -mcmodel=tiny /home/tcwg-buildbot/worker/flang-aarch64-debug-reverse-iteration/llvm-project/flang/test/Lower/mcmodel.f90 -o -
RUN: at line 2: /home/tcwg-buildbot/worker/flang-aarch64-debug-reverse-iteration/build/bin/flang-new -fc1 -emit-llvm -mcmodel=small /home/tcwg-buildbot/worker/flang-aarch64-debug-reverse-iteration/llvm-project/flang/test/Lower/mcmodel.f90 -o - | /home/tcwg-buildbot/worker/flang-aarch64-debug-reverse-iteration/build/bin/FileCheck /home/tcwg-buildbot/worker/flang-aarch64-debug-reverse-iteration/llvm-project/flang/test/Lower/mcmodel.f90 -check-prefix=CHECK-SMALL
+ /home/tcwg-buildbot/worker/flang-aarch64-debug-reverse-iteration/build/bin/FileCheck /home/tcwg-buildbot/worker/flang-aarch64-debug-reverse-iteration/llvm-project/flang/test/Lower/mcmodel.f90 -check-prefix=CHECK-SMALL
+ /home/tcwg-buildbot/worker/flang-aarch64-debug-reverse-iteration/build/bin/flang-new -fc1 -emit-llvm -mcmodel=small /home/tcwg-buildbot/worker/flang-aarch64-debug-reverse-iteration/llvm-project/flang/test/Lower/mcmodel.f90 -o -
RUN: at line 3: /home/tcwg-buildbot/worker/flang-aarch64-debug-reverse-iteration/build/bin/flang-new -fc1 -triple x86_64-unknown-linux-gnu -emit-llvm -mcmodel=kernel /home/tcwg-buildbot/worker/flang-aarch64-debug-reverse-iteration/llvm-project/flang/test/Lower/mcmodel.f90 -o - | /home/tcwg-buildbot/worker/flang-aarch64-debug-reverse-iteration/build/bin/FileCheck /home/tcwg-buildbot/worker/flang-aarch64-debug-reverse-iteration/llvm-project/flang/test/Lower/mcmodel.f90 -check-prefix=CHECK-KERNEL
+ /home/tcwg-buildbot/worker/flang-aarch64-debug-reverse-iteration/build/bin/flang-new -fc1 -triple x86_64-unknown-linux-gnu -emit-llvm -mcmodel=kernel /home/tcwg-buildbot/worker/flang-aarch64-debug-reverse-iteration/llvm-project/flang/test/Lower/mcmodel.f90 -o -
+ /home/tcwg-buildbot/worker/flang-aarch64-debug-reverse-iteration/build/bin/FileCheck /home/tcwg-buildbot/worker/flang-aarch64-debug-reverse-iteration/llvm-project/flang/test/Lower/mcmodel.f90 -check-prefix=CHECK-KERNEL
error: unable to create target: 'No available targets are compatible with triple "x86_64-unknown-linux-gnu"'
FileCheck error: '<stdin>' is empty.
FileCheck command line:  /home/tcwg-buildbot/worker/flang-aarch64-debug-reverse-iteration/build/bin/FileCheck /home/tcwg-buildbot/worker/flang-aarch64-debug-reverse-iteration/llvm-project/flang/test/Lower/mcmodel.f90 -check-prefix=CHECK-KERNEL

--

********************


@Leporacanthicus
Copy link
Contributor

Working on a fix - it should be trivial, just need to check that that it still builds and passes.

[Trying to generate code without the correct target enabled!]

kbluck pushed a commit to kbluck/llvm-project that referenced this pull request Jul 6, 2024
This patch implements the -mcmodel flag from clang, allowing the Code
Model to be changed for the LLVM module. The same set of mcmodel
flags are accepted as in clang and the same Code Model attributes are
added to the LLVM module for those flags.

Also add `-mlarge-data-threshold` for x86-64, which is automatically set
by the shared command-line code (see below). This is also added as an 
attribute into the LLVM module and on the target machine.

A function is created for `addMCModel` that is copied out of clang's
argument handling so that it can be shared with flang.

---------

Co-authored-by: Mats Petersson <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
clang:driver 'clang' and 'clang++' user-facing binaries. Not 'clang-cl' clang Clang issues not falling into any other category flang:driver flang:fir-hlfir flang Flang issues not falling into any other category
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants