1. Jul 28, 2022
  2. Jul 27, 2022
    • Peixin Qiao's avatar
      [flang] Support the color diagnostics on scanning, parsing, and semantics · 8df63a23
      Peixin Qiao authored
      The options -f{no-}color-diagnostics have been supported in driver. This
      supports the behaviors in scanning, parsing, and semantics, and the
      behaviors are exactly the same as the driver.
      
      To illustrate the added behaviour, consider the following input file:
      ```! file.f90
      program m
        integer :: i = k
      end
      ```
      In the following invocations, "error: Must be a constant value" _will be_
      formatted:
      ```
      $ flang-new file.f90
      error: Semantic errors in file.f90
      ./file.f90:2:18: error: Must be a constant value
          integer :: i = k
      ```
      Note that "error: Semantic errors in file.f90" is also formatted, which
      is supported in https://reviews.llvm.org/D126164.
      
      Also note that only "error", "warning" and "portability" are formatted.
      Check the following input file:
      ```! file2.f90
      program m
        integer :: i =
      end
      ```
      ```
      $ flang-new test2.f90
      error: Could not parse test2.f90
      ./test2.f90:2:11: error: expected '('
          integer :: i =
                  ^
      ./test2.f90:2:3: in the context: statement function definition
          integer :: i =
          ^
      ...
      ```
      The "error: Could not parse test2.f90" and "error: expected '('" are
      formatted. Others such as "in the context" are not formatted yet, which
      may or may not be supported.
      
      Reviewed By: awarzynski
      
      Differential Revision: https://reviews.llvm.org/D126166
      8df63a23
    • Mark de Wever's avatar
      [libc++][doc] Updates format status page. · 02761e3f
      Mark de Wever authored
      Remove some no longer relevant details and adds the C++23 papers voted
      in at the last plenary.
      02761e3f
    • Peixin Qiao's avatar
      [NFC][flang] Add FIXME for privatization of loop bounds in Bridge.cpp · 4640a8a2
      Peixin Qiao authored
      There is post comment of adding TODO/FIXME for privatization of loop
      bounds in D127137. D127137 fixes the bug in OpenMP firstprivate clause,
      which should be refactored later according to the post comment. Add
      FIXME for it.
      
      Differential Revision: https://reviews.llvm.org/D130625
      4640a8a2
    • Sanjay Patel's avatar
      [AggressiveInstCombine] check sqrt operand to allow more libcall->intrinsic transforms · e079bf65
      Sanjay Patel authored
      This should fix issue #56383 (at least when compiled with -O3 because this pass is only
      run at -O3 currently).
      e079bf65
    • Sanjay Patel's avatar
    • Matt Devereau's avatar
      35e781fb
    • Mark de Wever's avatar
      [libc++][doc] Updates status documents. · 759efa76
      Mark de Wever authored
      Adds the papers and LWG issues voted in during the July 2022 plenary.
      
      Note the updating of the project based statuses is left to the active
      contributors of these projects.
      
      Reviewed By: #libc, huixie90, philnik
      
      Differential Revision: https://reviews.llvm.org/D130595
      759efa76
    • Dmitri Gribenko's avatar
      [amdgpu][nfc] Fix build with a certan Clang version · b435da02
      Dmitri Gribenko authored
      It errors out in the Bazel CI:
      
      AMDGPULowerModuleLDSPass.cpp:384:12: error: chosen constructor is
      explicit in copy-initialization
          return {SGV, std::move(Map)};
      
      Reviewed By: rupprecht
      
      Differential Revision: https://reviews.llvm.org/D130623
      b435da02
    • Peixin Qiao's avatar
      [NFC][flang] Remove the unused header in Bridge.cpp · 7ac2500e
      Peixin Qiao authored
      The header file OpenMPDialect.h is added in Bridge.cpp in D130027,
      but it is unused. Remove it.
      
      Differential Revision: https://reviews.llvm.org/D130625
      7ac2500e
    • Joseph Huber's avatar
      Revert "[OpenMP] Remove noinline attributes in the device runtime" · b08369f7
      Joseph Huber authored
      The behaviour of this patch is not great, but it has some side-effects
      that are required for OpenMPOpt to work. The problem is that when we use
      `-mlink-builtin-bitcode` we only import used symbols from the runtime.
      Then OpenMPOpt will insert calls to symbols that were not previously
      included. This patch removed this implicit behaviour as these functions
      were kept alive by the `noinline` simply because it kept calls to them
      in the module. This caused regression in some tests that relied on some
      OpenMPOpt passes without using LTO. Reverting for the LLVM15 release but
      will try to fix it more correctly on main.
      
      This reverts commit d61d72da.
      
      Fixes #56752
      b08369f7
    • Florian Hahn's avatar
      [LV] Add missing uses to test to make them more robust. · a8fdc247
      Florian Hahn authored
      The changes ensure the VPPredInstPHIRecipes are actually used and cannot
      be remove by VP-DCE.
      a8fdc247
    • Quinn Pham's avatar
      [libLTO] Set data-sections by default in libLTO. · b6cc5ddc
      Quinn Pham authored
      This patch changes legacy LTO to set data-sections by default. The user can
      explicitly unset data-sections. The reason for this patch is to match the
      behaviour of lld and gold plugin. Both lld and gold plugin have data-sections on
      by default.
      
      This patch also fixes the forwarding of the clang options -fno-data-sections and
      -fno-function-sections to libLTO. Now, when -fno-data/function-sections are
      specified in clang, -data/function-sections=0 will be passed to libLTO to
      explicitly unset data/function-sections.
      
      Reviewed By: w2yehia, MaskRay
      
      Differential Revision: https://reviews.llvm.org/D129401
      b6cc5ddc
    • Benjamin Kramer's avatar
      [bazel] Port 5caa941f · 1f5144cd
      Benjamin Kramer authored
      1f5144cd
    • Quinn Pham's avatar
      Revert "[libLTO] Set data-sections by default in libLTO." · 70ec8cd0
      Quinn Pham authored
      This reverts commit f565444b.
      70ec8cd0
    • Nicolai Hähnle's avatar
      Revert "ManagedStatic: remove from ASTMatchersInternal.h" · cd62604d
      Nicolai Hähnle authored
      This reverts commit 7132bcdc.
      
      It is the likely cause of a clang-tools-extra test regression. Reverting
      until I can investigate what's going on.
      cd62604d
    • NAKAMURA Takumi's avatar
    • Quinn Pham's avatar
      [libLTO] Set data-sections by default in libLTO. · f565444b
      Quinn Pham authored
      This patch changes legacy LTO to set data-sections by default. The user can
      explicitly unset data-sections. The reason for this patch is to match the
      behaviour of lld and gold plugin. Both lld and gold plugin have data-sections on
      by default.
      
      This patch also fixes the forwarding of the clang options -fno-data-sections and
      -fno-function-sections to libLTO. Now, when -fno-data/function-sections are
      specified in clang, -data/function-sections=0 will be passed to libLTO to
      explicitly unset data/function-sections.
      
      Reviewed By: w2yehia, MaskRay
      
      Differential Revision: https://reviews.llvm.org/D129401
      f565444b
    • lewuathe's avatar
      [mlir][complex] Custom attribute comlex.number. · 5caa941f
      lewuathe authored
      Add custom attribute for complex dialect. Although this commit does not have significant impact on the conversion framework, it will lead us to construct complex numbers in a readable and tidy manner.
      
      Related discussion: https://reviews.llvm.org/D127476
      
      Reviewed By: pifon2a, akuegel
      
      Differential Revision: https://reviews.llvm.org/D130149
      5caa941f
    • Simon Pilgrim's avatar
      [DAG] SimplifyDemandedBits - ensure we clear known One bits that AssertZext... · c0b3f7a5
      Simon Pilgrim authored
      [DAG] SimplifyDemandedBits - ensure we clear known One bits that AssertZext asserts are really known Zero
      
      Matches ComputeKnownBits behaviour
      
      Thanks to @uabelho for the fuzz regression report on D129765
      c0b3f7a5
    • Nicolai Hähnle's avatar
      7132bcdc
    • Nicolai Hähnle's avatar
      clang: include ManagedStatic.h for llvm_shutdown · 5a78ac21
      Nicolai Hähnle authored
      The code relied on ManagedStatic.h being included indirectly. This is
      about to change as uses of ManagedStatic are removed throughout the
      codebase.
      
      Differential Revision: https://reviews.llvm.org/D130575
      5a78ac21
    • Nicolai Hähnle's avatar
      ClangLinkerWrapper: explicitly #include <atomic> · 3e874bcf
      Nicolai Hähnle authored
      This code relied on implicitly having std::atomic available via the
      ManagedStatic.h header.
      
      Differential Revision: https://reviews.llvm.org/D130574
      3e874bcf
    • Markus Böck's avatar
      [mlir][LLVM] Fix incorrect GEP fold with struct constants · 7a67e41b
      Markus Böck authored
      The fold in it's current state only checks whether the amount of dynamic indices is 1. This does however not check for the presence of any struct indices, leading to an incorrect fold.
      
      This patch fixes that issue by checking that struct indices are 1, which in addition to the pre-existing check that dynamic indices are 1, guarantees that the single index is a dynamic one.
      
      Differential Revision: https://reviews.llvm.org/D129374
      7a67e41b
    • Pavel Labath's avatar
      [lldb] Always use APFloat for FP dumping · 1400a3cb
      Pavel Labath authored
      The DumpDataExtractor function had two branches for printing floating
      point values. One branch (APFloat) was used if we had a Target object
      around and could query it for the appropriate semantics. If we didn't
      have a Target, we used host operations to read and format the value.
      
      This patch changes second path to use APFloat as well. To make it work,
      I pick reasonable defaults for different byte size. Notably, I did not
      include x87 long double in that list (as it is ambibuous and
      architecture-specific). This exposed a bug where we were printing
      register values using the target-less branch, even though the registers
      definitely belong to a target, and we had it available. Fixing this
      prompted the update of several tests for register values due to slightly
      different floating point outputs.
      
      The most dubious aspect of this patch is the change in
      TypeSystemClang::GetFloatTypeSemantics to recognize `10` as a valid size
      for x87 long double. This was necessary because because sizeof(long
      double) on x86_64 is 16 even though it only holds 10 bytes of useful
      data. This generalizes the hackaround present in the target-free branch
      of the dumping function.
      
      Differential Revision: https://reviews.llvm.org/D129750
      1400a3cb
    • Jakob Johnson's avatar
      [trace] Add instruction control flow kind to JSON trace dumper's output · dde3cf2e
      Jakob Johnson authored
      D128477 adds a '-k' flag which displays each instruction's control flow in the `thread trace dump instructions` command's non-json  output (ie no '-j' or '-J' flag)
      This diff adds the instruction control flow kind to the `thread trace dump instructions` command's JSON output (ie '-j' or '-J' flag)
      
      Test Plan:
      Confirm "controlFlowKind" is present in JSON when '-k' is provided
      ```
      (lldb) thread trace dump instructions -J -k
      [
        {                                                                                                                                                                                                                                                                                 [141/1952]
          "id": 7755,
          "loadAddress": "0x400868",
          "module": "test.out",
          "symbol": "main",
          "mnemonic": "jmp",
          "controlFlowKind": "jump",
          "source": "/home/jakobjohnson/jakob-dev/test.cpp",
          "line": 41,
          "column": 29
        },
        {
          "id": 7753,
          "loadAddress": "0x7ffff7b54dab",
          "module": "libstdc++.so.6",
          "symbol": "std::ostream::flush()",
          "mnemonic": "retq",
          "controlFlowKind": "return"
        },
        {
          "id": 7752,
          "loadAddress": "0x7ffff7b54daa",
          "module": "libstdc++.so.6",
          "symbol": "std::ostream::flush()",
          "mnemonic": "popq",
          "controlFlowKind": "other"
        },
        ...
      ]
      ```
      Confirm "controlFlowKind" is not present when '-k' isn't provided
      ```
      (lldb) thread trace dump instructions -J
      [
        {
          "id": 7755,
          "loadAddress": "0x400868",
          "module": "test.out",
          "symbol": "main",
          "mnemonic": "jmp",
          "source": "/home/jakobjohnson/jakob-dev/test.cpp",
          "line": 41,
          "column": 29
        },
        {
          "id": 7753,
          "loadAddress": "0x7ffff7b54dab",
          "module": "libstdc++.so.6",
          "symbol": "std::ostream::flush()",
          "mnemonic": "retq"
        },
        {
          "id": 7752,
          "loadAddress": "0x7ffff7b54daa",
          "module": "libstdc++.so.6",
          "symbol": "std::ostream::flush()",
          "mnemonic": "popq"
        },
      ```
      
      Differential Revision: https://reviews.llvm.org/D130607
      dde3cf2e
    • Nico Weber's avatar
      [gn build] (semi-manually) port 6bdb15fe · 1870a8af
      Nico Weber authored
      1870a8af
    • Aaron Kogon's avatar
      Sinking or hoisting instructions between loops before fusion · dd3ca65c
      Aaron Kogon authored
      Instructions between two adjacent loops will be hoisted above the first
      loop, or sunk below the second to facilitate loop fusion. Hoisting will
      be attempted for an instruction that dominates the first loop.
      Otherwise, sinking this instructions will be attempted.
      
      Instructions with side effects will not be considered for sinking or
      hoisting. Hoisting/sinking of any instructions between loops will only
      be performed if all the instructions can be moved. As well,
      sinking/hoisting is considered for each instruction in isolation,
      without taking into account sinking/hoisting decisions for other
      instructions in the preheader.
      
      Differential Revision: https://reviews.llvm.org/D118076
      dd3ca65c
    • Daniel Grumberg's avatar
      [clang][ExtractAPI] Fix objc_property.m reference output · cef232ff
      Daniel Grumberg authored
      After landing 7f0387de I forgot to update this
      new test.
      cef232ff
    • Rainer Orth's avatar
      [CMake] Enable -z defs on Solaris · 415b1e87
      Rainer Orth authored
      I wondered why I hadn't seen the link failures in D130571
      <https://reviews.llvm.org/D130571> on Solaris/sparcv9 and found that
      Solaris, unlike Linux, doesn't use `-Wl,-z,defs` when linking shared
      objects.  The three affected shared objects indeed have undefined
      references to several 64-bit atomics.
      
      This patch will expose such issues in the future by defaulting to
      `-Wl,-z,defs` on Solaris, as recommended in `ld(1)`.
      
      Tested on `sparcv9-sun-solaris2.11` and `amd64-pc-solaris2.11`.
      
      Differential Revision: https://reviews.llvm.org/D130572
      415b1e87
    • Ilya Biryukov's avatar
      [Sema] Return primary merged decl as canonical for concepts · 42f87bb6
      Ilya Biryukov authored
      Otherwise we get invalid results for ODR checks. See changed test for an
      example: despite the fact that we merge the first concept, its **uses**
      were considered different by `Profile`, leading to redefinition errors.
      
      After this change, canonical decl for a concept can come from a
      different module and may not be visible. This behavior looks suspicious,
      but does not break any tests. We might want to add a mechanism to make
      the canonical concept declaration visible if we find code that relies on
      this invariant.
      
      Additionally make sure we always merge with the canonical declaration to
      avoid chains of merged concepts being reported as redefinitions. An
      example was added to the test.
      
      Also change the order of includes in the test. Importing a moduralized
      header before its textual part causes the include guard macro to be
      exported and the corresponding `#include` becomes a no-op.
      
      Reviewed By: ChuanqiXu
      
      Differential Revision: https://reviews.llvm.org/D130585
      42f87bb6
    • David Spickett's avatar
      [flang] Disable pipefail for tests for stdin input · 52a3855f
      David Spickett authored
      We have seen the llvm test fail every so often on our bots:
      https://lab.llvm.org/buildbot/#/builders/173/builds/6711
      
      This happens because `flang-new -fc1 -S` does not wait for the
      pipe to finish being written to/does not read out all the content.
      You can see this in the output, cat comes after flang:
      + /home/tcwg-buildbot/worker/flang-aarch64-release/build/bin/not /home/tcwg-buildbot/worker/flang-aarch64-release/build/bin/flang-new -fc1 -S - -o -
      + cat /home/tcwg-buildbot/worker/flang-aarch64-release/llvm-project/flang/test/Driver/input-from-stdin-llvm.ll
      error: Invalid input type - expecting a Fortran file
      
      This means that cat gets SIGPIPE which causes it to exit with
      code 141 and that's the final result due to pipefail.
      
      flang isn't wrong to exit early (I think some modes of grep also do this)
      and we only care about flang's exit code. So disable pipefail for
      the stdin testing.
      
      Reviewed By: awarzynski
      
      Differential Revision: https://reviews.llvm.org/D130619
      52a3855f
    • Rainer Orth's avatar
      [compiler-rt][Sanitizer] Link sanitizer libs with -latomic on SPARC · 0b2d5fd4
      Rainer Orth authored
      When building on Linux/sparc64, the 32-bit `libclang_rt.asan.so`,
      `libclang_rt.ubsan_minimal.so`, and `libclang_rt.ubsan_standalone.so`
      failed to link with undefined references to 64-bit atomics, which `clang`
      cannot inline.  Even D130569 <https://reviews.llvm.org/D130569> didn't help
      because those libraries are linked with `-nodefaultlibs`, so dependent
      libraries need to be added explicitly.
      
      That's what this patch does.
      
      Tested on `sparc64-unknown-linux-gnu` and `sparcv9-sun-solaris2.11`.
      
      Differential Revision: https://reviews.llvm.org/D130571
      0b2d5fd4
    • Diana Picus's avatar
      [flang] Single entry point for GET_COMMAND_ARGUMENT · eb7a02ea
      Diana Picus authored
      This patch refactors the runtime support for GET_COMMAND_ARGUMENT to
      have a single entry point instead of 2. It also updates lowering
      accordingly.
      
      This makes it easier to handle dynamically optional arguments. See also
      https://reviews.llvm.org/D118777
      
      Differential Revision: https://reviews.llvm.org/D130475
      eb7a02ea
    • LiaoChunyu's avatar
      [RISCV]Enable isIntDivCheap when attribute is minsize · bf4f9a46
      LiaoChunyu authored
      Don't expand divisions by constants when attribute is minsize.
      
      Reviewed By: craig.topper
      
      Differential Revision: https://reviews.llvm.org/D130543
      bf4f9a46
    • Rainer Orth's avatar
      [Support] Handle SPARC in sys::getHostCPUName · 979ddfff
      Rainer Orth authored
      While working on D118450 <https://reviews.llvm.org/D118450>, I noticed that
      `sys::getHostCPUName` lacks SPARC support.
      
      This patch implements it.  The code is taken from/inspired by GCC's
      `gcc/config/sparc/driver-sparc.cc`.  There's one caveat: since LLVM, unlike
      GCC, doesn't support the SPARC-M7, -S7, and -M8 CPUs, I map all those to
      the latest supported one (UltraSparc T4/`niagara4`).
      
      Tested on `sparcv9-sun-solaris2.11` and `sparc64-unknown-linux-gnu` by
      running `savcov --version` on
      
      - Netra SPARC S7-2 (SPARC-S7, Solaris 11.4)
      - SPARC T5-2 (SPARC T5, Solaris 11.4)
      - SPARC Enterprise T5220 (UltraSPARC T2, Solaris 11.3)
      - SPARC T5 (UltraSPARC T5, Debian sid)
      - SPARC T3 (UltraSPARC T3, Debian sid)
      - SPARC Enterprise T5220 (Debian sid)
      
      Differential Revision: https://reviews.llvm.org/D130272
      979ddfff
    • Daniel Grumberg's avatar
      [clang][ExtractAPI] Ensure that class properties have a kind of "Type Property" · d3fc779e
      Daniel Grumberg authored
      Generated symbol graphs should distinguish between type properties and instance
      properties.
      
      Differential Revision: https://reviews.llvm.org/D130581
      d3fc779e
    • Daniel Grumberg's avatar
    • Simon Pilgrim's avatar
      [DAG] SimplifyDemandedBits - don't early-out for multiple use values · 529bd4f3
      Simon Pilgrim authored
      SimplifyDemandedBits currently early-outs for multi-use values beyond the root node (just returning the knownbits), which is missing a number of optimizations as there are plenty of cases where we can still simplify when initially demanding all elements/bits.
      
      @lenary has confirmed that the test cases in aea-erratum-fix.ll need refactoring and the current increase codegen is not a major concern.
      
      Differential Revision: https://reviews.llvm.org/D129765
      529bd4f3
    • Alex Zinenko's avatar
      [mlir] update Bazel for e99fae89 · ea460b7d
      Alex Zinenko authored
      ea460b7d