[flang][Semantics] Accept multiple initialization of a COMMON block (#218529)
…as a GNU extension
Some compilers accept a named COMMON block variable being redundantly
initialized (via DATA statements or declaration initializers) in more
than one program unit, as a nonstandard extension, so long as every
appearance that initializes the block does so identically: the same
members are initialized to the same values everywhere the block appears.
flang currently rejects this unconditionally as a hard error, whether or
not the appearances agree.
Downgrade this to a portability warning enabled by default (matching the
behavior of the other compilers) when the initializations are
duplicates. A conflicting initialization -- a different value for a
shared member, or a member initialized in one appearance but not another
-- remains a hard error, as it has no defined, portable behavior
(compilers that accept it disagree on which appearance wins). A member
that is only indirectly initialized via an equivalenced object (rather
[24 lines not shown]
[BOLT][RISCV] Handle static IFUNC calls through .iplt (#207733)
Teach BOLT to recognize RISC-V `.iplt` as a PLT-like section and make
the RISC-V `.plt` entry size explicit. Static RISC-V binaries can use
`.iplt` entries together with `R_RISCV_IRELATIVE` relocations for GNU
IFUNC calls, while call sites reference the IFUNC symbol through
`R_RISCV_CALL_PLT`.
[AMDGPU] Expose LDS block features to TargetParser (#220717)
Add `FeatureHalfAddressablePhysicalLocalMemory` to
`AMDGPUFrontendVisibleFeatures` so TargetParser carries them in its
per-GPU feature bitset.
[MLIR][LLVM] Avoid narrowing wide constant shift amounts (#220777)
LLVM::ShlOp::fold() used APInt::getZExtValue() to compare a constant
shift
amount against the operand bit width.
For wide integer constants whose active value exceeds 64 bits, such as
an i128
shift amount of 2^100, getZExtValue() asserts before the fold can
determine
that the shift is out of range.
Compare the APInt directly with the operand bit width using uge()
instead. This
preserves the existing behavior for out-of-range shifts, which are
currently
left unfolded, while avoiding the unsafe narrowing.
Add regression coverage for:
[4 lines not shown]
[orc-rt] Sink remaining Compiler.h macros into C API header (#220780)
ORC_RT_LIKELY, ORC_RT_UNLIKELY, ORC_RT_WEAK_IMPORT,
ORC_RT_BUILTIN_UNREACHABLE and ORC_RT_UNREACHABLE are useful from C but
were only reachable through the C++ header, so move them to
orc-rt-c/support/Compiler.h.
Rename ORC_RT_EXPORT to ORC_RT_CXX_EXPORT so that both export macros
name their language explicitly. The C++ header is left holding only that
macro. Keep the header separate anyway so that C APIs don't accidentally
use ORC_RT_CXX_EXPORT.
Extend CAPICompileTest.c to use each moved macro from C, with assertions
in CompilerTest.cpp so the behaviour is checked and not just the syntax.
[ELF] Omit zero-range FDEs from .eh_frame_hdr (#220492)
A zero-sized function (e.g. only `__builtin_unreachable()` in the body
when not using -trap-unreachable) shares its address with the next
function, and its zero-range FDE can win the uniquify step, leaving the
next real function impossible to unwind.
Fix #218124 by dropping FDEs with a zero PC range from the search table.
[AMDGPU] Expose the half-addressable LDS feature to TargetParser
Add FeatureHalfAddressablePhysicalLocalMemory to
AMDGPUFrontendVisibleFeatures so TargetParser carries it in its per-GPU
feature bitset, where getLocalMemorySize can read it.
It is listed in FrontendOnlyFeatures, so clang does not serialize it
into the target-feature string: it is a capability implied by the
subtarget, not something a user selects.
Change-Id: I87edf18bbb527fb90e6a8af1144e985024f063f7
Co-Authored-By: Claude Opus 5 (1M context) <noreply at anthropic.com>
[AArch64][NFC] Make insertion of CMP for fused cond. branches reusable (#220771)
Both if-conversion and CCMP-chain forming need to undo the fusion of
conditional branches such as CBZ or CB.<cc>. With the introduction of
FEAT_CMPBR, this logic got quite involved.
This patch makes the functionality reusable through AArch64InstrInfo.
Initialize PBQP Pass for Clang (#217954)
As mentioned in discussion on
https://github.com/llvm/llvm-project/issues/16391, the PBQP allocator is
not available to clang despite existing in the backend. This updates
code to initialize the pass and make it available to clang.
[SLP] Fix-up profile metadata for runtime alias checks (#220769)
This makes two main changes
* Adds profile information regardless of whether or not the function is
profile. This data is still useful even when little else is profiled.
e.g., it helps ensure that registers are spilt in the cold block rather
than the hot one.
* Switches to using MDBuilder's branch weight designations. The named
values make the meaning of the code clearer and this is the standard way
to denote cold code in the compiler absent additional information about
the specific frequency here.
[flang] Warn when an INTENT(IN) dummy is passed to a dummy with no INTENT (#220667)
F'2023 8.5.10 paragraph 2 requires that a nonpointer INTENT(IN) dummy
argument "shall neither be defined nor become undefined during the
invocation and execution of the procedure". A program can violate that
requirement without any diagnostic today by passing the INTENT(IN) dummy
argument on as an actual argument to a procedure whose corresponding
dummy argument has no INTENT attribute: that callee is free to define
its dummy argument, and since #207732 flang propagates INTENT(IN) to
LLVM as `readonly`, so the optimizer is entitled to assume the
definition never happens. The observable result is a program whose
answers change with the optimization level, with nothing pointing at the
cause.
```fortran
program main
integer :: kk = 1
call s(kk)
print *, kk ! 1 at -O1, 3 at -O2
[28 lines not shown]
[flang][NFC] Allow simplify-region-lite to run on any op (#220698)
The pass only walks the regions of getOperation(). Pinning it to
ModuleOp forced a single liveness lattice over the whole compile unit
and blocked scheduling it under a nested pass manager. Drop the
ModuleOp constraint so callers can run it per IsolatedFromAbove op.
Existing module-level addPass() uses are unchanged.
[offload][nfc] Extract libomptarget infrastructure into libompaccsupport (#213784)
libompaccsupport will become the support library for both OpenMP and
OpenACC. This patch extracts the files that will become part of it.
Currently it only moves the files and the build configuration is
unchanged.
Next patches will start refactoring libompaccsupport to flesh out the
subset of the infrastructure that will be shared between OpenMP and
OpenACC in small verifiable chunks while maintaining libomptarget's
existing behaviour.
Gradually adding the libacctarget implementation that uses
libompaccsupport will also follow.
[VPlan][Predicator] Preserve some uniform control flow
Implements "Partial Control-Flow Linearization" by Simon Moll and
Sebastian Hack.
That should allow implementation of an alternative to
https://github.com/llvm/llvm-project/pull/141900 based on this
functionality (see BOSCC in the paper).