1. Feb 22, 2024
    • Fangrui Song's avatar
      [ARM,MC] Support FDPIC relocations (#82187) · 2f900f7d
      Fangrui Song authored
      Linux kernel fs/binfmt_elf_fdpic.c supports FDPIC for MMU-less systems.
      GCC/binutils/qemu support FDPIC ABI for ARM
      (https://github.com/mickael-guene/fdpic_doc).
      _ARM FDPIC Toolchain and ABI_ provides a summary.
      
      This patch implements FDPIC relocations to the integrated assembler.
      There are 6 static relocations and 2 dynamic relocations, with
      R_ARM_FUNCDESC as both static and dynamic.
      
      gas requires `--fdpic` to assemble data relocations like `.word
      f(FUNCDESC)`.
      This patch adds `MCTargetOptions::FDPIC` and reports an error if FDPIC
      is not set.
      2f900f7d
  2. Feb 21, 2024
    • Krystian Stasiowski's avatar
      [𝘀𝗽𝗿] changes introduced through rebase · 37a3b014
      Krystian Stasiowski authored
      Created using spr 1.3.4
      
      [skip ci]
      37a3b014
    • Krystian Stasiowski's avatar
      [Clang][Sema] Diagnose declarative nested-name-specifiers naming alias templates (#80842) · fb615cf3
      Krystian Stasiowski authored
      According to [expr.prim.id.qual] p3:
      > The _nested-name-specifier_ `​::` nominates the global namespace. A
      _nested-name-specifier_ with a _computed-type-specifier_ nominates the
      type denoted by the _computed-type-specifier_, which shall be a class or
      enumeration type. **If a _nested-name-specifier_ `N` is declarative and
      has a _simple-template-id_ with a template argument list `A` that
      involves a template parameter, let `T` be the template nominated by `N`
      without `A`. `T` shall be a class template.**
      
      Meaning, the out-of-line definition of `A::f` in the following example
      is ill-formed:
      ```
      template<typename T>
      struct A 
      { 
          void f(); 
      };
      
      template<typename T>
      using B = A<T>;
      
      template<typename T>
      void B<T>::f() { } // error: a declarative nested name specifier cannot name an alias template
      ```
      
      This patch diagnoses such cases as an extension (in group `alias-template-in-declaration-name`).
      fb615cf3
    • Lang Hames's avatar
      [ORC] Add SectCreateMaterializationUnit, llvm-jitlink -sectcreate option. · c625b996
      Lang Hames authored
      The SectCreateMaterializationUnit creates a LinkGraph with a single named
      section containing a single named block whose content is given by a
      MemoryBuffer. It is intended to support emulation of ld64's -sectcreate option.
      c625b996
    • Joseph Huber's avatar
      [libc] Cleanup of hermetic test flag handling (#82384) · 5454991c
      Joseph Huber authored
      Summary:
      This cleans up the handling of hermetic test flags. Primarily done to
      simplify the GPU rework patch.
      5454991c
    • Jorge Gorbe Moya's avatar
      [bazel] fix build after 4c6043de · d39d5ccb
      Jorge Gorbe Moya authored
      d39d5ccb
    • Caroline Concatto's avatar
      Revert "[AArch64] Restore Z-registers before P-registers (#79623)" · 48af281f
      Caroline Concatto authored
      This reverts commit 3f0404aa.
      
      std::reverse is breaking some builds
      48af281f
    • Caroline Concatto's avatar
      Revert "[AArch64] Remove unused ReverseCSRRestoreSeq option. (#82326)" · 7af70643
      Caroline Concatto authored
      Patch  3f0404aa is breaking some debugs build so we cannot use the reverse here.
      
      This reverts commit 493f1010.
      7af70643
    • Krystian Stasiowski's avatar
      [Clang][Sema] Convert warning for extraneous template parameter lists to an... · 8302cef8
      Krystian Stasiowski authored
      [Clang][Sema] Convert warning for extraneous template parameter lists to an extension warning (#82277)
      
      We currently accept the following explicit specialization with a warning
      for the extraneous template parameter list:
      ```
      template<typename T>
      void f();
      
      template<>
      template<>
      void f<int>(); // warning: extraneous template parameter list in template specialization
      ```
      
      This should really be an extension warning so we reject with
      `-pedantic-errors`. This patch converts the warning to an extension
      warning.
      8302cef8
    • Simon Pilgrim's avatar
      [InstCombine] foldFCmpIntToFPConst - simplify repeated calls to... · d2173d8f
      Simon Pilgrim authored
      [InstCombine] foldFCmpIntToFPConst - simplify repeated calls to getBitWidth/getScalarSizeInBits. NFC.
      
      Noticed on #82241 - we don't need to use the IntegerType just for the scalar width, and we were calling it 3 times in different forms - we can just call Type::getScalarSizeInBits once and reuse.
      d2173d8f
    • James Robinson's avatar
      [Fuzzer] Use user signal to coordinate handler shutdown (#82067) · 7f3980a7
      James Robinson authored
      This updates the signal handle thread coordinating to use a user signal
      bit on the SignalHandlerEvent to coordinate shutdown instead of closing
      the event handle. Closing the event handle is racy as the handle may be
      closed before the signal handler thread resolves the handle value in
      _zx_object_wait_many() and we would like to make this an explicit error.
      Using the user signal bit 1 instead and then closing the event object
      after the signal handler thread is joined cannot race as the wait will
      terminate whether the signal is raised before or after the wait begins.
      7f3980a7
    • Shoaib Meenai's avatar
      [MergeFunctions] Fix thunks for non-instruction debug info (#82080) · d2942a86
      Shoaib Meenai authored
      When MergeFunctions creates new thunk functions, it needs to copy over
      the debug info format kind from the original function, otherwise we'll
      mix debug info formats and run into assertions. This was exposed by a
      downstream change that runs MergeFunctions before inlining, which caused
      assertions when inlining attempted to inline thunks created by merging,
      and the added test covers both scenarios where merging creates thunks.
      d2942a86
    • Cyndy Ishida's avatar
      [clang][InstallAPI] Add input file support to library (#81701) · 4c6043de
      Cyndy Ishida authored
      This patch adds support for expected InstallAPI inputs. InstallAPI
      accepts a well defined filelist of headers and how those headers
      represent a single library.
      
      InstallAPI captures header files to determine linkable symbols to then
      compare against what was compiled in a binary dylib and generate TBD
      files.
      4c6043de
    • John Harrison's avatar
      [lldb-dap] Do not write over the existing error if launchCommands fail during... · ae8facc1
      John Harrison authored
      [lldb-dap] Do not write over the existing error if launchCommands fail during debugger launch. (#82051)
      
      This fixes an issue where the error is lost if a command while executing
      `launchCommands` when launching the debugger.
      
      This should fix #82048
      ae8facc1
    • Orlando Cazalet-Hyams's avatar
    • Fangrui Song's avatar
      [llvm-objcopy] Fix file offsets when PT_INTERP/PT_LOAD offsets are equal (#80562) · ef283790
      Fangrui Song authored
      (#79887) When the offset of a PT_INTERP segment equals the offset of a
      PT_LOAD segment, we consider that the parent of the PT_LOAD segment is
      the PT_INTERP segment. In `layoutSegments`, we place both segments to be
      after the current `Offset`, ignoring the PT_LOAD alignment.
      
      This scenario is possible with fixed section addresses, but doesn't
      happen with default linker layouts (.interp precedes other sections and
      is part of a PT_LOAD segment containing the ELF header and program
      headers).
      
      ```
      % cat a.s
      .globl _start; _start: ret
      .rodata; .byte 0
      .tdata; .balign 4096; .byte 0
      % clang -fuse-ld=lld a.s -o a -nostdlib -no-pie -z separate-loadable-segments -Wl,-Ttext=0x201000,--section-start=.interp=0x202000,--section-start=.rodata=0x202020,-z,nognustack
      % llvm-objcopy a a2
      % llvm-readelf -l a2   # incorrect offset(PT_LOAD)
        Type           Offset   VirtAddr           PhysAddr           FileSiz  MemSiz   Flg Align
        PHDR           0x000040 0x0000000000200040 0x0000000000200040 0x0001c0 0x0001c0 R   0x8
        INTERP         0x001001 0x0000000000202000 0x0000000000202000 0x00001c 0x00001c R   0x1
            [Requesting program interpreter: /lib64/ld-linux-x86-64.so.2]
        LOAD           0x000000 0x0000000000200000 0x0000000000200000 0x000200 0x000200 R   0x1000
        LOAD           0x001000 0x0000000000201000 0x0000000000201000 0x000001 0x000001 R E 0x1000
      //// incorrect offset
        LOAD           0x001001 0x0000000000202000 0x0000000000202000 0x000021 0x000021 R   0x1000
        LOAD           0x002000 0x0000000000203000 0x0000000000203000 0x000001 0x001000 RW  0x1000
        TLS            0x002000 0x0000000000203000 0x0000000000203000 0x000001 0x000001 R   0x1000
        GNU_RELRO      0x002000 0x0000000000203000 0x0000000000203000 0x000001 0x001000 R   0x1000
      ```
      
      The same issue occurs for PT_TLS/PT_GNU_RELRO if we PT_TLS's alignment
      is smaller and we place the PT_LOAD after PT_TLS/PT_GNU_RELRO segments
      (not linker default, but possible with a `PHDRS` linker script command).
      
      Fix #79887: when two segments have the same offset, order the one with a
      larger alignment first. In the previous case, the PT_LOAD segment will
      go before the PT_INTERP segment. In case of equal alignments, it doesn't
      matter which segment is treated as the parent segment.
      ef283790
    • Simon Pilgrim's avatar
      [X86] computeKnownBitsForTargetNode - add generic handling of PSHUFB · 066773c4
      Simon Pilgrim authored
      When PSHUFB is used as a LUT (for CTPOP, BITREVERSE etc.), its the source operand that is constant and the index operand the variable. As long as the indices don't set the MSB (which zeros the output element), then the common known bits from the source operand can be used directly, even though the shuffle mask isn't constant.
      
      Further helps to improve CTPOP reduction codegen
      066773c4
    • Xing Xue's avatar
      [OpenMP][AIX]Add assembly file containing microtasking routines and unnamed... · 94100bc2
      Xing Xue authored
      [OpenMP][AIX]Add assembly file containing microtasking routines and unnamed common block definitions (#81770)
      
      This patch adds assembly file `z_AIX_asm.S` that contains the 32- and
      64-bit XCOFF version of microtasking routines and unnamed common block
      definitions. This code has been run through the libomp LIT tests and a
      user package successfully.
      94100bc2
    • Aaron Ballman's avatar
      [C23] No longer assert on huge enumerator values (#81760) · 3b7ba248
      Aaron Ballman authored
      C23 added the wb and uwb suffixes to generate a bit-precise integer
      value. These values can be larger than what is representable in intmax_t
      or uintmax_t.
      
      We were asserting that an enumerator constant could not have a value
      larger than unsigned long long but that's now a possibility. This patch
      turns the assertion into a "value too large" diagnostic.
      
      Note, we do not yet implement WG14 N3029 and so the behavior of this
      patch will cause the enumerator to be cast to unsigned long long, but
      this behavior may change in the future. GCC selects __uint128_t as the
      underlying type for such an enumeration and we may want to match that
      behavior in the future. This patch has several FIXME comments related to
      this and the release notes call out the possibility of a change in
      behavior in the future.
      
      Fixes https://github.com/llvm/llvm-project/issues/69352
      3b7ba248
    • Florian Hahn's avatar
      [VPlan] Merge main VPlan verifer with HCFG verifier. · 9923d29c
      Florian Hahn authored
      Unify VPlan verifiers in verifyVPlanIsValid. This adds verification for
      various properties on blocks to the verifier used for VPlans generated
      by the inner loop vectorizer. It also adds def-use checks for the
      verifier used in the VPlan native path.
      
      This drops the separate flag to enable HCFG verification. Instead, all
      VPlans are verified once they have been created, if assertions are
      enabled.
      
      This also removes VPWidenPHIRecipe from VPHeaderPHIRecipe; it is used to
      model any phi node in the native path.
      9923d29c
    • Noah Goldstein's avatar
      [ValueTracking] Improve tracking for constant range of `{s|u}rem C, x` · 9facaadd
      Noah Goldstein authored
      Current we only support `C` as the remainder, but we can also limit
      with a constant numerator.
      
      Proofs: https://alive2.llvm.org/ce/z/QB95gU
      
      Closes #82303
      9facaadd
    • Noah Goldstein's avatar
    • Schrodinger ZHU Yifan's avatar
      [libc] use LIBC_HAS_BUILTIN instead __has_builtin (#82377) · a73e9244
      Schrodinger ZHU Yifan authored
      fix the issue that `__has_builtin` is undefined on some non-clang
      targets.
      a73e9244
    • Schrodinger ZHU Yifan's avatar
    • Jeremy Morse's avatar
      [DebugInfo][RemoveDIs] Set new-dbg-info flag from Modules correctly (#82373) · 3e76e608
      Jeremy Morse authored
      It turns out there's a pathway for Functions to be inserted into modules
      without having the "New" debug-info flag set correctly, which this patch
      fixes. Sadly there isn't a Module::insert method to instrument out
      there, everyone touches the list directly.
      
      This fix exposes a path where such functions are produced in the
      outliner in the wrong mode; requiring a fix there to correctly drop
      RemoveDIs-mode debug-info. This is covered by
      test/DebugInfo/AArch64/ir-outliner.ll
      3e76e608
    • Orlando Cazalet-Hyams's avatar
      [RemoveDIs][NFC] Introduce DbgRecord base class [1/3] (#78252) · ababa964
      Orlando Cazalet-Hyams authored
      Patch 1 of 3 to add llvm.dbg.label support to the RemoveDIs project. The
      patch stack adds a new base class
      
          -> 1. Add DbgRecord base class for DPValue and the not-yet-added
                DPLabel class.
             2. Add the DPLabel class.
             3. Enable dbg.label conversion and add support to passes.
      
      Patches 1 and 2 are NFC.
      
      In the near future we also will rename DPValue to DbgVariableRecord and
      DPLabel to DbgLabelRecord, at which point we'll overhaul the function
      names too. The name DPLabel keeps things consistent for now.
      ababa964
  3. Feb 20, 2024