microsoft / microsoft/DirectXShaderCompiler
Typo and potential null dereference in HLMatrixBitcastLowerPass.cpp
Open
Nobody has claimed this yet.
matrix-bug
tech-debt
- Dominant language
- C++
- Stars
- 3.7k
- Forks
- 900
- Avg merge
- 2d 11h
- Merged PRs (30d)
- 44
Description
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.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at lib/HLSL/HLMatrixBitcastLowerPass.cpp around line 229 and compare the load and store branches shown in the issue. Confirm that the store branch uses ST when constructing IRBuilder, then build or validate the compiler as appropriate; the issue provides no test case, so done means the typo and potential null dereference are corrected without changing the surrounding behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 48/100