[llvm] [DirectX] Fix DXIL part header version encoding (PR #91506)

Justin Bogner via llvm-commits llvm-commits at lists.llvm.org
Thu May 9 11:54:57 PDT 2024


================
@@ -537,7 +537,9 @@ static int compileModule(char **argv, LLVMContext &Context) {
       // If we are supposed to override the target triple, do so now.
       std::string IRTargetTriple = DataLayoutTargetTriple.str();
       if (!TargetTriple.empty())
-        IRTargetTriple = Triple::normalize(TargetTriple);
+        IRTargetTriple = TargetTriple;
+      if (!IRTargetTriple.empty())
+        IRTargetTriple = Triple::normalize(IRTargetTriple);
----------------
bogner wrote:

I don't think we should be changing `llc` to choose to always normalize triples buried in a DirectX change like this. This is a pretty significant change to the behaviour of llc when a module has an non-normalized triple, and if we really want to normalize the triple unconditionally I think that's a bigger change that needs wider discussion. Note that the Triple class deliberately does not normalize on construction, so that non-normalized triples can be worked with when appropriate (such as if it's intentionally broken for testing purposes, or something along those lines)

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


More information about the llvm-commits mailing list