jhuber6 wrote: I'm unsure how to resolve the issue of `CGF.EmitScalarExpr(NumTeams)` not returning the correct value now. For the following code ```c #include <stdio.h> #include <stdlib.h>
int main() { int Teams = 10; #pragma omp target teams distribute parallel for num_teams(Teams) for (int i = 0; i < 1; ++i) ; return 0; } ``` I get this LLVM-IR, which suggests that it's reading beyond the expected `__context` struct. ```llvm ; Function Attrs: convergent noinline norecurse nounwind optnone uwtable define weak_odr protected void @__omp_offloading_10302_af886a3_main_l9(ptr noalias noundef %dyn_ptr, ptr noalias noundef %__context) #0 { entry: %dyn_ptr.addr = alloca ptr, align 8 %__context.addr = alloca ptr, align 8 %.capture_expr. = alloca i32, align 4 %0 = call i32 @__kmpc_global_thread_num(ptr @3) store ptr %dyn_ptr, ptr %dyn_ptr.addr, align 8 store ptr %__context, ptr %__context.addr, align 8 %1 = load ptr, ptr %__context.addr, align 8 %2 = getelementptr inbounds %struct.anon, ptr %1, i32 0, i32 0 %3 = load i32, ptr %2, align 4 store i32 %3, ptr %.capture_expr., align 4 %4 = load i32, ptr %.capture_expr., align 4 call void @__kmpc_push_num_teams(ptr @3, i32 %0, i32 %4, i32 0) call void (ptr, i32, ptr, ...) @__kmpc_fork_teams(ptr @3, i32 0, ptr @__omp_offloading_10302_af886a3_main_l9.omp_outlined) ret void } ``` Any idea how to resolve this? I'm assuming the way we do this now is no longer valid somehow because of the struct indirection. https://github.com/llvm/llvm-project/pull/91264 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits