DirectXShaderCompiler
DirectXShaderCompiler copied to clipboard
Typo and potential null dereference in HLMatrixBitcastLowerPass.cpp
https://github.com/microsoft/DirectXShaderCompiler/blob/8f2881e51178346547c2bf58c74691e05c5cf825/lib/HLSL/HLMatrixBitcastLowerPass.cpp#L229C28-L229C32
The LI below should be ST. The LI is from the previous if testing for U's type.
} else if (LoadInst *LI = dyn_cast<LoadInst>(U)) {
...
} else if (StoreInst *ST = dyn_cast<StoreInst>(U)) {
Value *V = ST->getValueOperand();
if (VectorType *Ty = dyn_cast<VectorType>(V->getType())) {
IRBuilder<> Builder(LI); // <---- Should be `ST`
Value *zeroIdx = Builder.getInt32(0);
unsigned vecSize = Ty->getNumElements();
for (unsigned i = 0; i < vecSize; i++) {
Value *GEP = CreateEltGEP(A, i, zeroIdx, Builder);
Value *Elt = Builder.CreateExtractElement(V, i);
Builder.CreateStore(Elt, GEP);
}
ST->eraseFromParent();
I made an issue instead of a PR because I don't have a test case, just noticed this typo.
Another side-effect of ms-extensions. They were added for the UUID implementation: see #5186