[llvm] Adjust bit cast instruction filter for DXIL Prepare pass (PR #142678)

Deric C. via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 4 13:04:38 PDT 2025


================
@@ -148,9 +148,47 @@ class DXILPrepareModule : public ModulePass {
                                      Type *Ty) {
     // Omit bitcasts if the incoming value matches the instruction type.
     auto It = PointerTypes.find(Operand);
-    if (It != PointerTypes.end())
-      if (cast<TypedPointerType>(It->second)->getElementType() == Ty)
+    if (It != PointerTypes.end()) {
+      auto *OpTy = cast<TypedPointerType>(It->second)->getElementType();
+      if (OpTy == Ty)
         return nullptr;
+    }
+
+    // Also omit the bitcast for matching global array types
+    if (auto *GlobalVar = llvm::dyn_cast<llvm::GlobalVariable>(Operand)) {
----------------
Icohedron wrote:

Yea I think we should add a case for Alloca

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


More information about the llvm-commits mailing list