1. Jan 14, 2020
    • 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
    • Stanislav Mekhanoshin's avatar
      [AMDGPU] Fix getInstrLatency() always returning 1 · eca44745
      Stanislav Mekhanoshin authored
      We do not have InstrItinerary so generic getInstLatency() was always
      defaulting to return 1 cycle. We need to use TargetSchedModel instead
      to compute an instruction's latency.
      
      Differential Revision: https://reviews.llvm.org/D72655
      eca44745
    • Sam McCall's avatar
      [mlir] Fix -Wunused · 547abdd9
      Sam McCall authored
      547abdd9
    • Raphael Isemann's avatar
      [lldb] Don't defend against internal LLVM errors in IRInterpreter · f18370fe
      Raphael Isemann authored
      Summary:
      Whenever we cast an LLVM instruction to one of its subclasses, we do a double check if the RTTI
      enum value actually allows us to cast the class. I don't see a way this can ever happen as even when
      LLVM's RTTI system has some corrupt internal state (which we probably should not test in the first
      place) we just reuse LLVM RTTI to do the second check.
      
      This also means that if we ever make an actual programming error in this function (e.g., have a enum
      value and then cast it to a different subclass), we just silently fall back to the JIT in our tests.
      
      We also can't test this code in any reasonable way.
      
      This removes the checks and uses `llvm::cast` instead which will raise a fatal error when casting fails.
      
      Reviewers: labath, mib
      
      Reviewed By: labath
      
      Subscribers: abidh, JDevlieghere, lldb-commits
      
      Tags: #lldb
      
      Differential Revision: https://reviews.llvm.org/D72596
      f18370fe
    • Raphael Isemann's avatar
      [lldb] Fix that SBThread.GetStopDescription is returning strings with... · 61b6a4e8
      Raphael Isemann authored
      [lldb] Fix that SBThread.GetStopDescription is returning strings with uninitialized memory at the end.
      
      Summary:
      `SBThread.GetStopDescription` is a curious API as it takes a buffer length as a parameter that specifies
      how many bytes the buffer we pass has. Then we fill the buffer until the specified length (or the length
      of the stop description string) and return the string length. If the buffer is a nullptr however, we instead
      return how many bytes we would have written to the buffer so that the user can allocate a buffer with
      the right size and pass that size to a subsequent `SBThread.GetStopDescription` call.
      
      Funnily enough, it is not possible to pass a nullptr via the Python SWIG bindings, so that might be the
      first API in LLDB that is not only hard to use correctly but impossible to use correctly. The only way to
      call this function via Python is to throw in a large size limit that is hopefully large enough to contain the
      stop description (otherwise we only get the truncated stop description).
      
      Currently passing a size limit that is smaller than the returned stop description doesn't cause the
      Python bindings to return the stop description but instead the truncated stop description + uninitialized characters
      at the end of the string. The reason for this is that we return the result of `snprintf` from the method
      which returns the amount of bytes that *would* have been written (which is larger than the buffer).
      This causes our Python bindings to return a string that is as large as full stop description but the
      buffer that has been filled is only as large as the passed in buffer size.
      
      This patch fixes this issue by just recalculating the string length in our buffer instead of relying on the wrong
      return value. We also have to do this in a new type map as the old type map is also used for all methods
      with the given argument pair `char *dst, size_t dst_len` (e.g. SBProcess.GetSTDOUT`). These methods have
      different semantics for these arguments and don't null-terminate the returned buffer (they instead return the
      size in bytes) so we can't change the existing typemap without breaking them.
      
      Reviewers: labath, jingham
      
      Reviewed By: labath
      
      Subscribers: clayborg, shafik, abidh, JDevlieghere, lldb-commits
      
      Tags: #lldb
      
      Differential Revision: https://reviews.llvm.org/D72086
      61b6a4e8
    • Jay Foad's avatar
      [AMDGPU] Remove duplicate gfx10 assembler and disassembler tests · 440ce516
      Jay Foad authored
      Summary: Depends on D72611.
      
      Reviewers: rampitec, arsenm
      
      Subscribers: kzhuravl, jvesely, wdng, nhaehnle, yaxunl, dstuttard, tpr, t-tye, jfb, llvm-commits
      
      Tags: #llvm
      
      Differential Revision: https://reviews.llvm.org/D72616
      440ce516
    • Jay Foad's avatar
      [AMDGPU] Improve error checking in gfx10 assembler tests · 0950de26
      Jay Foad authored
      Summary:
      This adds checks that the expected error was actually reported against
      the correct instruction, and fixes a couple of problems that that showed
      up: one incorrect W32-ERR:
      
       v_cmp_class_f16_sdwa vcc, v1, v2 src0_sel:DWORD src1_sel:DWORD
       // W64: encoding: [0xf9,0x04,0x1e,0x7d,0x01,0x00,0x06,0x06]
      -// W32-ERR: error: invalid operand for instruction
      +// W32-ERR: error: {{instruction not supported on this GPU|invalid operand for instruction}}
      
      and one missing W32-ERR:
      
       v_cmp_class_f16_sdwa s[6:7], v1, v2 src0_sel:DWORD src1_sel:DWORD
       // W64: encoding: [0xf9,0x04,0x1e,0x7d,0x01,0x86,0x06,0x06]
      +// W32-ERR: error: invalid operand for instruction
      
      Reviewers: rampitec, arsenm
      
      Subscribers: kzhuravl, jvesely, wdng, nhaehnle, yaxunl, dstuttard, tpr, t-tye, llvm-commits
      
      Tags: #llvm
      
      Differential Revision: https://reviews.llvm.org/D72611
      0950de26
    • Jay Foad's avatar
      [AMDGPU] Add gfx9 assembler and disassembler test cases · 63c3691f
      Jay Foad authored
      Summary:
      This adds assembler tests for cases that were previously only in the
      disassembler tests, and vice versa.
      
      Reviewers: rampitec, arsenm, nhaehnle
      
      Subscribers: kzhuravl, jvesely, wdng, yaxunl, dstuttard, tpr, t-tye, jfb, llvm-commits
      
      Tags: #llvm
      
      Differential Revision: https://reviews.llvm.org/D72592
      63c3691f
    • Joachim Protze's avatar
      [OpenMP][Tool] Improving stack trace for Archer · ed810da7
      Joachim Protze authored
      The OpenMP runtime is not instrumented, so entering the runtime leaves no hint
      on the source line of the pragma on ThreadSanitizer's function stack.
      
      This patch adds function entry/exit annotations for OpenMP parallel regions,
      and synchronization regions (barrier, taskwait, taskgroup).
      
      Reviewed By: jdoerfert
      
      Differential Revision: https://reviews.llvm.org/D70408
      ed810da7
    • Fangrui Song's avatar
      [ELF] Delete unintended --force-bti · d9819f36
      Fangrui Song authored
      d9819f36
    • Joachim Protze's avatar
      [OpenMP][Tool] Make tests for archer dependent on TSan · 84637408
      Joachim Protze authored
      If the openmp project is built standalone, the test compiler is feature tested for an available -fsanitize=thread flag.
      If the openmp project is built as part of llvm, the target tsan is needed to test archer.
      
      An additional line (requires tsan) was introduced to the tests, this patch updates the line numbers for the race.
      
      Follow-up for 77ad98c8
      
      Reviewed By: jdoerfert
      
      Differential Revision: https://reviews.llvm.org/D71914
      84637408
    • Fangrui Song's avatar
      [ELF] Add -z force-ibt and -z shstk for Intel Control-flow Enforcement Technology · 7cd429f2
      Fangrui Song authored
      This patch is a joint work by Rui Ueyama and me based on D58102 by Xiang Zhang.
      
      It adds Intel CET (Control-flow Enforcement Technology) support to lld.
      The implementation follows the draft version of psABI which you can
      download from https://github.com/hjl-tools/x86-psABI/wiki/X86-psABI.
      
      CET introduces a new restriction on indirect jump instructions so that
      you can limit the places to which you can jump to using indirect jumps.
      
      In order to use the feature, you need to compile source files with
      -fcf-protection=full.
      
      * IBT is enabled if all input files are compiled with the flag. To force enabling ibt, pass -z force-ibt.
      * SHSTK is enabled if all input files are compiled with the flag, or if -z shstk is specified.
      
      IBT-enabled executables/shared objects have two PLT sections, ".plt" and
      ".plt.sec".  For the details as to why we have two sections, please read
      the comments.
      
      Reviewed By: xiangzhangllvm
      
      Differential Revision: https://reviews.llvm.org/D59780
      7cd429f2
    • Fangrui Song's avatar
    • Zheng Chen's avatar
    • Daniel Galvez's avatar
      [MLIR] Fix broken link locations after move to monorepo · a7cac2bd
      Daniel Galvez authored
      I used the codemod python tool to do this with the following commands:
      
      codemod 'tensorflow/mlir/blob/master/include' 'llvm/llvm-project/blob/master/mlir/include'
      codemod 'tensorflow/mlir/blob/master' 'llvm/llvm-project/blob/master/mlir'
      codemod 'tensorflow/mlir' 'llvm-project/llvm'
      
      Differential Revision: https://reviews.llvm.org/D72244
      a7cac2bd
    • Craig Topper's avatar
      [X86] Copy the nofpexcept flag when folding a load into an instruction using... · b1dcd84c
      Craig Topper authored
      [X86] Copy the nofpexcept flag when folding a load into an instruction using the load folding tables./
      b1dcd84c
    • Craig Topper's avatar
    • Michał Górny's avatar
      [clang] [test] Fix riscv-toolchain-extra to be less picky about paths · 1ab13f8c
      Michał Górny authored
      Fix riscv-toolchain-extra tests to pass when CLANG_RESOURCE_DIR is set
      to another value than the default.
      
      Differential Revision: https://reviews.llvm.org/D72591
      1ab13f8c
    • Aart Bik's avatar
      [mlir] [VectorOps] fixed typo in verifier of slice op · 3818101f
      Aart Bik authored
      Reviewers: nicolasvasilache, andydavis1, rriddle
      
      Reviewed By: nicolasvasilache, rriddle
      
      Subscribers: merge_guards_bot, mehdi_amini, rriddle, jpienaar, burmako, shauheen, antiagainst, nicolasvasilache, arpith-jacob, mgester, lucyrfox, liufengdb, llvm-commits
      
      Tags: #llvm
      
      Differential Revision: https://reviews.llvm.org/D72664
      3818101f
    • Jonas Devlieghere's avatar
      [lldb/Utility] Add std::move to make placate clang 3.8 · d1e3b23b
      Jonas Devlieghere authored
      This fixes an error thrown by clang 3.8 that no viable conversion from
      returned value to the function return type.
      d1e3b23b
    • Nico Weber's avatar
    • Davide Italiano's avatar
    • Jonas Devlieghere's avatar
      [llvm-exegesis] Initialize const bitvector member · 09db6e32
      Jonas Devlieghere authored
      This causes an error with older versions of clang: constructor for
      'llvm::exegesis::InstructionsCache' must explicitly initialize the const
      member 'BVC'
      09db6e32
    • Eli Friedman's avatar
      [GlobalISel] Change representation of shuffle masks in MachineOperand. · e68e4cbc
      Eli Friedman authored
      We're planning to remove the shufflemask operand from ShuffleVectorInst
      (D72467); fix GlobalISel so it doesn't depend on that Constant.
      
      The change to prelegalizercombiner-shuffle-vector.mir happens because
      the input contains a literal "-1" in the mask (so the parser/verifier
      weren't really handling it properly). We now treat it as equivalent to
      "undef" in all contexts.
      
      Differential Revision: https://reviews.llvm.org/D72663
      e68e4cbc
    • Richard Smith's avatar
      Re-enable testing of .s tests under test/CodeGen/X86. · 989bed98
      Richard Smith authored
      These were temporarily disabled in 2013 and we apparently forgot to
      ever turn them back on again.
      
      Fix spelling of flag to llvm-mc in recently-added test that wasn't
      actually being run due to this.
      989bed98
    • River Riddle's avatar
      [mlir] NFC: Remove unused variable. · 03edd6d6
      River Riddle authored
      03edd6d6