================
@@ -259,6 +259,114 @@ class OpLowerer {
lowerToBindAndAnnotateHandle(F);
}
+ /// Replace uses of \c V with the values in the `dx.ResRet` of \c Op. Since
we
+ /// expect to be post-scalarization, make an effort to avoid vectors.
+ Error replaceResRetUses(CallInst *Intrin, CallInst *Op) {
+ IRBuilder<> &IRB = OpBuilder.getIRB();
+
+ Type *OldRetTy = Intrin->getType();
+
+ // For scalars, we just extract the first element.
+ if (!isa<FixedVectorType>(OldRetTy)) {
+ Value *EVI = IRB.CreateExtractValue(Op, 0);
+ Intrin->replaceAllUsesWith(EVI);
+ Intrin->eraseFromParent();
+ return Error::success();
+ }
+
+ auto *VecTy = cast<FixedVectorType>(OldRetTy);
+ unsigned N = VecTy->getNumElements();
----------------
bogner wrote:
I moved them closer to the use and made them const to try to make this a bit
clearer.
https://github.com/llvm/llvm-project/pull/104252
_______________________________________________
llvm-branch-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits