[llvm] Adjust bit cast instruction filter for DXIL Prepare pass (PR #142678)
Farzon Lotfi via llvm-commits
llvm-commits at lists.llvm.org
Wed Jun 4 12:58:50 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)) {
+ llvm::Type *ValTy = GlobalVar->getValueType();
+
+ if (auto *ArrTy = llvm::dyn_cast<llvm::ArrayType>(ValTy)) {
----------------
farzonl wrote:
```suggestion
if (auto *ArrTy = dyn_cast<ArrayType>(ValTy)) {
```
https://github.com/llvm/llvm-project/pull/142678
More information about the llvm-commits
mailing list