[PATCH] D122269: Modify DXILPrepare to emit no-op bitcasts
Chris Bieneman via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Apr 15 07:34:30 PDT 2022
beanz added inline comments.
================
Comment at: llvm/lib/Target/DirectX/DXILPrepare.cpp:123
+ }
+ // Insert bitcasts at the top of the block...
+ Builder.SetInsertPoint(Inst->getParent(),
----------------
python3kgae wrote:
> Why bitcasts need to be at top of the block?
> Could there be phi at top of the block?
Good point. I will adjust.
================
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());
----------------
python3kgae wrote:
> Cannot find the check for only have one type.
> Does it hide in PointerTypes.find ?
>
That comment isn't great. The pointer analysis assigns one type to each value based on how it is used. If the type of the user and the type assigned by pointer analysis match, we don't need a bitcast because the value will be assigned that type. If they don't match, we need a bitcast so that the user gets the correct typed pointer.
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