[clang] [llvm] [DirectX][DXIL] Set DXIL Version in DXIL target triple based on shader model version (PR #90809)

Justin Bogner via llvm-commits llvm-commits at lists.llvm.org
Fri May 3 14:57:09 PDT 2024


================
@@ -4675,7 +4676,7 @@ bool CompilerInvocation::CreateFromArgsImpl(
   // FIXME: We shouldn't have to pass the DashX option around here
   InputKind DashX = Res.getFrontendOpts().DashX;
   ParseTargetArgs(Res.getTargetOpts(), Args, Diags);
-  llvm::Triple T(Res.getTargetOpts().Triple);
+  llvm::Triple T(llvm::Triple::normalize(Res.getTargetOpts().Triple));
----------------
bogner wrote:

IIUC `getTargetOpts().Triple` should *already* be normalized. The definition of the option includes a "Normalizer", like so:
```
def triple : Separate<["-"], "triple">,
  HelpText<"Specify target triple (e.g. i686-apple-darwin9)">,
  MarshallingInfoString<TargetOpts<"Triple">, "llvm::Triple::normalize(llvm::sys::getDefaultTargetTriple())">,
  AlwaysEmit, Normalizer<"normalizeTriple">;
```

So I think we shouldn't need the call to normalizer in CompilerInvocation at all, and we should look at the other places we're adding it to make sure they all make sense.

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


More information about the llvm-commits mailing list