[llvm-branch-commits] [DirectX] Lower `@llvm.dx.handle.fromBinding` to DXIL ops (PR #104251)
David Peixotto via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Wed Aug 21 15:41:45 PDT 2024
================
@@ -119,6 +123,119 @@ class OpLowerer {
});
}
+ Value *createTmpHandleCast(Value *V, Type *Ty) {
+ Function *CastFn = Intrinsic::getDeclaration(&M, Intrinsic::dx_cast_handle,
+ {Ty, V->getType()});
+ CallInst *Cast = OpBuilder.getIRB().CreateCall(CastFn, {V});
+ CleanupCasts.push_back(Cast);
+ return Cast;
+ }
+
+ void cleanupHandleCasts() {
+ SmallVector<CallInst *> ToRemove;
+ SmallVector<Function *> CastFns;
+
+ for (CallInst *Cast : CleanupCasts) {
+ CastFns.push_back(Cast->getCalledFunction());
+ // All of the ops should be using `dx.types.Handle` at this point, so if
+ // we're not producing that we should be part of a pair. Track this so we
----------------
dmpots wrote:
It's not clear from reading what "it should be part of a pair" means and why it must be true. Can we expand the comment here to explain? Is there an assert we should add here as well?
https://github.com/llvm/llvm-project/pull/104251
More information about the llvm-branch-commits
mailing list