[clang] [OpenACC] 'reduction' init lowering for +, |, ^, || (PR #155924)

Morris Hafner via cfe-commits cfe-commits at lists.llvm.org
Fri Aug 29 08:16:10 PDT 2025


================
@@ -3,9 +3,32 @@
 
 // CHECK: acc.reduction.recipe @reduction_lor__ZTSA5_f : !cir.ptr<!cir.array<!cir.float x 5>> reduction_operator <lor> init {
 // CHECK-NEXT: ^bb0(%[[ARG:.*]]: !cir.ptr<!cir.array<!cir.float x 5>>{{.*}})
-// CHECK-NEXT: cir.alloca !cir.array<!cir.float x 5>, !cir.ptr<!cir.array<!cir.float x 5>>, ["openacc.reduction.init"]
-// TODO OpenACC: Expecting an initialization to... SOME value here.
+// CHECK-NEXT: %[[ALLOCA:.*]] = cir.alloca !cir.array<!cir.float x 5>, !cir.ptr<!cir.array<!cir.float x 5>>, ["openacc.reduction.init", init]
+// CHECK-NEXT: %[[TEMP_ITR:.*]] = cir.alloca !cir.ptr<!cir.float>, !cir.ptr<!cir.ptr<!cir.float>>, ["arrayinit.temp"]
+// CHECK-NEXT: %[[DECAY:.*]] = cir.cast(array_to_ptrdecay, %[[ALLOCA]] : !cir.ptr<!cir.array<!cir.float x 5>>), !cir.ptr<!cir.float>
+// CHECK-NEXT: %[[ZERO_INT:.*]] = cir.const #cir.int<0> : !s32i
+// CHECK-NEXT: %[[ZERO:.*]] = cir.cast(int_to_float, %[[ZERO_INT]] : !s32i), !cir.float
----------------
mmha wrote:

Patch is here: #156036

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


More information about the cfe-commits mailing list