[llvm] [DirectX] Implement typedBufferLoad_checkbit (PR #108087)

Justin Bogner via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 11 16:21:11 PDT 2024


================
@@ -265,16 +265,50 @@ class OpLowerer {
 
   /// Replace uses of \c Intrin 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) {
+  Error replaceResRetUses(CallInst *Intrin, CallInst *Op, bool HasCheckBit) {
     IRBuilder<> &IRB = OpBuilder.getIRB();
 
+    Instruction *OldResult = Intrin;
     Type *OldTy = Intrin->getType();
 
+    if (HasCheckBit) {
+      auto *ST = cast<StructType>(OldTy);
----------------
bogner wrote:

`cast` asserts if it can't do the cast (unlike `dyn_cast`, which returns null). It's meant to be used only when it's known that it can't fail.

https://github.com/llvm/llvm-project/pull/108087


More information about the llvm-commits mailing list