[clang] [Clang] Move hlsl_wave_get_lane_index to EmitHLSLBuiltinExpr (PR #87131)

Farzon Lotfi via cfe-commits cfe-commits at lists.llvm.org
Fri Mar 29 17:59:23 PDT 2024


================
@@ -18317,6 +18307,14 @@ Value *CodeGenFunction::EmitHLSLBuiltinExpr(unsigned BuiltinID,
         /*ReturnType=*/Op0->getType(), Intrinsic::dx_rsqrt,
         ArrayRef<Value *>{Op0}, nullptr, "dx.rsqrt");
   }
+  case Builtin::BI__builtin_hlsl_wave_get_lane_index: {
+    auto *CI = EmitRuntimeCall(CGM.CreateRuntimeFunction(
+        llvm::FunctionType::get(IntTy, {}, false), "__hlsl_wave_get_lane_index",
+        {}, false, true));
+    if (getTarget().getTriple().isSPIRVLogical())
+      CI = dyn_cast<CallInst>(addControlledConvergenceToken(CI));
+    return RValue::get(CI);
----------------
farzonl wrote:

this isn't going to work  we don't return RValues from this function that happens later see: https://github.com/llvm/llvm-project/blob/a8b0ecd2605ff23f495a8af64e06c35f86834e54/clang/lib/CodeGen/CGBuiltin.cpp#L6192C3-L6193C27



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


More information about the cfe-commits mailing list