[clang] [clang][OpenMP] Emit host diagnostics that were deferred and never flushed (PR #220316)

via cfe-commits cfe-commits at lists.llvm.org
Wed Oct 14 09:56:46 PDT 2026


pgerell wrote:

> I think, CodeGenModule::MayBeEmittedEagerly also must be updated:
> 
> ```
> // RUN: %clang_cc1 -verify -triple x86_64-unknown-unknown -emit-llvm-only -fopenmp -fopenmp-version=45 %s
> void g(int x) { __asm__("nop" : "=@"(x)); } // expected-error {{invalid output constraint '=@' in asm}}
> #pragma omp declare target to(g)
> ```

This also crashes at 4.5 without the declare target, since 4.5 emits everything eagerly.
Simplest fix: don't emit functions eagerly at all when OpenMP && !OpenMPSimd. It fixes both cases, but reorders the IR in 15 OpenMP CodeGen tests. I checked that the output is otherwise unchanged.
OK to go that way, or would you prefer something narrower?

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


More information about the cfe-commits mailing list