[clang] [llvm] [AMDGPU] Fix monitor-sleep duration validation on GFX12.5 (PR #241042)

Matt Arsenault via cfe-commits cfe-commits at lists.llvm.org
Thu Nov 12 18:01:51 PST 2026


================
@@ -169,6 +169,22 @@ bool SemaAMDGPU::CheckAMDGCNBuiltinFunctionCall(const TargetInfo &TI,
   case AMDGPU::BI__builtin_amdgcn_s_setreg:
     return SemaRef.BuiltinConstantArgRange(TheCall, /*ArgNum=*/0, /*Low=*/0,
                                            /*High=*/UINT16_MAX);
+  case AMDGPU::BI__builtin_amdgcn_s_monitor_sleep: {
+    if (getLangOpts().CUDA && !getLangOpts().CUDAIsDevice)
+      return false;
+    bool NoSleepForever = Builtin::evaluateRequiredTargetFeatures(
+        "no-sleep-forever", CallerFeatureMap);
+    Expr *ArgExpr = TheCall->getArg(0);
+    if (ArgExpr->isInstantiationDependent())
+      return false;
+    llvm::APSInt Sleep;
----------------
arsenm wrote:

Can we replace all this code after #241583

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


More information about the cfe-commits mailing list