[PATCH] D149288: [X86] Introduce a large data threshold for the medium code model

Arthur Eubanks via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu May 25 13:23:25 PDT 2023


aeubanks added inline comments.


================
Comment at: llvm/lib/CodeGen/CommandFlags.cpp:168
+      cl::desc("Choose large data threshold for x86_64 medium code model"),
+      cl::init(0));
+  CGBINDOPT(LargeDataThreshold);
----------------
MaskRay wrote:
> To match GCC, we can use 65536
> 
> Consider applying this to large code model as well.
> 
> https://gcc.gnu.org/pipermail/gcc-patches/2023-May/619695.html
changes to this value will come in a later patch, and same for making the large code model respect this value


================
Comment at: llvm/tools/llc/llc.cpp:599
       Target->setCodeModel(*CM_IR);
+    if (auto LDT = codegen::getExplicitLargeDataThreshold())
+      Target->setLargeDataThreshold(*LDT);
----------------
tkoeppe wrote:
> Can we avoid the implicit check for 0 here and spell out `; LDT > 0`? Does LLVM require C++17?
yeah LLVM uses C++17

`codegen::getExplicitLargeDataThreshold` returns a `std::optional`, so we're checking if the user explicitly overrode the value, not if the value is 0. we would want to set the value to 0 if the user explicitly requested it


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D149288/new/

https://reviews.llvm.org/D149288



More information about the llvm-commits mailing list