-
Notifications
You must be signed in to change notification settings - Fork 15.1k
Labels
Description
DXILPrepare.cpp adds NoOp bitcasts that are causing problems in the validator
llvm-project/llvm/lib/Target/DirectX/DXILPrepare.cpp
Lines 216 to 245 in c7f350f
// Emtting NoOp bitcast instructions allows the ValueEnumerator to be | |
// unmodified as it reserves instruction IDs during contruction. | |
if (auto LI = dyn_cast<LoadInst>(&I)) { | |
if (Value *NoOpBitcast = maybeGenerateBitcast( | |
Builder, PointerTypes, I, LI->getPointerOperand(), | |
LI->getType())) { | |
LI->replaceAllUsesWith( | |
Builder.CreateLoad(LI->getType(), NoOpBitcast)); | |
LI->eraseFromParent(); | |
} | |
continue; | |
} | |
if (auto SI = dyn_cast<StoreInst>(&I)) { | |
if (Value *NoOpBitcast = maybeGenerateBitcast( | |
Builder, PointerTypes, I, SI->getPointerOperand(), | |
SI->getValueOperand()->getType())) { | |
SI->replaceAllUsesWith( | |
Builder.CreateStore(SI->getValueOperand(), NoOpBitcast)); | |
SI->eraseFromParent(); | |
} | |
continue; | |
} | |
if (auto GEP = dyn_cast<GetElementPtrInst>(&I)) { | |
if (Value *NoOpBitcast = maybeGenerateBitcast( | |
Builder, PointerTypes, I, GEP->getPointerOperand(), | |
GEP->getSourceElementType())) | |
GEP->setOperand(0, NoOpBitcast); | |
continue; | |
} |
It is changing
store float 2.000000e+00, ptr addrspace(3) getelementptr (float, ptr addrspace(3) @arrayofVecData.scalarized.1dim, i32 1), align 4
to:
%2 = bitcast ptr addrspace(3) getelementptr (float, ptr addrspace(3) @arrayofVecData.scalarized.1dim, i32 1) to ptr addrspace(3)
store float 2.000000e+00, ptr addrspace(3) %2, align 4
commenting out these no ops resolves all 848 ptr bitcast errors.
Metadata
Metadata
Assignees
Labels
Type
Projects
Status
Closed