1. Jan 11, 2021
  2. Jan 10, 2021
    • Florian Hahn's avatar
      [STLExtras] Use return type from operator* of the wrapped iter. · c701f85c
      Florian Hahn authored
      Currently make_early_inc_range cannot be used with iterators with
      operator* implementations that do not return a reference.
      
      Most notably in the LLVM codebase, this means the User iterator ranges
      cannot be used with make_early_inc_range, which slightly simplifies
      iterating over ranges while elements are removed.
      
      Instead of directly using BaseT::reference as return type of operator*,
      this patch uses decltype to get the actual return type of the operator*
      implementation in WrappedIteratorT.
      
      This patch also updates a few places to use make use of
      make_early_inc_range.
      
      Reviewed By: dblaikie
      
      Differential Revision: https://reviews.llvm.org/D93992
      c701f85c
    • Nico Weber's avatar
      47991a15
    • Nicolas Vasilache's avatar
      [mlir] NFC - Drop spurious assertion on symbols during `promoteComposedSymbolsAsDims` · a9224860
      Nicolas Vasilache authored
      This assertion is an old remnant from earlier days when only affine functions existed.
      It is not the place of affine map composition to check whether orthogonal considerations
      on what is allowed to be a symbol under the AffineScope trait.
      a9224860
    • Juneyoung Lee's avatar
      [CodeGen] Update transformations to use poison for shufflevector/insertelem's initial vector elem · 9f2d9364
      Juneyoung Lee authored
      This patch is a part of D93817 and makes transformations in CodeGen use poison for shufflevector/insertelem's initial vector element.
      
      The change in CodeGenPrepare.cpp is fine because the mask of shufflevector should be always zero.
      It doesn't touch the second element (which is poison).
      
      The change in InterleavedAccessPass.cpp is also fine becauses the mask is of the form <a, a+m, a+2m, .., a+km> where a+km is smaller than
      the size of the first vector operand.
      This is guaranteed by the caller of replaceBinOpShuffles, which is lowerInterleavedLoad.
      It calls isDeInterleaveMask and isDeInterleaveMaskOfFactor to check the mask is the desirable form.
      isDeInterleaveMask has the check that a+km is smaller than the vector size.
      To check my understanding, I added an assertion & added a test to show that this optimization doesn't fire in such case.
      
      Reviewed By: spatel
      
      Differential Revision: https://reviews.llvm.org/D94056
      9f2d9364
    • Fangrui Song's avatar
      [test] Improve weakref & weak_import tests · b41b743d
      Fangrui Song authored
      b41b743d
    • Craig Topper's avatar
      [RISCV] Change ConstraintMask in RISCVII enum to be shifted left. NFC · 6fc7a92e
      Craig Topper authored
      This makes the mask align with the position of the bits in TSFlags
      which is a little more logical.
      
      I might be adding more fields to TSFlags and some might be single
      bits where just ANDing with mask to test the bit would make sense.
      
      While there rename TargetFlags in validateInstruction to reflect
      that it's just the constraint bits.
      6fc7a92e
    • Craig Topper's avatar
      [RISCV] Use uint16_t instead of unsigned for opcodes in the RVV pseudo instruction table. · 59908fc0
      Craig Topper authored
      We currently have about 7000 opcodes in the RISCVGenInstrInfo.inc
      enum. We can use uint16_t to store these values. We would need to
      grow by nearly 9x before we run out of space so this should last
      for a little while.
      
      This reduces the llc binary by 32K.
      59908fc0
    • Nico Weber's avatar
      [lld/mac] remove redundant null check · 1198478c
      Nico Weber authored
      This is already checked two lines up. No behavior change.
      1198478c
    • Sriraman Tallam's avatar
      Recommit D91678 after fixing the test breakage. · 9f452fbf
      Sriraman Tallam authored
      This adds a new test checking llvm-symbolizer with an object built with basic block sections.
      
      Build a object with -fbasic-block-sections and reorder the basic blocks to be
      non-contiguous. Then check if llvm-symbolizer correctly reports the symbolized
      addresses. Included the source to build the object with command lines.
      
      Differential Revision: https://reviews.llvm.org/D91678
      9f452fbf
    • Fangrui Song's avatar
      [CodeGenModule] Drop dso_local on function declarations for ELF -fno-pic... · e2e82c99
      Fangrui Song authored
      [CodeGenModule] Drop dso_local on function declarations for ELF -fno-pic -fno-direct-access-external-data
      
      ELF -fno-pic sets dso_local on a function declaration to allow direct accesses
      when taking its address (similar to a data symbol). The emitted code follows the
      traditional GCC/Clang -fno-pic behavior: an absolute relocation is produced.
      
      If the function is not defined in the executable, a canonical PLT entry will be
      needed at link time. This is similar to a copy relocation and is incompatible
      with (-Bsymbolic or --dynamic-list linked shared objects / protected symbols in
      a shared object).
      
      This patch gives -fno-pic code a way to avoid such a canonical PLT entry.
      
      The FIXME was about a generalization for -fpie -mpie-copy-relocations (now -fpie
      -fdirect-access-external-data). While we could set dso_local to avoid GOT when
      taking the address of a function declaration (there is an ignorable difference
      about R_386_PC32 vs R_386_PLT32 on i386), it likely does not provide any benefit
      and can just cause trouble, so we don't make the generalization.
      e2e82c99
    • Fraser Cormack's avatar
      [RISCV] Add scalable vector icmp ISel patterns · b02eab90
      Fraser Cormack authored
      
      
      Original patch by @rogfer01.
      
      The RVV integer comparison instructions are defined in such a way that
      many LLVM operations are defined by using the "opposite" comparison
      instruction and swapping the operands. This is done in this patch in
      most cases, except for the mappings where the immediate range must be
      adjusted to accomodate:
      
          va < i --> vmsle{u}.vi vd, va, i-1, vm
          va >= i --> vmsgt{u}.vi vd, va, i-1, vm
      
      That is left for future optimization; this patch supports all operations
      but in the case of the missing mappings the immediate will be moved to
      a scalar register first.
      
      Since there are so many condition codes and operand cases to check, it
      was decided to reduce the test burden by only testing the "vscale x 8"
      vector types.
      
      Authored-by: default avatarRoger Ferrer Ibanez <rofirrim@gmail.com>
      Co-Authored-by: default avatarFraser Cormack <fraser@codeplay.com>
      
      Reviewed By: craig.topper
      
      Differential Revision: https://reviews.llvm.org/D94168
      b02eab90
    • Fraser Cormack's avatar
      [SelectionDAG] Teach isConstOrConstSplat about ISD::SPLAT_VECTOR · 41d06095
      Fraser Cormack authored
      This improves llvm::isConstOrConstSplat by allowing it to analyze
      ISD::SPLAT_VECTOR nodes, in order to allow more constant-folding of
      operations using scalable vector types.
      
      Reviewed By: craig.topper
      
      Differential Revision: https://reviews.llvm.org/D94168
      41d06095
    • Lewuathe's avatar
      [mlir] Enhance mlir-opt show-dialects test case · 03d24939
      Lewuathe authored
      mlir-opt supports many more test cases. All available dialects supported by latest mlir-opt should be coverted in the test case.
      
      Reviewed By: aartbik, stephenneuendorffer, mehdi_amini
      
      Differential Revision: https://reviews.llvm.org/D93821
      03d24939
    • Shoaib Meenai's avatar
      [clang] Add llvm-strip to test dependencies · 4dbb3f57
      Shoaib Meenai authored
      CodeGen/thinlto_embed_bitcode.ll relies on it.
      4dbb3f57
    • Mircea Trofin's avatar
      [NFC] Disallow unused prefixes in CodeGen/X86 tests. · 75c04327
      Mircea Trofin authored
      Also fixed remaining tests that featured unused prefixes.
      
      Differential Revision: https://reviews.llvm.org/D94330
      75c04327
    • Aart Bik's avatar
      [mlir][vector] modified scatter/gather syntax, pass_thru mandatory · 6728af16
      Aart Bik authored
      This change makes the scatter/gather syntax more consistent with
      the syntax of all the other memory operations in the Vector dialect
      (order of types, use of [] for index, etc.). This will make the MLIR
      code easier to read. In addition, the pass_thru parameter of the
      gather has been made mandatory (there is very little benefit in
      using the implicit "undefined" values).
      
      Reviewed By: nicolasvasilache
      
      Differential Revision: https://reviews.llvm.org/D94352
      6728af16
    • Florian Hahn's avatar
      [SimplifyCFG] Keep !dgb metadata of moved instruction, if they match. · d98fc62a
      Florian Hahn authored
      Currently SimplifyCFG drops the debug locations of 'bonus' instructions.
      Such instructions are moved before the first branch. The reason for the
      current behavior is that this could lead to surprising debug stepping,
      if the block that's folded is dead.
      
      In case the first branch and the instructions to be folded have the same
      debug location, this shouldn't be an issue and we can keep the debug
      location.
      
      Reviewed By: vsk
      
      Differential Revision: https://reviews.llvm.org/D93662
      d98fc62a
    • Nico Weber's avatar
      [gn build] Make an explicit `use_lld = true` on mac use lld.darwinnew · 87d4ea24
      Nico Weber authored
      use_lld defaults to true on non-mac if clang_base_path is set (i.e.
      the host compiler is a locally-built clang). On mac, the lld Mach-O
      port used to be unusable, but ld64.lld.darwinnew is close to usable.
      When explicitly setting `use_lld = true` in a GN build on a mac host,
      check-lld passes, two check-clang tests fail, and a handful check-llvm
      tests fail (the latter all due to -flat_namespace not yet being implemented).
      87d4ea24
    • Shilei Tian's avatar
      [OpenMP] Remove copy constructor of `RTLInfoTy` · 175c336a
      Shilei Tian authored
      Multiple `RTLInfoTy` objects are stored in a list `AllRTLs`. Since
      `RTLInfoTy` contains a `std::mutex`, it is by default not a copyable object.
      In order to support `AllRTLs.push_back(...)` which is currently used, a customized
      copy constructor is provided. Every time we need to add a new data member into
      `RTLInfoTy`, we should keep in mind not forgetting to add corresponding assignment
      in the copy constructor. In fact, the only use of the copy constructor is to push
      the object into the list, we can of course write it in a way that first emplace
      a new object back, and then use the reference to the last element. In this way we
      don't need the copy constructor anymore. If the element is invalid, we just need
      to pop it, and that's what this patch does.
      
      Reviewed By: JonChesterfield
      
      Differential Revision: https://reviews.llvm.org/D94361
      175c336a
    • Jez Ng's avatar
      e98b441a
    • Kazu Hirata's avatar
      [llvm] Drop unnecessary make_range (NFC) · 6a6e3821
      Kazu Hirata authored
      6a6e3821
    • Kazu Hirata's avatar
      [Transforms] Use llvm::find_if (NFC) · 4d92ab16
      Kazu Hirata authored
      4d92ab16
    • Kazu Hirata's avatar
      [SCEV] Remove unused getOrInsertCanonicalInductionVariable (NFC) · 9a7c03b8
      Kazu Hirata authored
      The last use was removed on Mar 22, 2012 in commit
      f47d0af5.
      9a7c03b8
    • Fraser Cormack's avatar
      [SelectionDAG] Extend immAll(Ones|Zeros)V to handle ISD::SPLAT_VECTOR · de373ef7
      Fraser Cormack authored
      The TableGen immAllOnesV and immAllZerosV helpers implicitly wrapped the
      ISD::isBuildVectorAll(Ones|Zeros) helper functions. This was inhibiting
      their use for targets such as RISC-V which use ISD::SPLAT_VECTOR. In
      particular, RISC-V had to define its own 'vnot' fragment.
      
      In order to extend the scope of these nodes to include support for
      ISD::SPLAT_VECTOR, two new ISD predicate functions have been introduced:
      ISD::isConstantSplatVectorAll(Ones|Zeros). These effectively supersede
      the older "isBuildVector" predicates, which are now simple wrappers for
      the new functions. They pass a defaulted boolean toggle which preserves
      the old behaviour. It is hoped that in time all call-sites can be ported
      to the "isConstantSplatVector" functions.
      
      While the use of ISD::isBuildVectorAll(Ones|Zeros) has not changed, the
      behaviour of the TableGen immAll(Ones|Zeros)V **has**. To test the new
      functionality, the custom RISC-V TableGen fragment has been removed and
      replaced with the built-in 'vnot'. To test their use as pattern-roots, two
      splat patterns have been updated accordingly.
      
      Reviewed By: craig.topper
      
      Differential Revision: https://reviews.llvm.org/D94223
      de373ef7
    • Shilei Tian's avatar
      [OpenMP] Added the support for cache line size 256 for A64FX · 676c7cb0
      Shilei Tian authored
      Fugaku supercomputer is built with the Fujitsu A64FX microprocessor, whose cache line is 256. In current libomp, we only have cache line size 128 for PPC64 and otherwise 64. This patch added the support of cache line 256 for A64FX. It's worth noting that although A64FX is a variant of AArch64, this property is not shared. As a result, in light of UCX source code (https://github.com/openucx/ucx/blob/392443ab92626412605dee1572056f79c897c6c3/src/ucs/arch/aarch64/cpu.c#L17), we can only determine by checking whether the CPU is FUJITSU A64FX.
      
      Reviewed By: jdoerfert, Hahnfeld
      
      Differential Revision: https://reviews.llvm.org/D93169
      676c7cb0
    • Roger Ferrer Ibanez's avatar
      [RISCV] Do not grow the stack a second time when we need to realign the stack · 524d8fa9
      Roger Ferrer Ibanez authored
      This is a first change needed to fix a crash in which the emergency
      spill splot ends being out of reach. This happens when we run the
      register scavenger after we have eliminated the frame indexes. The fix
      for the actual crash will come in a later change.
      
      This change removes an extra stack size increase we do in
      RISCVFrameLowering::determineFrameLayout.
      
      We don't have to change the size of the stack here as
      PEI::calculateFrameObjectOffsets is already doing this with the right
      size accounting the extra alignment.
      
      Differential Revision: https://reviews.llvm.org/D89237
      524d8fa9
    • Florian Hahn's avatar
      [VPlan] Keep start value of VPWidenPHIRecipe as VPValue. · 65f578fc
      Florian Hahn authored
      Similar to D92129, update VPWidenPHIRecipe  to manage the start value as
      VPValue. This allows adjusting the start value as a VPlan transform,
      which will be used in a follow-up patch to support reductions during
      epilogue vectorization.
      
      Reviewed By: gilr
      
      Differential Revision: https://reviews.llvm.org/D93975
      65f578fc
  3. Jan 09, 2021
    • Mikhail Maltsev's avatar
      [clang][Sema] Compare SourceLocations directly [NFCI] · 9f76788b
      Mikhail Maltsev authored
      The ordered comparison operators are defined for the SourceLocation
      class, so SourceLocation objects can be compared directly. There is no
      need to extract the internal representation for comparison.
      
      Reviewed By: aprantl
      
      Differential Revision: https://reviews.llvm.org/D94231
      9f76788b
    • Lei Zhang's avatar
      [mlir][spirv] Replace SPIRVOpLowering with OpConversionPattern · 7c3ae48f
      Lei Zhang authored
      The dialect conversion framework was enhanced to handle type
      conversion automatically. OpConversionPattern already contains
      a pointer to the TypeConverter. There is no need to duplicate it
      in a separate subclass. This removes the only reason for a
      SPIRVOpLowering subclass. It adapts to use core infrastructure
      and simplifies the code.
      
      Also added a utility function to OpConversionPattern for getting
      TypeConverter as a certain subclass.
      
      Reviewed By: hanchung
      
      Differential Revision: https://reviews.llvm.org/D94080
      7c3ae48f
    • Heejin Ahn's avatar
      [WebAssembly] Remove unreachable EH pads · 4e4df1e3
      Heejin Ahn authored
      This removes unreachable EH pads in LateEHPrepare. This is not for
      optimization but for preparation for CFGStackify. In CFGStackify, we
      determine where to place `try` marker by computing the nearest common
      dominator of all predecessors of an EH pad, but when an EH pad does not
      have a predecessor, it becomes tricky. We can insert an empty dummy BB
      before the EH pad and place the `try` there, but removing unreachable EH
      pads is simpler.
      
      This moves an existing exception label test from eh-label.mir to
      exception.mir and adds a new test there.
      
      This also adds some comments to existing methods.
      
      Reviewed By: dschuff, tlively
      
      Differential Revision: https://reviews.llvm.org/D94044
      4e4df1e3
    • Fraser Cormack's avatar
      2c442629
    • Thomas Preud'homme's avatar
      [Test][FileCheck] Fix use of undef var · c0cea2d9
      Thomas Preud'homme authored
      The test related to directives with prefix NUMEXPR-CONSTRAINT-NOMATCH
      refers to the numeric variable UNSI which is defined by a directive with
      prefix CHECK not enabled on the lit command-line. Rather than adding the
      prefix CHECK to the lit command-line, this commit defined variable UNSI
      in a new NUMEXPR-CONSTRAINT-NOMATCH prefixed directive. The directive
      needs to contain more than just the variable otherwise the error message
      from FileCheck is about the wrong line being matched.
      
      Reviewed By: jhenderson
      
      Differential Revision: https://reviews.llvm.org/D93346
      c0cea2d9
    • Heejin Ahn's avatar
      [WebAssembly] Update InstPrinter support for EH · 0d8dfbb4
      Heejin Ahn authored
      - Updates InstPrinter to handle `catch_all`.
      - Makes `rethrow` condition an early exit from the function to make the
        rest simpler.
      - Unify label and catch counters. They don't need to be counted
        separately and this will help `delegate` instruction later.
      - Removes `LastSeenEHInst` field. This was first introduced to handle
        when there are more than one `catch` blocks per `try`, but this was
        not implemented correctly and not being used at the moment anyway.
      - Reenables all tests in cfg-stackify-eh.ll that don't deal with unwind
        destination mismatches, which will be handled in a later CL.
      
      Reviewed By: dschuff, tlively, aardappel
      
      Differential Revision: https://reviews.llvm.org/D94043
      0d8dfbb4
    • Eugene Zhulenev's avatar
      [mlir] AsyncRuntime: use LLVM ThreadPool to run async tasks · bb0e6213
      Eugene Zhulenev authored
      Revert https://reviews.llvm.org/D92368 after the dynamic library unloading was fixed in https://reviews.llvm.org/D94312
      
      Reviewed By: mehdi_amini
      
      Differential Revision: https://reviews.llvm.org/D94346
      bb0e6213
    • Heejin Ahn's avatar
      [WebAssembly] Remove exnref and br_on_exn · 52e240a0
      Heejin Ahn authored
      This removes `exnref` type and `br_on_exn` instruction. This is
      effectively NFC because most uses of these were already removed in the
      previous CLs.
      
      Reviewed By: dschuff, tlively
      
      Differential Revision: https://reviews.llvm.org/D94041
      52e240a0
    • Heejin Ahn's avatar
      [WebAssembly] Update basic EH instructions for the new spec · 9e4eadeb
      Heejin Ahn authored
      This implements basic instructions for the new spec.
      
      - Adds new versions of instructions: `catch`, `catch_all`, and `rethrow`
      - Adds support for instruction selection for the new instructions
       - `catch` needs a custom routine for the same reason `throw` needs one,
         to encode `__cpp_exception` tag symbol.
      - Updates `WebAssembly::isCatch` utility function to include `catch_all`
        and Change code that compares an instruction's opcode with `catch` to
        use that function.
      - LateEHPrepare
        - Previously in LateEHPrepare we added `catch` instruction to both
          `catchpad`s (for user catches) and `cleanuppad`s (for destructors).
          In the new version `catch` is generated from `llvm.catch` intrinsic
          in instruction selection phase, so we only need to add `catch_all`
          to the beginning of cleanup pads.
        - `catch` is generated from instruction selection, but we need to
          hoist the `catch` instruction to the beginning of every EH pad,
          because `catch` can be in the middle of the EH pad or even in a
          split BB from it after various code transformations.
        - Removes `addExceptionExtraction` function, which was used to
          generate `br_on_exn` before.
      - CFGStackfiy: Deletes `fixUnwindMismatches` function. Running this
        function on the new instruction causes crashes, and the new version
        will be added in a later CL, whose contents will be completely
        different. So deleting the whole function will make the diff easier to
        read.
      - Reenables all disabled tests in exception.ll and eh-lsda.ll and a
        single basic test in cfg-stackify-eh.ll.
      - Updates existing tests to use the new assembly format. And deletes
        `br_on_exn` instructions from the tests and FileCheck lines.
      
      Reviewed By: dschuff, tlively
      
      Differential Revision: https://reviews.llvm.org/D94040
      9e4eadeb
    • Fangrui Song's avatar
      Fix CodeGenCXX/difile_entry.cpp on Windows · 052b8fe4
      Fangrui Song authored
      052b8fe4
    • Fangrui Song's avatar
      Make -fno-pic respect -fno-direct-access-external-data · 38a716c3
      Fangrui Song authored
      D92633 added -f[no-]direct-access-external-data to supersede -m[no-]pie-copy-relocations.
      (The option works for -fpie but is a no-op for -fno-pic and -fpic.)
      
      This patch makes -fno-pic -fno-direct-access-external-data drop dso_local from
      global variable declarations. This usually causes the backend to emit a GOT
      indirection for external data access. With a GOT relocation, the subsequent
      -no-pie link will not have copy relocation even if the data symbol turns out to
      be defined by a shared object.
      
      Differential Revision: https://reviews.llvm.org/D92714
      38a716c3
    • Fangrui Song's avatar
      Add -f[no-]direct-access-external-data to supersede -mpie-copy-relocations · 1d3ebbf5
      Fangrui Song authored
      GCC r218397 "x86-64: Optimize access to globals in PIE with copy reloc" made
      -fpie code emit R_X86_64_PC32 to reference external data symbols by default.
      Clang adopted -mpie-copy-relocations D19996 as a flexible alternative.
      
      The name -mpie-copy-relocations can be improved [1] and does not capture the
      idea that this option can apply to -fno-pic and -fpic [2], so this patch
      introduces -f[no-]direct-access-external-data and makes -mpie-copy-relocations
      their aliases for compatibility.
      
      [1]
      For
      ```
      extern int var;
      int get() { return var; }
      ```
      if var is defined in another translation unit in the link unit, there is no copy
      relocation.
      
      [2]
      -fno-pic -fno-direct-access-external-data is useful to avoid copy relocations.
      https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65888
      If a shared object is linked with -Bsymbolic or --dynamic-list and exports a
      data symbol, normally the data symbol cannot be accessed by -fno-pic code
      (because by default an absolute relocation is produced which will lead to a copy
      relocation). -fno-direct-access-external-data can prevent copy relocations.
      
      -fpic -fdirect-access-external-data can avoid GOT indirection. This is like the
      undefined counterpart of -fno-semantic-interposition. However, the user should
      define var in another translation unit and link with -Bsymbolic or
      --dynamic-list, otherwise the linker will error in a -shared link. Generally
      the user has better tools for their goal but I want to mention that this
      combination is valid.
      
      On COFF, the behavior is like always -fdirect-access-external-data.
      `__declspec(dllimport)` is needed to enable indirect access.
      
      There is currently no plan to affect non-ELF behaviors or -fpic behaviors.
      
      -fno-pic -fno-direct-access-external-data will be implemented in the subsequent patch.
      
      GCC feature request https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98112
      
      Reviewed By: tmsriram
      
      Differential Revision: https://reviews.llvm.org/D92633
      1d3ebbf5