1. Jul 11, 2021
  2. Jul 10, 2021
    • Kazu Hirata's avatar
      [AFDO] Require x86_64-linux in a testcase · 8f4e5474
      Kazu Hirata authored
      This patch fixes a testcase failure by requring x86_64-linux in a
      testcase.
      8f4e5474
    • Simon Pilgrim's avatar
      [X86] Add tests from D93707 for fsub_strict(x,fneg(y)) -> fadd_strict(x,y) folds. · a328ee65
      Simon Pilgrim authored
      Also, add matching i686 coverage to strict-fadd-combines.ll and regenerate checks.
      a328ee65
    • Andrea Di Biagio's avatar
      [llvm-mca][JSON] Teach the PipelinePrinter how to deal with anonymous code regions (PR51008) · 4fe0fcd1
      Andrea Di Biagio authored
      This patch addresses the last remaining problems reported in PR51008.
      
      Previous fixes for PR51008 worked under the wrong assumption that code regions
      are always named (except maybe for the default region, which was automatically
      named "main").
      
      In reality, it is quite common for users to declare multiple anonymous regions.
      So we cannot really use the region name as the key string of a JSON object.  In
      practice, code region names are completely optional.
      
      Using "main" for the default region was also problematic because there can be
      another region with that same name.
      
      This patch fixes these issues by introducing a json::array of regions.  Each
      region has a "Name" field, which would default to the empty string for anonymous
      regions.
      
      Added a few more tests to verify that the JSON file format is still valid, and
      that multiple anonymous regions all appear in the final output.
      4fe0fcd1
    • Andrea Di Biagio's avatar
      [llvm-mca][JSON] Further refactoring of the JSON printing logic. · d919bca8
      Andrea Di Biagio authored
      This patch renames object "Resources" to "TargetInfo".
      
      Moved the getJSONTargetInfo method from class InstructionView to the
      PipelinePrinter.
      
      Removed uses of std::stringstream.
      Removed unused method View::printViewJSON().
      d919bca8
    • Sander de Smalen's avatar
      [LV] NFCI: Do cost comparison on InstructionCost directly. · 239fcda2
      Sander de Smalen authored
      Instead of performing the isMoreProfitable() operation on
      InstructionCost::CostTy the operation is performed on InstructionCost
      directly, so that it can handle the case where one of the costs is
      Invalid.
      
      This patch also changes the CostTy to be int64_t, so that the type is
      wide enough to deal with multiplications with e.g. `unsigned MaxTripCount`.
      
      Reviewed By: dmgreen
      
      Differential Revision: https://reviews.llvm.org/D105113
      239fcda2
    • Sander de Smalen's avatar
      [InstructionCost] Add saturation support. · 41b60576
      Sander de Smalen authored
      This patch makes the operations on InstructionCost saturate, so that when
      costs are accumulated they saturate to <max value>.
      
      One of the compelling reasons for wanting to have saturation support
      is because in various places, arbitrary values are used to represent
      a 'high' cost, but when accumulating the cost of some set of operations
      or a loop, overflow is not taken into account, which may lead to unexpected
      results. By defining the operations to saturate, we can express the cost
      of something 'very expensive' as InstructionCost::getMax().
      
      Reviewed By: kparzysz, dmgreen
      
      Differential Revision: https://reviews.llvm.org/D105108
      41b60576
    • Martin Storsjö's avatar
      Revert "Prepare Compiler-RT for GnuInstallDirs, matching libcxx" · 8cf7ddbd
      Martin Storsjö authored
      This reverts commit 9a9bc76c.
      
      That commit broke "ninja install" when building compiler-rt for mingw
      targets, building standalone (pointing cmake at the compiler-rt
      directory) with cmake 3.16.3 (the one shipped in ubuntu 20.04), with
      errors like this:
      
      -- Install configuration: "Release"
      CMake Error at cmake_install.cmake:44 (file):
        file cannot create directory: /include/sanitizer.  Maybe need
        administrative privileges.
      Call Stack (most recent call first):
        /home/martin/code/llvm-mingw/src/llvm-project/compiler-rt/build-i686-sanitizers/cmake_install.cmake:37 (include)
      
      FAILED: include/CMakeFiles/install-compiler-rt-headers
      cd /home/martin/code/llvm-mingw/src/llvm-project/compiler-rt/build-i686-sanitizers/include && /usr/bin/cmake -DCMAKE_INSTALL_COMPONENT="compiler-rt-headers" -P /home/martin/code/llvm-mingw/src/llvm-project/compiler-rt/build-i686-sanitizers/cmake_install.cmake
      ninja: build stopped: subcommand failed.
      8cf7ddbd
    • Amara Emerson's avatar
    • Eli Friedman's avatar
      1f40870d
    • Amara Emerson's avatar
      [GlobalISel] Add a new artifact combiner for unmerge which looks through... · 58a2cb51
      Amara Emerson authored
      [GlobalISel] Add a new artifact combiner for unmerge which looks through general artifact expressions.
      
      The original motivation for this was to implement moreElementsVector of shuffles
      on AArch64, which resulted in complex sequences of artifacts like unmerge(unmerge(concat...))
      which the combiner couldn't handle. It seemed here that the better option,
      instead of writing ever-more-complex combines, was to have a way to find
      the original "non-artifact" source registers for a given definition, walking
      through arbitrary expressions of unmerge/concat/insert. As long as the bits
      aren't extended or truncated, this is a pretty simple algorithm that avoids
      the need for lots of combines and instead jumps straight to the final result
      we want.
      
      I've only used this new technique in 2 places within tryCombineUnmerge, using it
      in more general situations resulted in infinite loops in AMDGPU. So for now
      it's used when we would otherwise fail to combine and that seems to work.
      
      In order to support looking through G_INSERTs, I also had to add it as an
      artifact in isArtifact(), which caused a whole lot of issues in tests. AMDGPU
      started infinite looping since full legalization of G_INSERT doensn't seem to
      be there. To work around this, I've temporarily added a CLI option to use the
      old behaviour so that the MIR tests will still run and terminate.
      
      Other minor changes include no longer making >128b G_MERGE/UNMERGE legal.
      We never had isel support for that anyway and it was a remnant of the legacy
      legalizer rules. However being legal prevented the combiner from checking if it
      was dead and deleting them.
      
      Differential Revision: https://reviews.llvm.org/D104355
      58a2cb51
    • Lang Hames's avatar
      [ORC] Flesh out ExecutorAddress, rename CommonOrcRuntimeTypes header. · b8e5f918
      Lang Hames authored
      Renames CommonOrcRuntimeTypes.h to ExecutorAddress.h and moves ExecutorAddress
      into the 'orc' namespace (rather than orc::shared).
      
      Also makes ExecutorAddress a class, adds an ExecutorAddrDiff type and some
      arithmetic operations on the pair (subtracting two addresses yields an addrdiff,
      adding an addrdiff and an address yields an address).
      b8e5f918
    • Vy Nguyen's avatar
      [lld-macho] Fix bug in handling unwind info from ld -r · 3822e3d5
      Vy Nguyen authored
      Two changess:
      - Drop assertions that all symbols are in GOT
      - Set allEntriesAreOmitted correctly
      
      Related bug: 50812
      
      Differential Revision: https://reviews.llvm.org/D105364
      3822e3d5
    • Thomas Lively's avatar
      [WebAssembly] Custom combines for f64x2.promote_low_f32x4 · e5220104
      Thomas Lively authored
      Replace the clang builtin function and LLVM intrinsic previously used to select
      the f64x2.promote_low_f32x4 instruction with custom combines from standard
      SelectionDAG nodes. Implement the new combines to share code with the similar
      combines for f64x2.convert_low_i32x4_{s,u}. Resolves PR50232.
      
      Differential Revision: https://reviews.llvm.org/D105675
      e5220104
    • David Blaikie's avatar
      llvm-symbolizer: Fix "start file" to work with Split DWARF · 04c203e3
      David Blaikie authored
      A followup to the feature added in
      69da27c7 that added the optional "start
      file name" to match "start line" - but this didn't work with Split DWARF
      because of the need for the decl file number resolution code to refer
      back to the skeleton unit to find its .debug_line contribution. So this
      patch adds the necessary infrastructure to track the skeleton unit
      corresponding to a split full unit for the purpose of this lookup.
      04c203e3
    • Eli Friedman's avatar
      Fix buildbot regression from 9c4baf51. · 882ee7fb
      Eli Friedman authored
      Apparently ScalarEvolution::isImpliedCond tries to truncate a pointer in
      some obscure cases. Guard the code with a check for pointers.
      882ee7fb
    • Vitaly Buka's avatar
      [scudo] Check if we use __clang_major__ >= 12 · db4c2582
      Vitaly Buka authored
      This makes sure we have support for MTE instructions.
      Later the check can be extended to support MTE on other compilers.
      
      Reviewed By: pcc
      
      Differential Revision: https://reviews.llvm.org/D105722
      db4c2582
    • Eli Friedman's avatar
      [ScalarEvolution] Strictly enforce pointer/int type rules. · 9c4baf51
      Eli Friedman authored
      Rules:
      
      1. SCEVUnknown is a pointer if and only if the LLVM IR value is a
         pointer.
      2. SCEVPtrToInt is never a pointer.
      3. If any other SCEV expression has no pointer operands, the result is
         an integer.
      4. If a SCEVAddExpr has exactly one pointer operand, the result is a
         pointer.
      5. If a SCEVAddRecExpr's first operand is a pointer, and it has no other
         pointer operands, the result is a pointer.
      6. If every operand of a SCEVMinMaxExpr is a pointer, the result is a
         pointer.
      7. Otherwise, the SCEV expression is invalid.
      
      I'm not sure how useful rule 6 is in practice.  If we exclude it, we can
      guarantee that ScalarEvolution::getPointerBase always returns a
      SCEVUnknown, which might be a helpful property. Anyway, I'll leave that
      for a followup.
      
      This is basically mop-up at this point; all the changes with significant
      functional effects have landed.  Some of the remaining changes could be
      split off, but I don't see much point.
      
      Differential Revision: https://reviews.llvm.org/D105510
      9c4baf51
    • Valery N Dmitriev's avatar
    • Derek Schuff's avatar
      WebAssembly: Update datalayout to match fp128 ABI change · ac02baab
      Derek Schuff authored
      This fix goes along with d1a96e90
      and makes the fp128 alignment match clang's long double alignment.
      
      Differential Revision: https://reviews.llvm.org/D105749
      ac02baab
    • Uday Bondhugula's avatar
      [MLIR][GPU][NFC] Fix documentation for wmma matrix load/store ops · fc01fafa
      Uday Bondhugula authored
      Fix/improve documentation for wmma load/store matrix ops. Fix some
      broken and stale sentences.
      
      Differential Revision: https://reviews.llvm.org/D105678
      fc01fafa
    • Kazu Hirata's avatar
      [AFDO] Merge function attributes after inlining · 49d66d9f
      Kazu Hirata authored
      This patch teaches the sample profile loader to merge function
      attributes after inlining functions.
      
      Without this patch, the compiler could inline a function requiring the
      512-bit vector width into its caller without merging function
      attributes, triggering a failure during instruction selection.
      
      Differential Revision: https://reviews.llvm.org/D105729
      49d66d9f
    • Kazu Hirata's avatar
      [WebAssembly] Fix warnings · 5f306feb
      Kazu Hirata authored
      5f306feb
    • Nico Weber's avatar
      [gn build] fix formatting after 9647a6f7 · c82b96c0
      Nico Weber authored
      c82b96c0
    • Fangrui Song's avatar
      1a4d1315
    • Andrea Di Biagio's avatar
      [llvm-mca] Refactor the logic that prints JSON files. · 10cb0362
      Andrea Di Biagio authored
      Moved most of the printing logic into the PipelinePrinter.
      
      This patch also fixes the JSON output when flag -instruction-tables is
      specified.
      10cb0362
    • Wouter van Oortmerssen's avatar
    • Wouter van Oortmerssen's avatar
    • Aaron En Ye Shi's avatar
      [HIP] Move std headers after device malloc/free · ccb10266
      Aaron En Ye Shi authored
      Set the device malloc and free functions as weak,
      and move the std headers after device malloc/free
      to avoid issues with std malloc/free.
      
      Fixes: SWDEV-293590
      
      Reviewed By: yaxunl
      
      Differential Revision: https://reviews.llvm.org/D105707
      ccb10266
    • Jessica Paquette's avatar
      [GlobalISel] Use GCDTy when extracting GCD ty from leftover regs in insertParts · 47aeeffc
      Jessica Paquette authored
      `LegalizerHelper::insertParts` uses `extractGCDType` on registers split into
      a desired type and a smaller leftover type. This is used to populate a list
      of registers. Each register in the list will have the same type as returned by
      `extractGCDType`.
      
      If we have
      
      - `ResultTy` = s792
      - `PartTy` = s64
      - `LeftoverTy` = s24
      
      When we call `extractGCDType`, we'll end up with two different types appended
      to the list:
      
      Part: gcd(792, 64, 24) => s8
      Leftover: gcd(792, 24, 24) => s24
      
      When this happens, we'll hit an assert while trying to build a G_MERGE_VALUES.
      
      This patch changes the code for the leftover type so that we reuse the GCD from
      the desired type.
      
      e.g.
      
      Leftover: gcd(792, 8, 24) => s8
      
      https://llvm.godbolt.org/z/137Kqxj6j
      
      Differential Revision: https://reviews.llvm.org/D105674
      47aeeffc
    • Wouter van Oortmerssen's avatar
      [WebAssembly] Added initial type checker to MC Assembler · 9647a6f7
      Wouter van Oortmerssen authored
      This to protect against non-sensical instruction sequences being assembled,
      which would either cause asserts/crashes further down, or a Wasm module being output that doesn't validate.
      
      Unlike a validator, this type checker is able to give type-errors as part of the parsing process, which makes the assembler much friendlier to be used by humans writing manual input.
      
      Because the MC system is single pass (instructions aren't even stored in MC format, they are directly output) the type checker has to be single pass as well, which means that from now on .globaltype and .functype decls must come before their use. An extra pass is added to Codegen to collect information for this purpose, since AsmPrinter is normally single pass / streaming as well, and would otherwise generate this information on the fly.
      
      A `-no-type-check` flag was added to llvm-mc (and any other tools that take asm input) that surpresses type errors, as a quick escape hatch for tests that were not intended to be type correct.
      
      This is a first version of the type checker that ignores control flow, i.e. it checks that types are correct along the linear path, but not the branch path. This will still catch most errors. Branch checking could be added in the future.
      
      Differential Revision: https://reviews.llvm.org/D104945
      9647a6f7
    • David Blaikie's avatar
      PR51018: A few more explicit conversions from SmallString to StringRef · 0562d178
      David Blaikie authored
      Follow-up to 1def2579 with a few more
      obscure cases.
      0562d178
    • John Ericson's avatar
      Prepare Compiler-RT for GnuInstallDirs, matching libcxx · 9a9bc76c
      John Ericson authored
      Instead of using `COMPILER_RT_INSTALL_PATH` through the CMake for
      complier-rt, just use it to define variables for the subdirs which
      themselves are used.
      
      This preserves compatibility, but later on we might consider getting rid
      of `COMPILER_RT_INSTALL_PATH` and just changing the defaults for the
      subdir variables directly.
      
      ---
      
      There was a seaming bug where the (non-Apple) per-target libdir was
      `${target}` not `lib/${target}`. I suspect that has to do with the docs
      on `COMPILER_RT_INSTALL_PATH` saying was the library dir when that's no
      longer true, so I just went ahead and fixed it, allowing me to define
      fewer and more sensible variables.
      
      That last part should be the only behavior changes; everything else
      should be a pure refactoring.
      
      ---
      
      D99484 is the main thrust of the `GnuInstallDirs` work. Once this lands,
      it should be feasible to follow both of these up with a simple patch for
      compiler-rt analogous to the one for libcxx.
      
      Reviewed By: phosek
      
      Differential Revision: https://reviews.llvm.org/D101497
      9a9bc76c