Hi Jakub,

On 04.05.22 14:03, Jakub Jelinek wrote:
On Wed, Apr 20, 2022 at 03:19:38PM +0200, Tobias Burnus wrote:
--- a/gcc/omp-low.cc
+++ b/gcc/omp-low.cc
@@ -13656,26 +13656,30 @@ lower_omp_target (gimple_stmt_iterator *gsi_p, 
omp_context *ctx)
             new_var = lookup_decl (var, ctx);
             new_var = DECL_VALUE_EXPR (new_var);
             tree v = new_var;
+            tree v2 = var;
+            if (OMP_CLAUSE_CODE (c) == OMP_CLAUSE_USE_DEVICE_PTR
+                || OMP_CLAUSE_CODE (c) == OMP_CLAUSE_USE_DEVICE_ADDR)
+              {
+                v2 = maybe_lookup_decl_in_outer_ctx (var, ctx);
+                if (DECL_HAS_VALUE_EXPR_P (v2))
+                  v2 = DECL_VALUE_EXPR (v2);
I don't understand the above 2 lines, why do you need that?

I think it was intermittently required with some (half-)working patch.
But I concur that it is no longer is needed.

Otherwise LGTM, so if the 2 lines aren't needed, please also drop the
{}s around v2 = maybe_lookup_decl_in_outer_ctx (var, ctx); and reindent.
I did so, tested it also on my end and committed it as

r13-116-g3f8c389fe90bf565a6221a46bb7fb745dd4c1510

Thanks for the review!

Tobias

-----------------
Siemens Electronic Design Automation GmbH; Anschrift: Arnulfstraße 201, 80634 
München; Gesellschaft mit beschränkter Haftung; Geschäftsführer: Thomas 
Heurung, Frank Thürauf; Sitz der Gesellschaft: München; Registergericht 
München, HRB 106955

Reply via email to