1. Apr 29, 2022
    • Roman Lebedev's avatar
      [NFC][SCEV] Refactor `createNodeForSelectViaUMinSeq()` out of... · 981ed72a
      Roman Lebedev authored
      [NFC][SCEV] Refactor `createNodeForSelectViaUMinSeq()` out of `createNodeForSelectOrPHIViaUMinSeq()`
      981ed72a
    • Roman Lebedev's avatar
      fd20eb55
    • Zequan Wu's avatar
      Revert "[DebugInfo][InstrRef] Describe value sizes when spilt to stack" · 4fe2ab52
      Zequan Wu authored
      This reverts commit a15b66e7.
      
      This causes linker to crash at assertion: `Assertion failed: !Expr->isComplex(), file C:\b\s\w\ir\cache\builder\src\third_party\llvm\llvm\lib\CodeGen\LiveDebugValues\InstrRefBasedImpl.cpp, line 907`.
      4fe2ab52
    • wlei's avatar
      [llvm-profgen] Decouple artificial branch from LBR parser and fix external address related issues · bfcb2c11
      wlei authored
      This patch is fixing two issues for both CS and non-CS.
      1) For external-call-internal, the head samples of the the internal function should be recorded.
      2) avoid ignoring LBR after meeting the interrupt branch for CS profile
      
      LBR parser is shared between CS and non-CS, we found it's error-prone while dealing with artificial branch inside LBR parser. Since artificial branch is mainly used for CS profile unwinding, this patch tries to simplify LBR parser by decoupling artificial branch code from it, the concept of artificial branch is removed and split into two transitional branches(internal-to-external, external-to-internal). Then we leave all the processing of external branch to unwinder.
      
      Specifically for unwinder, remembering that we introduce external frame in https://reviews.llvm.org/D115550. We can just take external address as a regular address and reuse current unwind function(unwindCall, unwindReturn). For a normal case, the external frame will match an external LBR, and it will be filtered out by `unwindLinear` without losing any context.
      
      The data also shows that the interrupt or standalone LBR pattern(unpaired case) does exist, we choose to handle it by clearing the call stack and keeping unwinding. Here we leverage checking in `unwindLinear`, because a standalone LBR, no matter its type, since it doesn’t have other part to pair, it will eventually cause a wrong linear range, like [external, internal], [internal, external]. Then set the state to invalid there.
      
      Reviewed By: hoy, wenlei
      
      Differential Revision: https://reviews.llvm.org/D118177
      bfcb2c11
    • Jonas Devlieghere's avatar
      [lldb] Remove ConnectionFileDescriptorTest.Connectv(4|6) · 02c2b472
      Jonas Devlieghere authored
      These tests are timing out on the bots.
      02c2b472
    • Argyrios Kyrtzidis's avatar
      [Tooling/DependencyScanning] Make skipping excluded PP ranges during... · 42823beb
      Argyrios Kyrtzidis authored
      [Tooling/DependencyScanning] Make skipping excluded PP ranges during dependency scanning the default
      
      This is to improve maintenance a bit and remove need to maintain the additional option and related code-paths.
      
      Differential Revision: https://reviews.llvm.org/D124558
      42823beb
    • Mircea Trofin's avatar
      [NFC] remove const from FunctionPropertiesAnalysis::run, keep on Result · 49942d59
      Mircea Trofin authored
      The goal in 75881d8b was just modifying what `Result` is, didn't
      need to also modify ::run.
      49942d59
    • Jonas Devlieghere's avatar
      [lldb] Fix crash when launching in terminal · 9aa6a479
      Jonas Devlieghere authored
      This patch fixes a crash when using process launch -t to launch the
      inferior from a TTY. The issue is that on Darwin, Host.mm is calling
      ConnectionFileDescriptor::Connect without a socket_id_callback_type. The
      overload passes nullptr as the function ref, which gets called
      unconditionally as the socket_id_callback.
      
      One potential way to fix this is to change all the lambdas to include a
      null check, but instead I went with an empty lambda.
      
      Differential revision: https://reviews.llvm.org/D124535
      9aa6a479
    • CHIANG, YU-HSUN (Tommy Chiang, oToToT)'s avatar
      [MC][AArch64] Enable '+v8a' when nothing specified for MCSubtargetInfo · 4a31af88
      Since D110065, the 'R' profile support is added to LLVM. It turns the
      `generic` cpu into the intersection of v8-a and v8-r. However, this
      makes some backward compatibility problems. The original patch makes
      the clang driver implicitly pass -march=armv8-a when only the triple
      is specified. Since it only applies to clang, other tools like
      llvm-objdump still faces the backward compatibility problem.
      
      This patch applies the same idea to MC related tools by enabling '+v8a'
      feature when nothing is specified (both CPU and FS are empty) for
      MCSubtargetInfo creation.
      
      This patch should fix PR53956.
      
      Reviewed by: labrinea
      
      Differential Revision: https://reviews.llvm.org/D124319
      4a31af88
    • Alexey Moksyakov's avatar
      [BOLT] Fix r_aarch64_prelxx test · 61d54259
      Alexey Moksyakov authored
      The relocation value is calculated using the formula S + A - P,
      the verification of the value is performed by inversely calculating the location address
      
      Reviewed By: Amir
      
      Differential Revision: https://reviews.llvm.org/D124270
      61d54259
    • Benjamin Kramer's avatar
      [bazel] Port 92a836da · b8d4fe0f
      Benjamin Kramer authored
      b8d4fe0f
    • Yuanfang Chen's avatar
      [lit][unit] set the default result start and pid · 0e554ebf
      Yuanfang Chen authored
      In case of interrupting, there were None. Fixes PR55176.
      0e554ebf
    • David Penry's avatar
      Revert "[CodeGen][ARM] Enable Swing Module Scheduling for ARM" · fa49021c
      David Penry authored
      This reverts commit 28d09bbb
      while I investigate a buildbot failure.
      fa49021c
    • Simon Pilgrim's avatar
      [X86] Don't fold AND(SRL(X,Y),1) -> SETCC(BT(X,Y)) on BMI2 targets · ab17ed07
      Simon Pilgrim authored
      With BMI2 we have SHRX which is a lot quicker than regular x86 shifts.
      
      Fixes #55138
      ab17ed07
    • Craig Topper's avatar
      [RISCV] Add riscv32 RUN lines to bittest.ll. NFC · 181dcbd3
      Craig Topper authored
      Add extra check-prefixes to merge common results.
      181dcbd3
    • David Penry's avatar
      [CodeGen][ARM] Enable Swing Module Scheduling for ARM · 28d09bbb
      David Penry authored
      This patch permits Swing Modulo Scheduling for ARM targets
      turns it on by default for the Cortex-M7.  The t2Bcc
      instruction is recognized as a loop-ending branch.
      
      MachinePipeliner is extended by adding support for
      "unpipelineable" instructions.  These instructions are
      those which contribute to the loop exit test; in the SMS
      papers they are removed before creating the dependence graph
      and then inserted into the final schedule of the kernel and
      prologues. Support for these instructions was not previously
      necessary because current targets supporting SMS have only
      supported it for hardware loop branches, which have no
      loop-exit-contributing instructions in the loop body.
      
      The current structure of the MachinePipeliner makes it difficult
      to remove/exclude these instructions from the dependence graph.
      Therefore, this patch leaves them in the graph, but adds a
      "normalization" method which moves them in the schedule to
      stage 0, which causes them to appear properly in kernel and
      prologues.
      
      It was also necessary to be more careful about boundary nodes
      when iterating across successors in the dependence graph because
      the loop exit branch is now a non-artificial successor to
      instructions in the graph. In additional, schedules with physical
      use/def pairs in the same cycle should be treated as creating an
      invalid schedule because the scheduling logic doesn't respect
      physical register dependence once scheduled to the same cycle.
      
      Reviewed By: dmgreen
      
      Differential Revision: https://reviews.llvm.org/D122672
      28d09bbb
    • River Riddle's avatar
      [mlir:PDLL] Fix the import of native constraints from ODS · 651d9f70
      River Riddle authored
      We weren't properly returning the result of the constraint,
      which leads to errors when actually trying to use the generated
      C++.
      
      Differential Revision: https://reviews.llvm.org/D124586
      651d9f70
    • River Riddle's avatar
      [mlir:PDLL] Fix error handling of eof within a string literal · ebb1e900
      River Riddle authored
      We currently aren't handling this properly, and in the case
      of a string block just crash. This commit adds proper error handling
      and detection for eof.
      
      Differential Revision: https://reviews.llvm.org/D124585
      ebb1e900
    • River Riddle's avatar
      [mlir:LSP] Improve conversion between SourceMgr and LSP locations · 32bf1f1d
      River Riddle authored
      SourceMgr generally uses 1-based locations, whereas the LSP is zero based.
      This commit corrects this conversion and also enhances the conversion from SMLoc
      to SMRange to support string tokens.
      
      Differential Revision: https://reviews.llvm.org/D124584
      32bf1f1d
    • River Riddle's avatar
      [mlir:PDL] Rework errors for pdl.operations with non-inferrable results · 9613a850
      River Riddle authored
      We currently emit an error during verification if a pdl.operation with non-inferrable
      results is used within a rewrite. This allows for catching some errors during compile
      time, but is slightly broken. For one, the verification at the PDL level assumes that
      all dialects have been loaded, which is true at run time, but may not be true when
      the PDL is generated (such as via PDLL). This commit fixes this by not emitting the
      error if the operation isn't registered, i.e. it uses the `mightHave` variant of trait/interface
      methods.
      
      Secondly, we currently don't verify when a pdl.operation has no explicit results, but the
      operation being created is known to expect at least one. This commit adds a heuristic
      error to detect these cases when possible and fail. We can't always capture when the user
      made an error, but we can capture the most common case where the user expected an
      operation to infer its result types (when it actually isn't possible).
      
      Differential Revision: https://reviews.llvm.org/D124583
      9613a850
    • River Riddle's avatar
      [mlir:PDL] Fix a syntax ambiguity in pdl.attribute · d4381b3f
      River Riddle authored
      pdl.attribute currently has a syntax ambiguity that leads to the incorrect parsing
      of pdl.attribute operations with locations that don't also have a constant value. For example:
      
      ```
      pdl.attribute loc("foo")
      ```
      
      The above IR is treated as being a pdl.attribute with a constant value containing the location,
      `loc("foo")`, which is incorrect. This commit changes the syntax to use `= <constant-value>` to
      clearly distinguish when the constant value is present, as opposed to just trying to parse an attribute.
      
      Differential Revision: https://reviews.llvm.org/D124582
      d4381b3f
    • River Riddle's avatar
      [mlir] Attach InferTypeOpInterface on SameOperandsAndResultType operations when possible · 92a836da
      River Riddle authored
      This allows for inferring the result types of operations in certain situations by using the type of
      an operand. This commit allowed for automatically supporting type inference for many more
      operations with no additional effort, e.g. nearly all Arithmetic operations now support
      result type inferrence with no additional changes.
      
      Differential Revision: https://reviews.llvm.org/D124581
      92a836da
    • River Riddle's avatar
      [mlir:ODS] Support using attributes in AllTypesMatch to automatically add InferTypeOpInterface · 1bd1edaf
      River Riddle authored
      This allows for using attribute types in result type inference for use with
      InferTypeOpInterface. This was a TODO before, but it isn't much
      additional work to properly support this. After this commit,
      arith::ConstantOp can now have its InferTypeOpInterface implementation automatically
      generated.
      
      Differential Revision: https://reviews.llvm.org/D124580
      1bd1edaf
    • Peter Klausler's avatar
      [flang][runtime] Support B/O/Z editing of CHARACTER · 53f775bb
      Peter Klausler authored
      This is a common extension, though semantics differ across
      compilers.  I've chosen to interpret the CHARACTER data
      as if it were an arbitrary-precision integer value and
      format or read it as such.  This matches Intel's compilers
      and nvfortran.  (GNU Fortran can't handle lengths > 1 and XLF
      seems to get the enddianness wrong.)
      
      This patch generalizes the previous implementations of
      B/O/Z input and output so that they'll work for arbitrary data
      in memory, and then uses them for all B/O/Z input/output,
      including (now) CHARACTER.
      
      Differential Revision: https://reviews.llvm.org/D124547
      53f775bb
    • Mircea Trofin's avatar
      [NFC] const-ed the return type of FunctionPropertiesAnalysis · 75881d8b
      Mircea Trofin authored
      The result is a data bag, this makes sure it's signaled to a user that
      the data can't be mutated when, for example, doing something like:
      
      auto &R = FAM.getResult<FunctionPropertiesAnalysis>(F)
      ...
      R.Uses++
      75881d8b
    • Simon Pilgrim's avatar
    • Florian Hahn's avatar
      Revert "[VPlan] Remove uneeded needsVectorIV check." · f4e1eaa3
      Florian Hahn authored
      This reverts commit 43842b88 while I
      investigate a buildbot failure.
      
      It also reverts the follow-up commit
      2883de05.
      f4e1eaa3
    • Chris Lattner's avatar
      [OpAsmParser] Simplify logic for requiredOperandCount in parseOperandList. · 99499c3e
      Chris Lattner authored
      I would ideally like to eliminate 'requiredOperandCount' as a bit of
      verification that should be in the client side, but it is much more
      widely used than I expected.  Just tidy some pieces up around it given
      we can't drop it immediately.
      
      NFC.
      
      Differential Revision: https://reviews.llvm.org/D124629
      99499c3e
    • Bill Wendling's avatar
      [randstruct] Randomize all elements of a record · 463790bf
      Bill Wendling authored
      A record may have more than just FieldDecls in it. If so, then we're
      likely to drop them if we only randomize the FieldDecls.
      
      We need to be careful about anonymous structs/unions. Their fields are
      made available in the RecordDecl as IndirectFieldDecls, which are listed
      after the anonymous struct/union. The ordering doesn't appear to be
      super important, however we place them unrandomized at the end of the
      RecordDecl just in case. There's also the possiblity of
      StaticAssertDecls. We also want those at the end.
      
      All other non-FieldDecls we place at the top, just in case we get
      something like:
      
          struct foo {
            enum e { BORK };
            enum e a;
          };
      
      Link: https://github.com/KSPP/linux/issues/185
      
      Reviewed By: aaron.ballman
      
      Differential Revision: https://reviews.llvm.org/D123958
      463790bf
    • Dominic Chen's avatar
      [libc] Support 32-bit ARM platform tests · ce6bfd10
      Dominic Chen authored
      Set LONG_DOUBLE_IS_DOUBLE, add ifdefs for 128-bit integer types
      
      Differential Revision: https://reviews.llvm.org/D124204
      ce6bfd10
    • David Tenty's avatar
      [LLVM] Add exported visibility style for XCOFF · 8042699a
      David Tenty authored
      For the AIX linker, under default options, global or weak symbols which
      have no visibility bits set to zero (i.e. no visibility, similar to ELF
      default) are only exported if specified on an export list provided to
      the linker. So AIX has an additional visibility style called
      "exported" which indicates to the linker that the symbol should
      be explicitly globally exported.
      
      This change maps "dllexport" in the LLVM IR to correspond to XCOFF
      exported as we feel this best models the intended semantic (discussion
      on the discourse RFC thread: https://discourse.llvm.org/t/rfc-adding-exported-visibility-style-to-the-ir-to-model-xcoff-exported-visibility/61853)
      and allows us to enable writing this visibility for the AIX target
      in the assembly path.
      
      Reviewed By: DiggerLin
      
      Differential Revision: https://reviews.llvm.org/D123951
      8042699a
    • David Green's avatar
      [VectorCombine] Try to reduce shuffle cost for commutative reduction operands · ded8187e
      David Green authored
      Given a shuffle feeding a commutative reduction, the lane ordering of
      the shuffle will not alter the result. This is also true if there are a
      number of operations between the reduction and the shuffle, providing
      they only operate lane-wise. This patch searches for cases like that in
      Vector Combine, allowing us to check the cost of the shuffle vs an
      in-order identity shuffle and replace the order if possible. This only
      handles a single shuffle at the moment to keep things simple, and is
      able to ignore splats that produce results where every result is the
      same.
      
      This is a more powerful version of a combine that already happens in
      instrcombine, capable of optimizing more cases by looking through more
      instructions and being able to cost the shuffle.
      
      Differential Revision: https://reviews.llvm.org/D123494
      ded8187e
    • Jacques Pienaar's avatar
      [mlir] Add basic tree-sitter grammar file · 9a4472c5
      Jacques Pienaar authored
      tree-sitter grammar file that tries to closely matches LangRef (it could use
      some tweaking and cleanup, but kept fairly basic). Also updated LangRef in
      places where found some issues while doing the nearly direct transcription.
      
      This only adds a grammar file, not all the other parts (npm etc) that
      accompanies it. Those I'll propose for separate repo like we do for vscode
      extension.
      
      Reviewed By: rriddle
      
      Differential Revision: https://reviews.llvm.org/D124352
      9a4472c5
    • Biplob Mishra's avatar
      InstCombine: Add no-one-use tests and create thwart complexity-based... · c38344dd
      Biplob Mishra authored
      InstCombine: Add no-one-use tests and create thwart complexity-based canonicalization for the or-and combine tests
      c38344dd
    • Chris Lattner's avatar
      [AsmParser] Rework logic around "region argument parsing" · 5dedf911
      Chris Lattner authored
      The asm parser had a notional distinction between parsing an
      operand (like "%foo" or "%4#3") and parsing a region argument
      (which isn't supposed to allow a result number like #3).
      
      Unfortunately the implementation has two problems:
      
      1) It didn't actually check for the result number and reject
         it.  parseRegionArgument and parseOperand were identical.
      2) It had a lot of machinery built up around it that paralleled
         operand parsing.  This also was functionally identical, but
         also had some subtle differences (e.g. the parseOptional
         stuff had a different result type).
      
      I thought about just removing all of this, but decided that the
      missing error checking was important, so I reimplemented it with
      a `allowResultNumber` flag on parseOperand.  This keeps the
      codepaths unified and adds the missing error checks.
      
      Differential Revision: https://reviews.llvm.org/D124470
      5dedf911
    • Yitzhak Mandelbaum's avatar
      [clang][dataflow] Perform structural comparison of indirection values in `join`. · 6c81b572
      Yitzhak Mandelbaum authored
      This patch changes `Environment::join`, in the case that two values at the same
      location are not (pointer) equal, to structurally compare indirection values
      (pointers and references) for equivalence (that is, equivalent pointees) before
      resorting to merging.
      
      This change makes join consistent with equivalence, which also performs
      structural comparison. It also fixes a bug where the values are `ReferenceValue`
      but the merge creates a non-reference value. This case arises when the
      `ReferenceValue`s were created to represent an lvalue, so the "reference-ness"
      is not reflected in the type. In this case, the pointees will always be
      equivalent, because lvalues at the same code location point to the location of a
      fixed declaration, whose location is itself stable across blocks.
      
      We were unable to reproduce a unit test for this latter bug, but have verified
      the fix in the context of a larger piece of code that triggers the bug.
      
      Differential Revision: https://reviews.llvm.org/D124540
      6c81b572
    • Alexey Bataev's avatar
      [OPENMP]PR53344: Emit code for final update of the inscan reduction vars in worksharing loops. · 1462e63f
      Alexey Bataev authored
      Need to emit final update of the inscan reduction variables. For
      worksharing loops, the reduction values are stored in the temp array,
      need to copy the last element to the original var at the end of the
      construct.
      
      Differential Revision: https://reviews.llvm.org/D121156
      1462e63f
    • Paul Robinson's avatar
      [PS5] Default to omit leaf frame pointer · 17f3a92e
      Paul Robinson authored
      17f3a92e
    • Alan Zhao's avatar
      [llvm-ml] Improve indirect call parsing · 3333c28f
      Alan Zhao authored
      In MASM, if a QWORD symbol is passed to a jmp or call instruction in
      64-bit mode or a DWORD or WORD symbol is passed in 32-bit mode, then
      MSVC's assembler recognizes that as an indirect call. Additionally, if
      the operand is qualified as a ptr, then that should also be an indirect
      call.
      
      Furthermore, in 64-bit mode, such operands are implicitly rip-relative
      (in fact, MSVC's assembler ml64.exe does not allow explicitly specifying
      rip as a base register.)
      
      To keep this patch managable, this patch does not include:
      * error messages for wrong operand types (e.g. passing a QWORD in 32-bit
        mode)
      * resolving indirect calls if the symbol is declared after it's first
        use (llvm-ml currently only runs a single pass).
      * imlementing the extern keyword (required to resolve
        https://crbug.com/762167.)
      
      This patch is likely missing a bunch of edge cases, so please do point
      them out in the review.
      
      Reviewed By: epastor, hans, MaskRay
      
      Committed By: epastor (on behalf of ayzhao)
      
      Differential Revision: https://reviews.llvm.org/D124413
      3333c28f
    • Simon Pilgrim's avatar