[PATCH] D122269: Modify DXILPrepare to emit no-op bitcasts
Xiang Li via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Apr 14 23:32:35 PDT 2022
python3kgae added inline comments.
================
Comment at: llvm/lib/Target/DirectX/DXILPrepare.cpp:123
+ }
+ // Insert bitcasts at the top of the block...
+ Builder.SetInsertPoint(Inst->getParent(),
----------------
Why bitcasts need to be at top of the block?
Could there be phi at top of the block?
================
Comment at: llvm/lib/Target/DirectX/DXILPrepare.cpp:136
+ if (auto Inst = dyn_cast_or_null<StoreInst>(&I)) {
+ // Omit bitcasts if we only have one type
+ auto It = PointerTypes.find(Inst->getPointerOperand());
----------------
Cannot find the check for only have one type.
Does it hide in PointerTypes.find ?
================
Comment at: llvm/lib/Target/DirectX/DXILPrepare.cpp:137-142
+ auto It = PointerTypes.find(Inst->getPointerOperand());
+ if (It != PointerTypes.end()) {
+ if (cast<TypedPointerType>(It->second)->getElementType() ==
+ Inst->getValueOperand()->getType())
+ continue;
+ }
----------------
Could we have shouldOmit function and createNoOpBitcast function? The same code happened 3 times.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D122269/new/
https://reviews.llvm.org/D122269
More information about the llvm-commits
mailing list