[llvm] [SimplifyCFG][DirectX] Honor target minimum lookup table element width (PR #203103)

Justin Bogner via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 11 12:54:12 PDT 2026


================
@@ -25,19 +28,31 @@ class DirectXTTIImpl final : public BasicTTIImplBase<DirectXTTIImpl> {
 
   const DirectXSubtarget *ST;
   const DirectXTargetLowering *TLI;
+  // True when native 16-bit types are enabled (i.e. -enable-16bit-types was
+  // passed), indicated by the dx.nativelowprec module flag.
+  const bool HasNativeLowPrecision;
 
   const DirectXSubtarget *getST() const { return ST; }
   const DirectXTargetLowering *getTLI() const { return TLI; }
 
+  static bool readNativeLowPrecisionFlag(const Function &F) {
+    if (auto *Flag = mdconst::extract_or_null<ConstantInt>(
+            F.getParent()->getModuleFlag("dx.nativelowprec")))
+      return Flag->getValue().getBoolValue();
+    return false;
+  }
----------------
bogner wrote:

Yes, this should be fine, it's how we're communicating this to the backend elsewhere in any case.

https://github.com/llvm/llvm-project/pull/203103


More information about the llvm-commits mailing list