[clang] [HLSL] Enable -fconvergent-functions by default (PR #86571)

via cfe-commits cfe-commits at lists.llvm.org
Wed Mar 27 07:47:52 PDT 2024


aniplcc wrote:

I was getting match errors with the RUN script. I went ahead and updated it with the checks in:
`clang/test/CodeGen/convergent-functions.cpp`    
 Hope that's correct/OK?
 
```hlsl
// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.4-library -emit-llvm -disable-llvm-passes -o - %s | FileCheck -check-prefixes=CHECK,CONVFUNC %s 

// CHECK: attributes
// NOCONVFUNC-NOT: convergent
// CONVFUNC-SAME: convergent
// CHECK-SAME: }
void fn() {
};
```

Now it just *checks* the presence of `convergent` in attributes, as it does in `convergent-functions.cpp`.
Note: I also left out the `#0` in the attributes to generalize it better. Is that okay?

Also for reference, the emitted llvmir from my forked clang build
```llvm
; ModuleID = 'CodeGenHLSL/convergent-funtions.hlsl'
source_filename = "CodeGenHLSL/convergent-funtions.hlsl"
target datalayout = "e-m:e-p:32:32-i1:32-i8:8-i16:16-i32:32-i64:64-f16:16-f32:32-f64:64-n8:16:32:64"
target triple = "dxil-pc-shadermodel6.4-library"

; Function Attrs: convergent noinline nounwind optnone
define void @"?fn@@YAXXZ"() #0 {
entry:
  ret void
}

attributes #0 = { convergent noinline nounwind optnone "no-trapping-math"="true" "stack-protector-buffer-size"="8" }
...*some more lines*
```

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


More information about the cfe-commits mailing list