1. Jan 14, 2020
    • Simon Pilgrim's avatar
      Fix "pointer is null" static analyzer warnings. NFCI. · 591cd405
      Simon Pilgrim authored
      Use cast<> instead of cast_or_null<> since the pointers are always dereferenced and cast<> will perform the null assertion for us.
      591cd405
    • Simon Pilgrim's avatar
      Remove duplicate variable. NFCI. · 9d905e8c
      Simon Pilgrim authored
      9d905e8c
    • Simon Pilgrim's avatar
    • Simon Pilgrim's avatar
      Fix "pointer is null" static analyzer warnings. NFCI. · 25dc5c7c
      Simon Pilgrim authored
      Use castAs<> instead of getAs<> since the pointer is dereferenced immediately below and castAs will perform the null assertion for us.
      25dc5c7c
    • Simon Pilgrim's avatar
      Fix "null pointer passed to nonnull argument" clang static analyzer warnings. NFCI. · 7ec7a6e5
      Simon Pilgrim authored
      Assert that the memcpy arguments are valid.
      7ec7a6e5
    • Levon Ter-Grigoryan's avatar
      Expression eval lookup speedup by not returning methods in ManualDWARFIndex::GetFunctions · a705cf1a
      Levon Ter-Grigoryan authored
      Summary:
      This change is connected with
      https://reviews.llvm.org/D69843
      
      In large codebases, we sometimes see Module::FindFunctions (when called from
      ClangExpressionDeclMap::FindExternalVisibleDecls) returning huge amounts of
      functions.
      
      In current fix I trying to return only function_fullnames from ManualDWARFIndex::GetFunctions when eFunctionNameTypeFull is passed as argument.
      
      Reviewers: labath, jarin, aprantl
      
      Reviewed By: labath
      
      Subscribers: shafik, clayborg, teemperor, arphaman, lldb-commits
      
      Tags: #lldb
      
      Differential Revision: https://reviews.llvm.org/D70846
      a705cf1a
    • Tim Northover's avatar
      AArch64: fix bitcode upgrade of @llvm.neon.addp. · 77cc690b
      Tim Northover authored
      We were upgrading it to faddp, but a version taking two type parameters instead
      of one. This then got upgraded a second time to the version with just one
      parameter, but occasionally (for reasons I don't understand) this unusual
      two-stage process corrupted a use-list, leading to a crash when the two faddp
      declarations didn't match.
      77cc690b
    • Sanjay Patel's avatar
      cfe2fab7
    • Simon Tatham's avatar
      [TableGen] Update editor modes for new keywords. · e3ed63e8
      Simon Tatham authored
      Summary:
      D71407 and D71474 added new keywords to the Tablegen language:
      `defvar`, `if`, `then` and `else`. This commit updates the various
      editor modes to highlight them appropriately.
      
      Some of the modes also didn't include `defset`, so I've added that too
      while I was there.
      
      Reviewers: MaskRay, lebedev.ri, plotfi
      
      Reviewed By: lebedev.ri
      
      Subscribers: llvm-commits
      
      Tags: #llvm
      
      Differential Revision: https://reviews.llvm.org/D72693
      e3ed63e8
    • Raphael Isemann's avatar
    • Ulrich Weigand's avatar
      [FPEnv] Add some comments to IRBuilder.h · 6aca3e8d
      Ulrich Weigand authored
      As requested via post-commit comment for D71467, this adds comments
      documenting CreateFCmp vs. CreateFCmpS to the header file.
      6aca3e8d
    • Sam Elliott's avatar
      [RISCV][NFC] Deduplicate Atomic Intrinsic Definitions · dee6e39c
      Sam Elliott authored
      Summary:
      This is a slight cleanup, to use multiclasses to avoid the duplication between
      the different atomic intrinsic definitions. The produced intrinsics are
      unchanged, they're just generated in a more succinct way.
      
      Reviewers: asb, luismarques, jrtc27
      
      Reviewed By: luismarques, jrtc27
      
      Subscribers: Jim, rbar, johnrusso, simoncook, sabuasal, niosHD, kito-cheng, shiva0217, jrtc27, MaskRay, zzheng, edward-jones, rogfer01, MartinMosbeck, brucehoult, the_o, rkruppe, jfb, PkmX, jocewei, psnobl, benna, s.egerton, pzheng, sameer.abuasal, apazos, llvm-commits
      
      Tags: #llvm
      
      Differential Revision: https://reviews.llvm.org/D71777
      dee6e39c
    • Ulrich Weigand's avatar
      [FPEnv] Fix chain handling regression after 04a86966 · 81ee4844
      Ulrich Weigand authored
      Code in getRoot made the assumption that every node in PendingLoads
      must always itself have a dependency on the current DAG root node.
      
      After the changes in 04a86966, it turns out that this assumption no
      longer holds true, causing wrong codegen in some cases (e.g. stores
      after constrained FP intrinsics might get deleted).
      
      To fix this, we now need to make sure that the TokenFactor created
      by getRoot always includes the previous root, if there is no implicit
      dependency already present.
      
      The original getControlRoot code already has exactly this check,
      so this patch simply reuses that code now for getRoot as well.
      This fixes the regression.
      
      NFC if no constrained FP intrinsic is present.
      81ee4844
    • Benjamin Kramer's avatar
    • Miloš Stojanović's avatar
      [unittests] Fix "comparison of integers of different signs" warnings · bff33bd5
      Miloš Stojanović authored
      A warning is sent because `std::distance()` returns a signed type so
      `CmpHelperEQ()` gets instantiated into a function that compares
      differently signed arguments.
      
      Differential Revision: https://reviews.llvm.org/D72632
      bff33bd5
    • Simon Tatham's avatar
      [ARM,MVE] Use the new Tablegen `defvar` and `if` statements. · 71d5454b
      Simon Tatham authored
      Summary:
      This cleans up a lot of ugly `foreach` bodges that I've been using to
      work around the lack of those two language features. Now they both
      exist, I can make then all into something more legible!
      
      In particular, in the common pattern in `ARMInstrMVE.td` where a
      multiclass defines an `Instruction` instance plus one or more `Pat` that
      select it, I've used a `defvar` to wrap `!cast<Instruction>(NAME)` so
      that the patterns themselves become a little more legible.
      
      Replacing a `foreach` with a `defvar` removes a level of block
      structure, so several pieces of code have their indentation changed by
      this patch. Best viewed with whitespace ignored.
      
      NFC: the output of `llvm-tblgen -print-records` on the two affected
      Tablegen sources is exactly identical before and after this change, so
      there should be no effect at all on any of the other generated files.
      
      Reviewers: MarkMurrayARM, miyuki
      
      Reviewed By: MarkMurrayARM
      
      Subscribers: kristof.beyls, hiraditya, dmgreen, cfe-commits, llvm-commits
      
      Tags: #clang, #llvm
      
      Differential Revision: https://reviews.llvm.org/D72690
      71d5454b
    • Med Ismail Bennani's avatar
      [lldb/Expression] Improve interpreter error message with a non-running target · 877723b7
      Med Ismail Bennani authored
      When trying to interpret an expression with a function call, if the
      process hasn't been launched, the expression fails to be interpreted
      and the user gets the following  error message:
      
      ```error: Can't run the expression locally```
      
      This message doesn't explain why the expression failed to be
      interpreted, that's why this patch improves the error message that is
      displayed when trying to run an expression while no process is running.
      
      rdar://11991708
      
      Differential Revision: https://reviews.llvm.org/D72510
      
      
      
      Signed-off-by: default avatarMed Ismail Bennani <medismail.bennani@gmail.com>
      877723b7
    • Sam Parker's avatar
      [ARM][LowOverheadLoops] Allow all MVE instrs. · e27632c3
      Sam Parker authored
      We have a whitelist of instructions that we allow when tail
      predicating, since these are trivial ones that we've deemed need no
      special handling. Now change ARMLowOverheadLoops to allow the
      non-trivial instructions if they're contained within a valid VPT
      block. Since a valid block is one that is predicated upon the VCTP so
      we know that these non-trivial instructions will still behave as
      expected once the implicit predication is used instead.
      
      This also fixes a previous test failure.
      
      Differential Revision: https://reviews.llvm.org/D72509
      e27632c3
    • Simon Pilgrim's avatar
    • Simon Pilgrim's avatar
      [SelectionDAG] ComputeKnownBits - merge getValidMinimumShiftAmountConstant()... · c05a1110
      Simon Pilgrim authored
      [SelectionDAG] ComputeKnownBits - merge getValidMinimumShiftAmountConstant() and generic ISD::SHL handling.
      
      As mentioned by @nikic on rGef5debac, we can merge the guaranteed bottom zero bits from the shifted value, and then, if a min shift amount is known, zero out the bottom bits as well.
      c05a1110
    • Sam Parker's avatar
      [ARM][LowOverheadLoops] Change predicate inspection · bad6032b
      Sam Parker authored
      Use the already provided helper function to get the operand type so
      that we can detect whether the vpr is being used as a predicate or
      not. Also use existing helpers to get the predicate indices when we
      converting the vpt blocks. This enables us to support both types of
      vpr predicate operand.
      
      Differential Revision: https://reviews.llvm.org/D72504
      bad6032b
    • Diogo Sampaio's avatar
      [ARM][Thumb2] Fix ADD/SUB invalid writes to SP · d94d079a
      Diogo Sampaio authored
      Summary:
      This patch fixes pr23772  [ARM] r226200 can emit illegal thumb2 instruction: "sub sp, r12, #80".
      The violation was that SUB and ADD (reg, immediate) instructions can only write to SP if the source register is also SP. So the above instructions was unpredictable.
      To enforce that the instruction t2(ADD|SUB)ri does not write to SP we now enforce the destination register to be rGPR (That exclude PC and SP).
      Different than the ARM specification, that defines one instruction that can read from SP, and one that can't, here we inserted one that can't write to SP, and other that can only write to SP as to reuse most of the hard-coded size optimizations.
      When performing this change, it uncovered that emitting Thumb2 Reg plus Immediate could not emit all variants of ADD SP, SP #imm instructions before so it was refactored to be able to. (see test/CodeGen/Thumb2/mve-stacksplot.mir where we use a subw sp, sp, Imm12 variant )
      It also uncovered a disassembly issue of adr.w instructions, that were only written as SUBW instructions (see llvm/test/MC/Disassembler/ARM/thumb2.txt).
      
      Reviewers: eli.friedman, dmgreen, carwil, olista01, efriedma, andreadb
      
      Reviewed By: efriedma
      
      Subscribers: gbedwell, john.brawn, efriedma, ostannard, kristof.beyls, hiraditya, dmgreen, llvm-commits
      
      Tags: #llvm
      
      Differential Revision: https://reviews.llvm.org/D70680
      d94d079a
    • Simon Pilgrim's avatar
      [X86][SSE] Add add(shl(and(x,c1),c2),c3) test case with non-uniform shift value · fd42a4ac
      Simon Pilgrim authored
      As mentioned by @nikic on rGef5debac, we should merge the guaranteed top zero bits from the shifted value and min shift amount code so they can both set the high bits to zero.
      fd42a4ac
    • Simon Pilgrim's avatar
      [SelectionDAG] ComputeKnownBits - merge getValidMinimumShiftAmountConstant()... · a43b0065
      Simon Pilgrim authored
      [SelectionDAG] ComputeKnownBits - merge getValidMinimumShiftAmountConstant() and generic ISD::SRL handling.
      
      As mentioned by @nikic on rGef5debac (although that was just about SHL), we can merge the guaranteed top zero bits from the shifted value, and then, if a min shift amount is known, zero out the top bits as well.
      
      SHL tests / handling will be added in a follow up patch.
      a43b0065
    • Sam Parker's avatar
      [ARM][MVE] Disallow VPSEL for tail predication · e73b20c5
      Sam Parker authored
      Due to the current way that we collect predicated instructions, we
      can't easily handle vpsel in tail predicated loops. There are a
      couple of issues:
      1) It will use the VPR as a predicate operand, but doesn't have to be
         instead a VPT block, which means we can assert while building up
         the VPT block because we don't find another VPST to being a new
         one.
      2) VPSEL still requires a VPR operand even after tail predicating,
         which means we can't remove it unless there is another
         instruction, such as vcmp, that can provide the VPR def.
      
      The first issue should be a relatively simple fix in the logic of the
      LowOverheadLoops pass, whereas the second will require us to
      represent the 'implicit' tail predication with an explicit value.
      
      Differential Revision: https://reviews.llvm.org/D72629
      e73b20c5
    • Alex Zinenko's avatar
      [mlir] Fix translation of splat constants to LLVM IR · d6ea8ff0
      Alex Zinenko authored
      Summary:
      When converting splat constants for nested sequential LLVM IR types wrapped in
      MLIR, the constant conversion was erroneously assuming it was always possible
      to recursively construct a constant of a sequential type given only one value.
      Instead, wait until all sequential types are unpacked recursively before
      constructing a scalar constant and wrapping it into the surrounding sequential
      type.
      
      Subscribers: mehdi_amini, rriddle, jpienaar, burmako, shauheen, antiagainst, nicolasvasilache, arpith-jacob, mgester, lucyrfox, aartbik, liufengdb, llvm-commits
      
      Tags: #llvm
      
      Differential Revision: https://reviews.llvm.org/D72688
      d6ea8ff0
    • James Clarke's avatar
      [RISCV] Fix ILP32D lowering for double+double/double+int return types · 3d6c492d
      James Clarke authored
      Summary:
      Previously, since these aggregates are > 2*XLen, Clang would think they
      were being returned indirectly and thus would decrease the number of
      available GPRs available by 1. For long argument lists this could lead
      to a struct argument incorrectly being passed indirectly.
      
      Reviewers: asb, lenary
      
      Reviewed By: asb, lenary
      
      Subscribers: luismarques, rbar, johnrusso, simoncook, apazos, sabuasal, niosHD, kito-cheng, shiva0217, zzheng, edward-jones, rogfer01, MartinMosbeck, brucehoult, the_o, rkruppe, PkmX, jocewei, psnobl, benna, Jim, lenary, s.egerton, pzheng, sameer.abuasal, cfe-commits
      
      Tags: #clang
      
      Differential Revision: https://reviews.llvm.org/D69590
      3d6c492d
    • Tres Popp's avatar
      [mlir] Create a gpu.module operation for the GPU Dialect. · 4624a1e8
      Tres Popp authored
      Summary:
      This is based on the use of code constantly checking for an attribute on
      a model and instead represents the distinct operaion with a different
      op. Instead, this op can be used to provide better filtering.
      
      Reviewers: herhut, mravishankar, antiagainst, rriddle
      
      Reviewed By: herhut, antiagainst, rriddle
      
      Subscribers: liufengdb, aartbik, jholewinski, mgorny, mehdi_amini, rriddle, jpienaar, burmako, shauheen, antiagainst, nicolasvasilache, csigg, arpith-jacob, mgester, lucyrfox, llvm-commits
      
      Tags: #llvm
      
      Differential Revision: https://reviews.llvm.org/D72336
      4624a1e8
    • Raphael Isemann's avatar
      [lldb][NFC] Cleanup ClangASTContext::CompleteTagDeclarationDefinition · 9492e9d8
      Raphael Isemann authored
      Makes this function exit early instead of nesting if statements.
      
      Also removed all the if (tag_type->getDecl()) checks. If we created
      a TagType with a nullptr as a Decl then Clang would have already
      deferenced that nullptr during TagType creation so there is no point
      in gracefully handling a nullptr here.
      9492e9d8
    • Adrian's avatar
      [mlir] Ran git-clang-format. · 5a6eae3d
      Adrian authored
      Summary:
      I forgot to ran git-clang-format before committing.
      5a6eae3d
    • Adrian Kuegel's avatar
      [mlir] Add loop.parallel, loop.reduce and loop.reduce.return operations. · 018b0425
      Adrian Kuegel authored
      Summary:
      These operations can be used to specify a loop nest with a body that can
      contain reductions. The iteration space can be iterated in any order.
      
      RFC: https://groups.google.com/a/tensorflow.org/d/topic/mlir/pwtSgiKFPis/discussion
      
      Differential Revision: https://reviews.llvm.org/D72394
      018b0425
    • Anna Welker's avatar
      [ARM][MVE] Masked gathers from base + vector of offsets · 72ca86fd
      Anna Welker authored
      Enables the masked gather pass to create a masked
      gather loading from a base and vector of offsets.
      This also enables v8i16 and v16i8 gather loads.
      
      Differential Revision: https://reviews.llvm.org/D72330
      72ca86fd
    • Sam McCall's avatar
      [Target] Fix uninitialized value in 10c11e4e · 41b52018
      Sam McCall authored
      41b52018
    • Simon Tatham's avatar
      [TableGen] Introduce an if/then/else statement. · ddbc0b1e
      Simon Tatham authored
      Summary:
      This allows you to make some of the defs in a multiclass or `foreach`
      conditional on an expression computed from the parameters or iteration
      variables.
      
      It was already possible to simulate an if statement using a `foreach`
      with a dummy iteration variable and a list constructed using `!if` so
      that it had length 0 or 1 depending on the condition, e.g.
      
        foreach unusedIterationVar = !if(condition, [1], []<int>) in { ... }
      
      But this syntax is nicer to read, and also more convenient because it
      allows an else clause.
      
      To avoid upheaval in the implementation, I've implemented `if` as pure
      syntactic sugar on the `foreach` implementation: internally, `ParseIf`
      actually does construct exactly the kind of foreach shown above (and
      another reversed one for the else clause if present).
      
      Reviewers: nhaehnle, hfinkel
      
      Reviewed By: hfinkel
      
      Subscribers: hiraditya, llvm-commits
      
      Tags: #llvm
      
      Differential Revision: https://reviews.llvm.org/D71474
      ddbc0b1e
    • Simon Tatham's avatar
      [TableGen] Introduce a `defvar` statement. · 3388b0f5
      Simon Tatham authored
      Summary:
      This allows you to define a global or local variable to an arbitrary
      value, and refer to it in subsequent definitions.
      
      The main use I anticipate for this is if you have to compute some
      difficult function of the parameters of a multiclass, and then use it
      many times. For example:
      
        multiclass Foo<int i, string s> {
          defvar op = !cast<BaseClass>("whatnot_" # s # "_" # i);
          def myRecord {
            dag a = (op this, (op that, the other), (op x, y, z));
            int b = op.subfield;
          }
          def myOtherRecord<"template params including", op>;
        }
      
      There are a couple of ways to do this already, but they're not really
      satisfactory. You can replace `defvar x = y` with a loop over a
      singleton list, `foreach x = [y] in { ... }` - but that's unintuitive
      to someone who hasn't seen that workaround idiom before, and requires
      an extra pair of braces that you often didn't really want. Or you can
      define a nested pair of multiclasses, with the inner one taking `x` as
      a template parameter, and the outer one instantiating it just once
      with the desired value of `x` computed from its other parameters - but
      that makes it awkward to sequentially compute each value based on the
      previous ones. I think `defvar` makes things considerably easier.
      
      You can also use `defvar` at the top level, where it inserts globals
      into the same map used by `defset`. That allows you to define global
      constants without having to make a dummy record for them to live in:
      
        defvar MAX_BUFSIZE = 512;
      
        // previously:
        // def Dummy { int MAX_BUFSIZE = 512; }
        // and then refer to Dummy.MAX_BUFSIZE everywhere
      
      Reviewers: nhaehnle, hfinkel
      
      Reviewed By: hfinkel
      
      Subscribers: hiraditya, llvm-commits
      
      Tags: #llvm
      
      Differential Revision: https://reviews.llvm.org/D71407
      3388b0f5
    • Malcolm Parsons's avatar
      [clang-tidy] Ignore implicit casts in modernize-use-default-member-init · 45924eb4
      Malcolm Parsons authored
      Summary:
      Initialising a pointer from nullptr involves an implicit cast.
      Ignore it after getting initialiser from InitListExpr.
      
      Fixes: PR44440
      
      Reviewers: aaron.ballman, alexfh, JonasToth
      
      Reviewed By: JonasToth
      
      Subscribers: xazax.hun, cfe-commits
      
      Tags: #clang
      
      Differential Revision: https://reviews.llvm.org/D72630
      45924eb4
    • Georgii Rymar's avatar
      [llvm-readobj][test] - Fix grammar in comments. · ec6579fc
      Georgii Rymar authored
      This addresses post commit review comments for D71766.
      ec6579fc
    • Stanislav Mekhanoshin's avatar
      [AMDGPU] Model distance to instruction in bundle · ad741853
      Stanislav Mekhanoshin authored
      This change allows to model the height of the instruction
      within a bundle for latency adjustment purposes.
      
      Differential Revision: https://reviews.llvm.org/D72669
      ad741853
    • Billy Robert O'Neal III's avatar
    • Raphael Isemann's avatar
      [lldb][NFC] Rewrite python_api/rdar-12481949 test · d8ffd601
      Raphael Isemann authored
      Summary:
      This renames the test `rdar-12481949` to `get-value-32bit-int` as it just tests that we return the
      correct result get calling GetValueAsSigned/GetValueAsUnsigned on 32-bit integers.
      
      It also deletes all the strange things going on in this test including resetting the data formatters (which are to my
      knowledge not used to calculate scalar values) and testing Python's long integers (let's just assume that our Python
      distribution works correctly). Also modernises the setup code.
      
      Reviewers: labath, aprantl
      
      Reviewed By: aprantl
      
      Subscribers: JDevlieghere, lldb-commits
      
      Tags: #lldb
      
      Differential Revision: https://reviews.llvm.org/D72593
      d8ffd601