[clang] [llvm] [DXIL] Remove incompatible metadata types when preparing DXIL. (PR #136386)

Justin Bogner via cfe-commits cfe-commits at lists.llvm.org
Mon Apr 28 11:37:44 PDT 2025


================
@@ -189,6 +201,9 @@ class DXILPrepareModule : public ModulePass {
       for (auto &BB : F) {
         IRBuilder<> Builder(&BB);
         for (auto &I : make_early_inc_range(BB)) {
+
+          I.dropUnknownNonDebugMetadata(DXILCompatibleMDs);
+
           if (I.getOpcode() == Instruction::FNeg) {
----------------
bogner wrote:

I agree. I think DXILPrepare should do things like translate attributes and metadata, insert no-op bitcasts to appease the bitcode writer, and that sort of thing. Replacing ops with their equivalents should squarely be a part of legalization, not here.

I've filed https://github.com/llvm/llvm-project/issues/137685

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


More information about the cfe-commits mailing list