1. Jul 27, 2022
    • 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
    • Nathan James's avatar
    • Zi Xuan Wu (Zeson)'s avatar
      [CSKY] Fix the btsti16 instruction missing in generic processor · 70b8b738
      Zi Xuan Wu (Zeson) authored
      Normally, generic processor does not have any SubtargetFeature. And it
      can just generate most basic instructions which have no Predicates to
      guard.
      
      But it needs to enbale predicate for the btsti16 instruction as one of the most basic instructions.
      Or the generic processor can't finish codegen process. So Add FeatureBTST16 SubtargetFeature to generic ProcessorModel.
      70b8b738
    • Nikita Popov's avatar
      [ARM] Test more atomic sizes with +atomics-32 feature (NFC) · dc84eeb6
      Nikita Popov authored
      Check that 8-bit and 16-bit atomics also work as expected. Also
      fix the alignment on the 64-bit tests -- testing unaligned atomics
      wasn't intended here.
      dc84eeb6
    • Renato Golin's avatar
      Update ProgrammersManual STL docs · 94761b9d
      Renato Golin authored
      The SGI page doesn't exist anymore and isn't really relevant at this day
      and age.
      
      While at it, added the "other" main C++ website and moved all URLs to
      HTTPS.
      94761b9d
    • Matheus Izvekov's avatar
      [clang] Implement ElaboratedType sugaring for types written bare · 15f3cd6b
      Matheus Izvekov authored
      
      
      Without this patch, clang will not wrap in an ElaboratedType node types written
      without a keyword and nested name qualifier, which goes against the intent that
      we should produce an AST which retains enough details to recover how things are
      written.
      
      The lack of this sugar is incompatible with the intent of the type printer
      default policy, which is to print types as written, but to fall back and print
      them fully qualified when they are desugared.
      
      An ElaboratedTypeLoc without keyword / NNS uses no storage by itself, but still
      requires pointer alignment due to pre-existing bug in the TypeLoc buffer
      handling.
      
      ---
      
      Troubleshooting list to deal with any breakage seen with this patch:
      
      1) The most likely effect one would see by this patch is a change in how
         a type is printed. The type printer will, by design and default,
         print types as written. There are customization options there, but
         not that many, and they mainly apply to how to print a type that we
         somehow failed to track how it was written. This patch fixes a
         problem where we failed to distinguish between a type
         that was written without any elaborated-type qualifiers,
         such as a 'struct'/'class' tags and name spacifiers such as 'std::',
         and one that has been stripped of any 'metadata' that identifies such,
         the so called canonical types.
         Example:
         ```
         namespace foo {
           struct A {};
           A a;
         };
         ```
         If one were to print the type of `foo::a`, prior to this patch, this
         would result in `foo::A`. This is how the type printer would have,
         by default, printed the canonical type of A as well.
         As soon as you add any name qualifiers to A, the type printer would
         suddenly start accurately printing the type as written. This patch
         will make it print it accurately even when written without
         qualifiers, so we will just print `A` for the initial example, as
         the user did not really write that `foo::` namespace qualifier.
      
      2) This patch could expose a bug in some AST matcher. Matching types
         is harder to get right when there is sugar involved. For example,
         if you want to match a type against being a pointer to some type A,
         then you have to account for getting a type that is sugar for a
         pointer to A, or being a pointer to sugar to A, or both! Usually
         you would get the second part wrong, and this would work for a
         very simple test where you don't use any name qualifiers, but
         you would discover is broken when you do. The usual fix is to
         either use the matcher which strips sugar, which is annoying
         to use as for example if you match an N level pointer, you have
         to put N+1 such matchers in there, beginning to end and between
         all those levels. But in a lot of cases, if the property you want
         to match is present in the canonical type, it's easier and faster
         to just match on that... This goes with what is said in 1), if
         you want to match against the name of a type, and you want
         the name string to be something stable, perhaps matching on
         the name of the canonical type is the better choice.
      
      3) This patch could expose a bug in how you get the source range of some
         TypeLoc. For some reason, a lot of code is using getLocalSourceRange(),
         which only looks at the given TypeLoc node. This patch introduces a new,
         and more common TypeLoc node which contains no source locations on itself.
         This is not an inovation here, and some other, more rare TypeLoc nodes could
         also have this property, but if you use getLocalSourceRange on them, it's not
         going to return any valid locations, because it doesn't have any. The right fix
         here is to always use getSourceRange() or getBeginLoc/getEndLoc which will dive
         into the inner TypeLoc to get the source range if it doesn't find it on the
         top level one. You can use getLocalSourceRange if you are really into
         micro-optimizations and you have some outside knowledge that the TypeLocs you are
         dealing with will always include some source location.
      
      4) Exposed a bug somewhere in the use of the normal clang type class API, where you
         have some type, you want to see if that type is some particular kind, you try a
         `dyn_cast` such as `dyn_cast<TypedefType>` and that fails because now you have an
         ElaboratedType which has a TypeDefType inside of it, which is what you wanted to match.
         Again, like 2), this would usually have been tested poorly with some simple tests with
         no qualifications, and would have been broken had there been any other kind of type sugar,
         be it an ElaboratedType or a TemplateSpecializationType or a SubstTemplateParmType.
         The usual fix here is to use `getAs` instead of `dyn_cast`, which will look deeper
         into the type. Or use `getAsAdjusted` when dealing with TypeLocs.
         For some reason the API is inconsistent there and on TypeLocs getAs behaves like a dyn_cast.
      
      5) It could be a bug in this patch perhaps.
      
      Let me know if you need any help!
      
      Signed-off-by: default avatarMatheus Izvekov <mizvekov@gmail.com>
      
      Differential Revision: https://reviews.llvm.org/D112374
      15f3cd6b
    • Sam McCall's avatar
      [pseudo] Fix initializer of string table · 7b70c2e7
      Sam McCall authored
      Apparently new string[/*no size*/]{"foo", "bar"} is a clang/gcc extension?
      7b70c2e7
    • Daniil Dudkin's avatar
      [flang][NFC] Unify check prefixes in `abstract-results.fir` test · fefa36a8
      Daniil Dudkin authored
      Now the prefixes have the same length
      and they'll be easier to distinguish when
      `GlobalOp` tests will be added
      
      Depends on D129778
      
      Reviewed By: clementval
      
      Differential Revision: https://reviews.llvm.org/D130087
      fefa36a8
    • Daniil Dudkin's avatar
      [flang] Generalize `AbstractResultOpt` pass · cb33e4ab
      Daniil Dudkin authored
      This change decouples common functionality for convering abstract
      results, so it can be reused later.
      
      Depends on D129485
      
      Reviewed By: clementval, jeanPerier
      
      Differential Revision: https://reviews.llvm.org/D129778
      cb33e4ab
    • Alex Zinenko's avatar
      [mlir] more aggressive folding in tiling/fusion transformations · e99fae89
      Alex Zinenko authored
      Combine the recently added utilities for folded-by-construction affine
      operations with the attribute-based Range to enable more folding. This
      decreases the amount of emitted code but has little effect on test
      precisely because the tests are not checking for the spurious constants.
      The difference in the shape of affine maps comes from the internals of
      affine folding.
      
      Depends on D129633
      
      Reviewed By: nicolasvasilache
      
      Differential Revision: https://reviews.llvm.org/D130167
      e99fae89
    • Alex Zinenko's avatar
      [mlir] Make ViewLikeInterface Range work with attributes · 70e99f38
      Alex Zinenko authored
      While most of methods in ViewLikeInterface accept an `OpFoldResult` for
      the offset/size/stride that may be static, represented as `Attribute`,
      or dynamic, represented as `Value`, the `Range` abstraction only
      accepted `Values`. This can often lead to known-constant
      offset/size/strides being materialized into constant operations and
      hinder further constant propagation without explicitly running the
      constant folding pass. This often leads to a more complicated than
      necessary addressing code being emitted. Switch `Range` to use
      `OpFoldResult`. Code that uses `Range` currently keeps materializing the
      constants to minimize the effect of this change on the IR. Further
      commits will make use of this.
      
      Reviewed By: nicolasvasilache, mravishankar
      
      Differential Revision: https://reviews.llvm.org/D129633
      70e99f38
    • Alex Zinenko's avatar
      [mlir] Partially port splitting transform to TilingInterface · 08a1b07e
      Alex Zinenko authored
      The structured op splitting transformation is conceptually similar to
      tiling in the sense that it decomposes the iteration space of the
      original op into several parts. Therefore, it is possible to implement
      it using the TilingInterface to operate on iteration spaces and their
      parts. However, the implementation also requires to pass updated input
      operands, which is not supported by the interface, so the implementation
      currently remains Linalg-specific.
      
      Reviewed By: mravishankar
      
      Differential Revision: https://reviews.llvm.org/D129564
      08a1b07e
    • Alexey Lapshin's avatar
      79ff02a1
    • Ying Yi's avatar
      Emit a simple StackSizesSection on PS4. · 8d46cb34
      Ying Yi authored
      Differential Revision: https://reviews.llvm.org/D130495
      8d46cb34
    • Ying Yi's avatar
      Disable stack-sizes section by default for PS4. · bfe191df
      Ying Yi authored
      Differential Revision: https://reviews.llvm.org/D130493
      bfe191df
    • David Green's avatar
      [ARM] Correct features on pacbti instructions. · 39f83849
      David Green authored
      Given a patch like D129506, using instructions not valid for the current
      feature set becomes an error. This updates the Arm hint-space
      instructions for pac/bti to require thumbv7m as opposed to 8.1-m.main, to
      make them valid when compiling for thumbv7m with -mbranch-protection.
      
      Differential Revision: https://reviews.llvm.org/D129692
      39f83849
    • Adrian Kuegel's avatar
      a0154218
    • Nikita Popov's avatar
      [ARM] Add target feature to force 32-bit atomics · b1b10869
      Nikita Popov authored
      This adds a +atomic-32 target feature, which instructs LLVM to assume
      that lock-free 32-bit atomics are available for this target, even
      if they usually wouldn't be.
      
      If only atomic loads/stores are used, then this won't emit libcalls.
      If atomic CAS is used, then the user is responsible for providing
      any necessary __sync implementations (e.g. by masking interrupts
      for single-core privileged use cases).
      
      See https://reviews.llvm.org/D120026#3674333 for context on this
      change. The tl;dr is that the thumbv6m target in Rust has
      historically made atomic load/store only available, which is
      incompatible with the change from D120026, which switched these to
      use libatomic.
      
      Differential Revision: https://reviews.llvm.org/D130480
      b1b10869
    • Amara Emerson's avatar
      [AArch64][GlobalISel] Lower vector G_CTTZ. · 9cc1dd20
      Amara Emerson authored
      Fixes issue 56398
      9cc1dd20
    • Sam McCall's avatar
    • Sam McCall's avatar
      [pseudo] Remove dead header · 89f284bc
      Sam McCall authored
      This was an earlier draft of Language.h that got committed accidentally
      89f284bc
    • Sam McCall's avatar
      [pseudo] Reorganize CXX.h enums · 6bdb15fe
      Sam McCall authored
      - Place rules under rule::lhs::rhs__rhs__rhs
      - Change mangling of keywords to ALL_CAPS (needed to turn keywords that appear
        alone on RHS into valid identifiers)
      - Make enums implicitly convertible to underlying type (though still scoped,
        using alias tricks)
      
      In principle this lets us exhaustively write a switch over all rules of a NT:
        switch ((rule::declarator)N->rule()) {
          case rule::declarator::noptr_declarator:
            ...
        }
      In practice we don't do this anywhere yet as we're often switching over multiple
      nonterminal kinds at once.
      
      Differential Revision: https://reviews.llvm.org/D130414
      6bdb15fe
    • Amara Emerson's avatar
      aeeb174c
    • Chuanqi Xu's avatar
    • Danny Mösch's avatar
      [clang] Make parts of index test optional · e818ce0e
      Danny Mösch authored
      Reason is that the test behaves differently in clang-ppc64-aix in that the optional part appears in the output.
      e818ce0e