1. Aug 19, 2020
    • Yaxun (Sam) Liu's avatar
      [HIP] Support target id by --offload-arch · 7546b29e
      Yaxun (Sam) Liu authored
      This patch introduces support of target id by
      -offload-arch.
      
      Differential Revision: https://reviews.llvm.org/D60620
      7546b29e
    • Ronak Chauhan's avatar
      [AMDGPU] Support disassembly for AMDGPU kernel descriptors · cacfb02d
      Ronak Chauhan authored
      Decode AMDGPU Kernel descriptors as assembler directives.
      
      Reviewed By: scott.linder
      
      Differential Revision: https://reviews.llvm.org/D80713
      cacfb02d
    • aartbik's avatar
      [mlir] [VectorOps] Cleanup mask 1-d test on constants · 451dcfae
      aartbik authored
      I forgot to address this in previous CL. Sorry about that.
      
      Reviewed By: rriddle
      
      Differential Revision: https://reviews.llvm.org/D86188
      451dcfae
    • Julian Lettner's avatar
      [TSan][libdispatch] Guard test execution on old platforms · 40ae296b
      Julian Lettner authored
      `dispatch_async_and_wait()` was introduced in macOS 10.14.  Let's
      forward declare it to ensure we can compile the test with older SDKs and
      guard execution by checking if the symbol is available.  (We can't use
      `__builtin_available()`, because that itself requires a higher minimum
      deployment target.)  We also need to specify the `-undefined
      dynamic_lookup` compiler flag.
      
      Differential Revision: https://reviews.llvm.org/D85995
      40ae296b
    • Julian Lettner's avatar
      [TSan][libdispatch] Ensure TSan dylib works on old systems · 686fe293
      Julian Lettner authored
      `dispatch_async_and_wait()` was introduced in macOS 10.14, which is
      greater than our minimal deployment target.  We need to forward declare
      it as a "weak import" to ensure we generate a weak reference so the TSan
      dylib continues to work on older systems.  We cannot simply `#include
      <dispatch.h>` or use the Darwin availability macros since this file is
      multi-platform.
      
      In addition, we want to prevent building these interceptors at all when
      building with older SDKs because linking always fails.
      
      Before:
      ```
      ➤ dyldinfo -bind ./lib/clang/12.0.0/lib/darwin/libclang_rt.tsan_osx_dynamic.dylib | grep dispatch_async_and_wait
      __DATA  __interpose      0x000F5E68    pointer      0 libSystem        _dispatch_async_and_wait_f
      ```
      
      After:
      ```
      ➤ dyldinfo -bind ./lib/clang/12.0.0/lib/darwin/libclang_rt.tsan_osx_dynamic.dylib | grep dispatch_async_and_wait
      __DATA  __got            0x000EC0A8    pointer      0 libSystem        _dispatch_async_and_wait (weak import)
      __DATA  __interpose      0x000F5E78    pointer      0 libSystem        _dispatch_async_and_wait (weak import)
      ```
      
      This is a follow-up to D85854 and should fix:
      https://reviews.llvm.org/D85854#2221529
      
      Reviewed By: kubamracek
      
      Differential Revision: https://reviews.llvm.org/D86103
      686fe293
    • Julian Lettner's avatar
      Reland "[TSan][libdispatch] Add interceptors for dispatch_async_and_wait()" · 0c4863a2
      Julian Lettner authored
      The linker errors caused by this revision have been addressed.
      
      Add interceptors for `dispatch_async_and_wait[_f]()` which was added in
      macOS 10.14.  This pair of functions is similar to `dispatch_sync()`,
      but does not force a context switch of the queue onto the caller thread
      when the queue is active (and hence is more efficient).  For TSan, we
      can apply the same semantics as for `dispatch_sync()`.
      
      From the header docs:
      > Differences with dispatch_sync()
      >
      > When the runtime has brought up a thread to invoke the asynchronous
      > workitems already submitted to the specified queue, that servicing
      > thread will also be used to execute synchronous work submitted to the
      > queue with dispatch_async_and_wait().
      >
      > However, if the runtime has not brought up a thread to service the
      > specified queue (because it has no workitems enqueued, or only
      > synchronous workitems), then dispatch_async_and_wait() will invoke the
      > workitem on the calling thread, similar to the behaviour of functions
      > in the dispatch_sync family.
      
      Additional context:
      > The guidance is to use `dispatch_async_and_wait()` instead of
      > `dispatch_sync()` when it is necessary to mix async and sync calls on
      > the same queue. `dispatch_async_and_wait()` does not guarantee
      > execution on the caller thread which allows to reduce context switches
      > when the target queue is active.
      > https://gist.github.com/tclementdev/6af616354912b0347cdf6db159c37057
      
      rdar://35757961
      
      Reviewed By: kubamracek
      
      Differential Revision: https://reviews.llvm.org/D85854
      0c4863a2
    • Mehdi Amini's avatar
      Separate the Registration from Loading dialects in the Context · f9dc2b70
      Mehdi Amini authored
      This changes the behavior of constructing MLIRContext to no longer load globally
      registered dialects on construction. Instead Dialects are only loaded explicitly
      on demand:
      - the Parser is lazily loading Dialects in the context as it encounters them
      during parsing. This is the only purpose for registering dialects and not load
      them in the context.
      - Passes are expected to declare the dialects they will create entity from
      (Operations, Attributes, or Types), and the PassManager is loading Dialects into
      the Context when starting a pipeline.
      
      This changes simplifies the configuration of the registration: a compiler only
      need to load the dialect for the IR it will emit, and the optimizer is
      self-contained and load the required Dialects. For example in the Toy tutorial,
      the compiler only needs to load the Toy dialect in the Context, all the others
      (linalg, affine, std, LLVM, ...) are automatically loaded depending on the
      optimization pipeline enabled.
      
      To adjust to this change, stop using the existing dialect registration: the
      global registry will be removed soon.
      
      1) For passes, you need to override the method:
      
      virtual void getDependentDialects(DialectRegistry &registry) const {}
      
      and registery on the provided registry any dialect that this pass can produce.
      Passes defined in TableGen can provide this list in the dependentDialects list
      field.
      
      2) For dialects, on construction you can register dependent dialects using the
      provided MLIRContext: `context.getOrLoadDialect<DialectName>()`
      This is useful if a dialect may canonicalize or have interfaces involving
      another dialect.
      
      3) For loading IR, dialect that can be in the input file must be explicitly
      registered with the context. `MlirOptMain()` is taking an explicit registry for
      this purpose. See how the standalone-opt.cpp example is setup:
      
        mlir::DialectRegistry registry;
        registry.insert<mlir::standalone::StandaloneDialect>();
        registry.insert<mlir::StandardOpsDialect>();
      
      Only operations from these two dialects can be in the input file. To include all
      of the dialects in MLIR Core, you can populate the registry this way:
      
        mlir::registerAllDialects(registry);
      
      4) For `mlir-translate` callback, as well as frontend, Dialects can be loaded in
      the context before emitting the IR: context.getOrLoadDialect<ToyDialect>()
      
      Differential Revision: https://reviews.llvm.org/D85622
      f9dc2b70
    • Mehdi Amini's avatar
      Revert "Separate the Registration from Loading dialects in the Context" · e75bc5c7
      Mehdi Amini authored
      This reverts commit d14cf457.
      The build is broken with GCC-5.
      e75bc5c7
    • River Riddle's avatar
      [mlir] Update the documentation for defining types · c996d49c
      River Riddle authored
      The documentation needs a refresh now that "kinds" are no longer a concept. This revision also adds mentions to a few other new concepts, e.g. traits and interfaces.
      
      Differential Revision: https://reviews.llvm.org/D86182
      c996d49c
    • Brad Smith's avatar
      d9ff48d0
    • Changpeng Fang's avatar
      AMDGPU: Implement waterfall loop for MIMG instructions with 256-bit SRsrc · e7081d11
      Changpeng Fang authored
      Summary:
        When the resource descriptor is of vgpr, we need a waterfall loop
      to read into a sgpr. In this patchm we generalized the  implementation
      to work for any regster class sizes, and extend the work to MIMG
      instructions.
      
      Fixes: SWDEV-223405
      
      Reviewers:
        arsenm, nhaehnle
      
      Differential Revision:
        https://reviews.llvm.org/D82603
      e7081d11
    • Mehdi Amini's avatar
      Separate the Registration from Loading dialects in the Context · d14cf457
      Mehdi Amini authored
      This changes the behavior of constructing MLIRContext to no longer load globally
      registered dialects on construction. Instead Dialects are only loaded explicitly
      on demand:
      - the Parser is lazily loading Dialects in the context as it encounters them
      during parsing. This is the only purpose for registering dialects and not load
      them in the context.
      - Passes are expected to declare the dialects they will create entity from
      (Operations, Attributes, or Types), and the PassManager is loading Dialects into
      the Context when starting a pipeline.
      
      This changes simplifies the configuration of the registration: a compiler only
      need to load the dialect for the IR it will emit, and the optimizer is
      self-contained and load the required Dialects. For example in the Toy tutorial,
      the compiler only needs to load the Toy dialect in the Context, all the others
      (linalg, affine, std, LLVM, ...) are automatically loaded depending on the
      optimization pipeline enabled.
      
      To adjust to this change, stop using the existing dialect registration: the
      global registry will be removed soon.
      
      1) For passes, you need to override the method:
      
      virtual void getDependentDialects(DialectRegistry &registry) const {}
      
      and registery on the provided registry any dialect that this pass can produce.
      Passes defined in TableGen can provide this list in the dependentDialects list
      field.
      
      2) For dialects, on construction you can register dependent dialects using the
      provided MLIRContext: `context.getOrLoadDialect<DialectName>()`
      This is useful if a dialect may canonicalize or have interfaces involving
      another dialect.
      
      3) For loading IR, dialect that can be in the input file must be explicitly
      registered with the context. `MlirOptMain()` is taking an explicit registry for
      this purpose. See how the standalone-opt.cpp example is setup:
      
        mlir::DialectRegistry registry;
        registry.insert<mlir::standalone::StandaloneDialect>();
        registry.insert<mlir::StandardOpsDialect>();
      
      Only operations from these two dialects can be in the input file. To include all
      of the dialects in MLIR Core, you can populate the registry this way:
      
        mlir::registerAllDialects(registry);
      
      4) For `mlir-translate` callback, as well as frontend, Dialects can be loaded in
      the context before emitting the IR: context.getOrLoadDialect<ToyDialect>()
      
      Differential Revision: https://reviews.llvm.org/D85622
      d14cf457
    • Chuanqi Xu's avatar
      [NFC][StackSafety] Test that StackLifetime looks through stripPointerCasts · f6de5306
      Chuanqi Xu authored
      StackLifetime class collects lifetime marker of an `alloca` by collect
      the user of `BitCast` who is the user of the `alloca`. However, either
      the `alloca` itself could be used with the lifetime marker or the `BitCast`
      of the `alloca` could be transformed to other instructions. (e.g.,
      it may be transformed to all zero reps in `InstCombine` pass).
      This patch tries to fix this process in `collectMarkers` functions.
      
      Reviewed By: vitalybuka
      
      Differential Revision: https://reviews.llvm.org/D85399
      f6de5306
    • River Riddle's avatar
      [mlir] Remove the use of "kinds" from Attributes and Types · 250f43d3
      River Riddle authored
      This greatly simplifies a large portion of the underlying infrastructure, allows for lookups of singleton classes to be much more efficient and always thread-safe(no locking). As a result of this, the dialect symbol registry has been removed as it is no longer necessary.
      
      For users broken by this change, an alert was sent out(https://llvm.discourse.group/t/removing-kinds-from-attributes-and-types) that helps prevent a majority of the breakage surface area. All that should be necessary, if the advice in that alert was followed, is removing the kind passed to the ::get methods.
      
      Differential Revision: https://reviews.llvm.org/D86121
      250f43d3
    • Elliott Hughes's avatar
      ld128 demangle: allow space for 'L' suffix. · a7d0b7a7
      Elliott Hughes authored
      Summary:
      Caught by HWASAN on arm64 Android (which uses ld128 for long double). This
      was running the existing fuzzer.
      
      The specific minimized fuzz input to reproduce this is:
      
        __cxa_demangle("1\006ILeeeEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE", 0, 0, 0);
      
      Reviewers: eugenis, srhines, #libc_abi!
      
      Subscribers: kristof.beyls, danielkiss, libcxx-commits
      
      Tags: #libc_abi
      
      Differential Revision: https://reviews.llvm.org/D77924
      a7d0b7a7
    • Brad Smith's avatar
      Hook up OpenBSD 64-bit RISC-V support · 592b8996
      Brad Smith authored
      592b8996
    • Jonas Devlieghere's avatar
      514bcb32
    • Mehdi Amini's avatar
      Revert "Separate the Registration from Loading dialects in the Context" · d84fe55e
      Mehdi Amini authored
      This reverts commit e1de2b75.
      Broke a build bot.
      d84fe55e
    • Craig Topper's avatar
      [X86] Add basic support for -mtune command line option in clang · 4cbceb74
      Craig Topper authored
      Building on the backend support from D85165. This parses the command line option in the driver, passes it on to CC1 and adds a function attribute.
      
      -Still need to support tune on the target attribute.
      -Need to use "generic" as the tuning by default. But need to change generic in the backend first.
      -Need to set tune if march is specified and mtune isn't.
      -May need to disable getHostCPUName's ability to guess CPU name from features when it doesn't have a family/model match for mtune=native. That's what gcc appears to do.
      
      Differential Revision: https://reviews.llvm.org/D85384
      4cbceb74
    • Roman Lebedev's avatar
      [NFC][InstCombine] Aggregate reconstruction: use plain map · 2f017858
      Roman Lebedev authored
      Now that we no longer require for this map to have stable iteration order,
      we no longer need to pay for keeping the iteration order stable,
      so switch from `SmallMapVector` to `SmallDenseMap`.
      2f017858
    • Nithin Vadukkumchery Rajendrakumar's avatar
      [Analysis] Bug fix for exploded graph branching in evalCall for constructor · b34b1e38
      Nithin Vadukkumchery Rajendrakumar authored
      Summary:
      Make exactly single NodeBuilder exists at any given time
      
      Reviewers: NoQ, Szelethus, vsavchenko, xazax.hun
      
      Reviewed By: NoQ
      
      Subscribers: martong, cfe-commits
      Tags: #clang
      
      Differential Revision: https://reviews.llvm.org/D85796
      b34b1e38
    • Roman Lebedev's avatar
      [InstCombine] PHI-aware aggregate reconstruction: properly handle duplicate predecessors · 78bd4231
      Roman Lebedev authored
      While it may seem like we can just "deduplicate" the case where
      some basic block happens to be a predecessor more than once,
      which happens for e.g. switches, that is not correct thing to do.
      We must actually add a PHI operand for each predecessor.
      
      This was initially reported to me by David Major
      as a clang crash during gecko build for android.
      78bd4231
    • Amara Emerson's avatar
    • Sterling Augustine's avatar
      Default to disabling the libunwind frameheader cache. · a20f5fe7
      Sterling Augustine authored
      Although it works fine with glibc, as currently implemented the
      frameheader cache is incompatible with certain platforms with
      slightly different locking semantics inside dl_iterate_phdr.
      
      Therefore only enable it when it is turned on explicitly with
      a configure-time option.
      
      Differential Revision: https://reviews.llvm.org/D86163
      a20f5fe7
    • Craig Topper's avatar
      [X86] Fix the Predicates on MMX_PSHUFWri/PSHUFWmi to include SSE1 in addition to MMX. · 9028c03c
      Craig Topper authored
      These instructions weren't in the initial version of MMX, but
      were added when SSE1 was introduced. We already have the intrinsic
      named correctly to include sse and the frontened header enforces
      sse. We have one place in the backend where we DAG combine to
      this intrinsic, but that's also qualified. So don't know of anything
      currently broken unless someone writes their own IR and doesn't
      set the sse feature.
      9028c03c
    • Mehdi Amini's avatar
      Separate the Registration from Loading dialects in the Context · e1de2b75
      Mehdi Amini authored
      This changes the behavior of constructing MLIRContext to no longer load globally
      registered dialects on construction. Instead Dialects are only loaded explicitly
      on demand:
      - the Parser is lazily loading Dialects in the context as it encounters them
      during parsing. This is the only purpose for registering dialects and not load
      them in the context.
      - Passes are expected to declare the dialects they will create entity from
      (Operations, Attributes, or Types), and the PassManager is loading Dialects into
      the Context when starting a pipeline.
      
      This changes simplifies the configuration of the registration: a compiler only
      need to load the dialect for the IR it will emit, and the optimizer is
      self-contained and load the required Dialects. For example in the Toy tutorial,
      the compiler only needs to load the Toy dialect in the Context, all the others
      (linalg, affine, std, LLVM, ...) are automatically loaded depending on the
      optimization pipeline enabled.
      
      To adjust to this change, stop using the existing dialect registration: the
      global registry will be removed soon.
      
      1) For passes, you need to override the method:
      
      virtual void getDependentDialects(DialectRegistry &registry) const {}
      
      and registery on the provided registry any dialect that this pass can produce.
      Passes defined in TableGen can provide this list in the dependentDialects list
      field.
      
      2) For dialects, on construction you can register dependent dialects using the
      provided MLIRContext: `context.getOrLoadDialect<DialectName>()`
      This is useful if a dialect may canonicalize or have interfaces involving
      another dialect.
      
      3) For loading IR, dialect that can be in the input file must be explicitly
      registered with the context. `MlirOptMain()` is taking an explicit registry for
      this purpose. See how the standalone-opt.cpp example is setup:
      
        mlir::DialectRegistry registry;
        mlir::registerDialect<mlir::standalone::StandaloneDialect>();
        mlir::registerDialect<mlir::StandardOpsDialect>();
      
      Only operations from these two dialects can be in the input file. To include all
      of the dialects in MLIR Core, you can populate the registry this way:
      
        mlir::registerAllDialects(registry);
      
      4) For `mlir-translate` callback, as well as frontend, Dialects can be loaded in
      the context before emitting the IR: context.getOrLoadDialect<ToyDialect>()
      e1de2b75
    • MaheshRavishankar's avatar
      [mlir][Linalg] Modify callback for getting id/nprocs in · 5ccac05d
      MaheshRavishankar authored
      LinalgDistribution options to allow more general distributions.
      
      Changing the signature of the callback to send in the ranges for all
      the parallel loops and expect a vector with the Value to use for the
      processor-id and number-of-processors for each of the parallel loops.
      
      Differential Revision: https://reviews.llvm.org/D86095
      5ccac05d
    • David Blaikie's avatar
      Recommit "PR44685: DebugInfo: Handle address-use-invalid type units referencing non-type units" · 1870b52f
      David Blaikie authored
      Originally committed as be3ef93b.
      Reverted by b4bffdba due to bot
      failures:
      http://green.lab.llvm.org/green/job/clang-stage1-cmake-RA-expensive/17380/testReport/junit/LLVM/DebugInfo_X86/addr_tu_to_non_tu_ll/
      http://45.33.8.238/win/22216/step_11.txt
      
      MacOS failure due to testing Split DWARF which isn't compatible with
      MachO.
      Windows failure due to testing type units which aren't enabled on
      Windows.
      
      Fix both of these by applying an explicit x86 linux triple to the test.
      1870b52f
    • Zequan Wu's avatar
      [Coverage] Adjust skipped regions only if {Prev,Next}TokLoc is in the same... · 84fffa67
      Zequan Wu authored
      [Coverage] Adjust skipped regions only if {Prev,Next}TokLoc is in the same file as regions' {start, end}Loc
      
      Fix a bug if {Prev, Next}TokLoc is in different file from skipped regions' {start, end}Loc
      
      Differential Revision: https://reviews.llvm.org/D86116
      84fffa67
    • Greg Clayton's avatar
      Fix a check that was attempting to see if an object file was in memory. · 08748d15
      Greg Clayton authored
      Checking if an object file is in memory should use the ObjectFile::IsInMemory(), not test ObjectFile::BaseAddress(). ObjectFile::BaseAddress() is designed to be overridden by all classes and is for mach-o, ELF and COFF plug-ins. They find the header base adddress and return that as a section offset address. The default implementation of ObjectFile::BaseAddress() does try and make an Address() from the ObjectFile::m_memory_addr, but I switched it to a correct function call.
      
      Differential Revision: https://reviews.llvm.org/D86122
      08748d15
    • Sanjay Patel's avatar
      0b98a59f
    • Marius Brehler's avatar
      [mlir] Check libraries linked into standalone-opt · 45901ebd
      Marius Brehler authored
      Adds a call to mlir_check_all_link_libraries() to check all libraries
      linked into standalone-opt.
      45901ebd
    • Eli Friedman's avatar
      [AArch64][SVE] Add patterns for integer mla/mls. · be944c85
      Eli Friedman authored
      We probably want to introduce pseudo-instructions at some point, like
      we have for binary operations, but this seems okay for now.
      
      One thing I'm not sure about is whether we should be doing this as a
      DAGCombine instead of directly pattern-matching it. I don't see any big
      downside to doing it this way, though.
      
      Differential Revision: https://reviews.llvm.org/D85681
      be944c85
    • Eli Friedman's avatar
      [AArch64][SVE] Allow llvm.aarch64.sve.st2/3/4 with vectors of pointers. · bb185323
      Eli Friedman authored
      This isn't necessaary for ACLE, but could be useful in other situations.
      And the change is simple.
      
      Differential Revision: https://reviews.llvm.org/D85251
      bb185323
    • Eli Friedman's avatar
      [clang codegen] Use IR "align" attribute for static array arguments. · 673dbe1b
      Eli Friedman authored
      Without the "align" attribute, marking the argument dereferenceable is
      basically useless.  See also D80166.
      
      Fixes https://bugs.llvm.org/show_bug.cgi?id=46876 .
      
      Differential Revision: https://reviews.llvm.org/D84992
      673dbe1b
    • Craig Topper's avatar
      [X86] Don't call SemaBuiltinConstantArg from CheckX86BuiltinTileDuplicate if... · 6b1f9f2b
      Craig Topper authored
      [X86] Don't call SemaBuiltinConstantArg from CheckX86BuiltinTileDuplicate if Argument is Type or Value Dependent.
      
      SemaBuiltinConstantArg has an early exit for that case that doesn't
      produce an error and doesn't update the APInt. We need to detect that
      case and not use the APInt value.
      
      While there delete the signature of CheckX86BuiltinTileArgumentsRange
      that takes a single Argument index to check. There's another version
      that takes an ArrayRef and single value is convertible to an ArrayRef.
      6b1f9f2b
    • Mehdi Amini's avatar
      Remove MLIREDSCInterface library which isn't used anywhere (NFC) · 62dbbcf6
      Mehdi Amini authored
      Reviewed By: nicolasvasilache, ftynse
      
      Differential Revision: https://reviews.llvm.org/D85042
      62dbbcf6
    • Jessica Paquette's avatar
      [GlobalISel][CallLowering] NFC: Unify flag-setting from CallBase + AttributeList · bf36e902
      Jessica Paquette authored
      It's annoying to have to maintain multiple, nearly identical chains of if
      statements which all set the same attributes.
      
      Add a helper function, `addFlagsUsingAttrFn` which performs the attribute
      setting.
      
      Then, use wrappers for that function in `lowerCall` and `setArgFlags`.
      
      (Note that the flag-setting code in `setArgFlags` was missing the returned
      attribute. There's no selection for this yet, so no test. It's an example of
      the kind of thing this lets us avoid, though.)
      
      Differential Revision: https://reviews.llvm.org/D86159
      bf36e902
    • Jessica Paquette's avatar
      [GlobalISel][CallLowering] Don't tail call with non-forwarded explicit sret · f29e6277
      Jessica Paquette authored
      Similar to this commit:
      
      faf8065a
      
      Testcase is pretty much the same as
      
      test/CodeGen/AArch64/tailcall-explicit-sret.ll
      
      Except it uses i64 (since we don't handle the i1024 return values yet), and
      doesn't have indirect tail call testcases (because we can't translate those
      yet).
      
      Differential Revision: https://reviews.llvm.org/D86148
      f29e6277
    • Siva Chandra Reddy's avatar
      f768eb21