1. Jul 12, 2023
    • Nikita Popov's avatar
      [LSR] Convert test to opaque pointers (NFC) · 6c388e06
      Nikita Popov authored
      This regresses with opaque pointers. I'll submit a patch to recover
      the regression.
      6c388e06
    • David Stenberg's avatar
      [DWARF] Allow op-index in line number programs · fe6cddef
      David Stenberg authored
      This extends DWARFDebugLine to properly parse line number programs with
      maximum_operations_per_instruction > 1 for VLIW targets.
      
      No functions that use that parsed output to retrieve line information
      have been extended to support multiple op-indexes. This means that when
      retrieving information for an address with multiple op-indexes, e.g.
      when using llvm-addr2line, the penultimate row for that address will be
      used, which in most cases is the row for the second largest op-index.
      This will be addressed in further changes, but this patch at least
      allows us to correctly parse such line number programs, with a warning
      saying that the line number information may be incorrect (incomplete).
      
      Reviewed By: StephenTozer
      
      Differential Revision: https://reviews.llvm.org/D152536
      fe6cddef
    • Krasimir Georgiev's avatar
      Revert "IRBuilder: Fix not handling strictfp minnum/maxnum" · 593797ab
      Krasimir Georgiev authored
      This reverts commit 14c3ab94.
      
      Causes build bot failures.
      593797ab
    • pvanhout's avatar
      [AArch64] Split lowerVectorFCMP combine · af67b676
      pvanhout authored
      It's the only combine (AFAIK) that didn't use an apply function.
      There is no reason for it to mutate instructions in the matcher, so split it up.
      
      Reviewed By: aemerson, arsenm
      
      Differential Revision: https://reviews.llvm.org/D154947
      af67b676
    • Akash Banerjee's avatar
      [OpenMP] Migrate device code privatisation from Clang CodeGen to OMPIRBuilder · 227012cb
      Akash Banerjee authored
      This patch migrates the UseDevicePtr and UseDeviceAddr clause related code for handling privatisation from Clang codegen to the OMPIRBuilder
      
      Depends on D150860
      
      Reviewed By: jdoerfert
      
      Differential Revision: https://reviews.llvm.org/D152554
      227012cb
    • Ivan Kosarev's avatar
      [Codegen] Generate fast fp64-to-fp16 conversions in unsafe mode. · 15e7749e
      Ivan Kosarev authored
      Reviewed By: arsenm
      
      Differential Revision: https://reviews.llvm.org/D154528
      15e7749e
    • John Brawn's avatar
      [ARM] Correctly handle execute-only in EmitStructByval · 210f61cb
      John Brawn authored
      Currently when compiling for an execute-only target without movt then
      EmitStructByval will generate a constant pool load which isn't
      compatible with execute-only. Handle this by emitting tMOVi32imm,
      and also simplify the existing movt handling by emitting t2MOVi32imm
      or MOVi32imm.
      
      Differential Revision: https://reviews.llvm.org/D154944
      210f61cb
    • John Brawn's avatar
      [ARM] Restructure MOVi32imm expansion to not do pointless instructions · 647aff28
      John Brawn authored
      The expansion of the various MOVi32imm pseudo-instructions works by
      splitting the operand into components (either halfwords or bytes) and
      emitting instructions to combine those components into the final
      result. When the operand is an immediate with some components being
      zero this can result in pointless instructions that just add zero.
      
      Avoid this by restructuring things so that a separate function handles
      splitting the operand into components, then don't emit the component
      if it is a zero immediate. This is straightforward for movw/movt,
      where we just don't emit the movt if it's zero, but the thumb1
      expansion using mov/add/lsl is more complex, as even when we don't
      emit a given byte we still need to get the shift correct.
      
      Differential Revision: https://reviews.llvm.org/D154943
      647aff28
    • Peixin Qiao's avatar
      [InstCombine] Precommit a test · 31dda391
      Peixin Qiao authored
      This patch precommits a test for:
      https://reviews.llvm.org/D148420
      
      Reviewed By: nikic
      
      Differential Revision: https://reviews.llvm.org/D150069
      31dda391
    • Björn Schäpers's avatar
      [clang-format] Don't eat two semicolons after namespace · ce7356f0
      Björn Schäpers authored
      Remove the double check, move the comment.
      
      This changes behavior, but I think for the better. Despite the comment
      my personal opinion would be to not even gracefully handle the one
      semicolon, it shouldn't be there.
      
      Differential Revision: https://reviews.llvm.org/D138373
      ce7356f0
    • Björn Schäpers's avatar
      [clang-format] Correctly count a tab's width in a comment · 1116ed2b
      Björn Schäpers authored
      It worked only correct for a tab as the first char.
      
      Fixes https://github.com/llvm/llvm-project/issues/56769
      
      Differential Revision: https://reviews.llvm.org/D138402
      1116ed2b
    • David Stenberg's avatar
      [DWARF] Add printout for op-index · 6aa94c64
      David Stenberg authored
      This is a preparatory patch for extending DWARFDebugLine to properly
      parse line number programs with maximum_operations_per_instruction > 1
      for VLIW targets.
      
      Add some scaffolding for handling op-index in line number programs, and
      add printouts for that in the table. As this affects a lot of tests,
      this is done in a separate commit to get a cleaner review for the actual
      op-index implementation.
      
      Verbose printouts are not present in many tests, and adding op-index to
      those will require a bit more code changes, so that is done in the
      actual implementation patch.
      
      Reviewed By: StephenTozer
      
      Differential Revision: https://reviews.llvm.org/D152535
      6aa94c64
    • Nikita Popov's avatar
      [LSR] Convert some tests to opaque pointers (NFC) · 4ec3ea8a
      Nikita Popov authored
      These no longer show codegen regressions.
      4ec3ea8a
    • Nikita Popov's avatar
      [LSR] Move test to target specific directory (NFC) · bd0710c2
      Nikita Popov authored
      Uses an x86 triple.
      bd0710c2
    • Nikita Popov's avatar
      [SCEVExpander] Fix GEP IV inc reuse logic for opaque pointers · d69033d2
      Nikita Popov authored
      Instead of checking the pointer type, check the element type of
      the GEP.
      
      Previously we ended up reusing GEP increments that were not in
      expanded form, thus not respecting LSRs choice of representation.
      
      The change in 2011-10-06-ReusePhi.ll recovers a regression that
      appeared when converting that test to opaque pointers.
      
      Changes in various Thumb tests now compute the step outside the
      loop instead of using add.w inside the loop, which is LSR's
      preferred representation for this target.
      d69033d2
    • Adrian Kuegel's avatar
      [mlir] Apply ClangTidy fixes · 7724c4b5
      Adrian Kuegel authored
      The get() call is redundant.
      7724c4b5
    • Aleksandr Popov's avatar
      [IRCE] Implement runtime overflow check for computed range's end · cdcefd2f
      Aleksandr Popov authored
      Here is activated check elimination which was parsed previously in
      https://reviews.llvm.org/D154069
      
      * Added runtime check that computed range's boundary doesn't overflow in
      terms of range type.
      
      * From the statement INT_MIN <= END <= INT_MAX is inferred check:
      isNonNegative(INT_MAX - END) * isNonNegative(END - INT_MIN).
      
      * If overflow happens, check will return 0 and the safe interval will be
      empty.
      
      Reviewed By: skatkov
      
      Differential Revision: https://reviews.llvm.org/D154188
      cdcefd2f
    • Juan Manuel MARTINEZ CAAMAÑO's avatar
      [NFC][AMDGPULowerModuleLDSPass] Fix buildbot santizier failed to compile · 367b1f28
      Juan Manuel MARTINEZ CAAMAÑO authored
      It seems that the sanitizer-x86_64-linux-android wasn't able to deduce
      the template argument:
      
        AMDGPULowerModuleLDSPass.cpp:1192:53: error: no viable constructor or
        deduction guide for deduction of template arguments of 'vector'
              auto TableLookupVariablesOrdered = sortByName(std::vector(
      
      This patch makes the template argument explicit.
      367b1f28
    • Alexander Shaposhnikov's avatar
      [MLIR][IR] Rewrite OperationVerifier using worklist · 7689179a
      Alexander Shaposhnikov authored
      This diff switches OperationVerifier to using a worklist
      rather than recursion. The exception is our handling of isolated regions,
      it can still contain recursive calls, however, the parallel processing
      of these regions is preserved. This fixes the crash of the "verifier"
      on the input from https://github.com/llvm/circt/issues/5316
      (but the IR printer would still crash with stack overflow).
      
      Test plan: ninja check-mlir check-all
      
      Differential revision: https://reviews.llvm.org/D154925
      7689179a
    • Martin Storsjö's avatar
      [clangd] Fix builds with LLVM_LINK_LLVM_DYLIB=ON · a20d57e8
      Martin Storsjö authored
      This was broken by 56ac9d46.
      a20d57e8
    • David Green's avatar
      [AArch64] Fix order of isReg and isDef checks in INSvi64 peephole. · 86780f49
      David Green authored
      The isDef asserts that the operand isReg, so the checks need to happen in the
      other order.
      86780f49
    • Piotr Sobczak's avatar
      [InstCombine][NFC] Rename check run label · 608cf17b
      Piotr Sobczak authored
      The existing check run label "DEFAULT" may clash with
      the label from switch "DEFAULT", so renaming it for clarity.
      
      Differential Revision: https://reviews.llvm.org/D154825
      608cf17b
    • Adrian Kuegel's avatar
      a69b2e3d
    • Adrian Kuegel's avatar
      [clang][Bazel] Add missing dependency. · 93e7ef59
      Adrian Kuegel authored
      93e7ef59
    • Nikita Popov's avatar
      7a21efce
    • Guray Ozen's avatar
      [mlir][nvvm] fix potential bug (NFC) · b6bf775f
      Guray Ozen authored
      Reviewed By: nicolasvasilache
      
      Differential Revision: https://reviews.llvm.org/D155048
      b6bf775f
    • Dmitry Polukhin's avatar
      [clang][clangd] Don't crash/assert on -gsplit-dwarf=single without output · 6d9fcc2a
      Dmitry Polukhin authored
      The crash happens in clang::driver::tools::SplitDebugName when Output is
      InputInfo::Nothing. It doesn't happen with standalone clang driver because
      output is created in Driver::BuildJobsForActionNoCache.
      
      Example backtrace:
      ```
      * thread #1, name = 'clangd', stop reason = hit program assert
        * frame #0: 0x00007ffff5c4eacf libc.so.6`raise + 271
          frame #1: 0x00007ffff5c21ea5 libc.so.6`abort + 295
          frame #2: 0x00007ffff5c21d79 libc.so.6`__assert_fail_base.cold.0 + 15
          frame #3: 0x00007ffff5c47426 libc.so.6`__assert_fail + 70
          frame #4: 0x000055555dc0923c clangd`clang::driver::InputInfo::getFilename(this=0x00007fffffff9398) const at InputInfo.h:84:5
          frame #5: 0x000055555dcd0d8d clangd`clang::driver::tools::SplitDebugName(JA=0x000055555f6c6a50, Args=0x000055555f6d0b80, Input=0x00007fffffff9678, Output=0x00007fffffff9398) at CommonArgs.cpp:1275:40
          frame #6: 0x000055555dc955a5 clangd`clang::driver::tools::Clang::ConstructJob(this=0x000055555f6c69d0, C=0x000055555f6c64a0, JA=0x000055555f6c6a50, Output=0x00007fffffff9398, Inputs=0x00007fffffff9668, Args=0x000055555f6d0b80, LinkingOutput=0x0000000000000000) const at Clang.cpp:5690:33
          frame #7: 0x000055555dbf6b54 clangd`clang::driver::Driver::BuildJobsForActionNoCache(this=0x00007fffffffb5e0, C=0x000055555f6c64a0, A=0x000055555f6c6a50, TC=0x000055555f6c4be0, BoundArch=(Data = 0x0000000000000000, Length = 0), AtTopLevel=true, MultipleArchs=false, LinkingOutput=0x0000000000000000, CachedResults=size=1, TargetDeviceOffloadKind=OFK_None) const at Driver.cpp:5618:10
          frame #8: 0x000055555dbf4ef0 clangd`clang::driver::Driver::BuildJobsForAction(this=0x00007fffffffb5e0, C=0x000055555f6c64a0, A=0x000055555f6c6a50, TC=0x000055555f6c4be0, BoundArch=(Data = 0x0000000000000000, Length = 0), AtTopLevel=true, MultipleArchs=false, LinkingOutput=0x0000000000000000, CachedResults=size=1, TargetDeviceOffloadKind=OFK_None) const at Driver.cpp:5306:26
          frame #9: 0x000055555dbeb590 clangd`clang::driver::Driver::BuildJobs(this=0x00007fffffffb5e0, C=0x000055555f6c64a0) const at Driver.cpp:4844:5
          frame #10: 0x000055555dbe6b0f clangd`clang::driver::Driver::BuildCompilation(this=0x00007fffffffb5e0, ArgList=ArrayRef<const char *> @ 0x00007fffffffb268) at Driver.cpp:1496:3
          frame #11: 0x000055555b0cc0d9 clangd`clang::createInvocation(ArgList=ArrayRef<const char *> @ 0x00007fffffffbb38, Opts=CreateInvocationOptions @ 0x00007fffffffbb90) at CreateInvocationFromCommandLine.cpp:53:52
          frame #12: 0x000055555b378e7b clangd`clang::clangd::buildCompilerInvocation(Inputs=0x00007fffffffca58, D=0x00007fffffffc158, CC1Args=size=0) at Compiler.cpp:116:44
          frame #13: 0x000055555895a6c8 clangd`clang::clangd::(anonymous namespace)::Checker::buildInvocation(this=0x00007fffffffc760, TFS=0x00007fffffffe570, Contents= Has Value=false ) at Check.cpp:212:9
          frame #14: 0x0000555558959cec clangd`clang::clangd::check(File=(Data = "build/test.cpp", Length = 64), TFS=0x00007fffffffe570, Opts=0x00007fffffffe600) at Check.cpp:486:34
          frame #15: 0x000055555892164a clangd`main(argc=4, argv=0x00007fffffffecd8) at ClangdMain.cpp:993:12
          frame #16: 0x00007ffff5c3ad85 libc.so.6`__libc_start_main + 229
          frame #17: 0x00005555585bbe9e clangd`_start + 46
      ```
      
      Test Plan: ninja ClangDriverTests && tools/clang/unittests/Driver/ClangDriverTests
      
      Differential Revision: https://reviews.llvm.org/D154602
      6d9fcc2a
    • Nikita Popov's avatar
      cfa92758
    • Nikita Popov's avatar
      [LSR] Regenerate test checks (NFC) · 7a787561
      Nikita Popov authored
      7a787561
    • Dominic Chen's avatar
      [libc][math] Fix floating-point test support on x86_64 Apple machines · 50414422
      Dominic Chen authored
      Provide platform-specific x87 FPU definitions and operations
      
      Differential Revision: https://reviews.llvm.org/D153823
      50414422
    • Juan Manuel MARTINEZ CAAMAÑO's avatar
      Reland "[NFC][AMDGPULowerModuleLDSPass] Factorize repetead sort code" · 3a75551e
      Juan Manuel MARTINEZ CAAMAÑO authored
      Fixed compilation error and reudndant copy warning
      
      Differential Revision: https://reviews.llvm.org/D154977
      3a75551e
    • Jay Foad's avatar
      [DAG] Use legal shift amount type in DAGTypeLegalizer::JoinIntegers · f7684d85
      Jay Foad authored
      Documentation for TargetLowering::getShiftAmountTy says that LegalTypes
      should generally be true during type legalization, so this patch does
      that.
      
      On AMDGPU the effect is that we use i32 (a sane type) instead of i64
      (pointer sized type) for more shift amounts, which in turn allows more
      formation of rotates and funnel shifts pre-legalization.
      
      Differential Revision: https://reviews.llvm.org/D154960
      f7684d85
    • LLVM GN Syncbot's avatar
      [gn build] Port da61c865 · 49364503
      LLVM GN Syncbot authored
      49364503
    • Sameer Sahasrabuddhe's avatar
      [RFC] Introduce convergence control intrinsics · da61c865
      Sameer Sahasrabuddhe authored
      This is a reboot of the original design and implementation by
      Nicolai Haehnle <nicolai.haehnle@amd.com>:
      https://reviews.llvm.org/D85603
      
      This change also obsoletes an earlier attempt at restarting the work on
      convergence tokens:
      https://reviews.llvm.org/D104504
      
      Changes relative to D85603:
      
       1. Clean up the definition of a "convergent operation", a convergent
          call and convergent function.
       2. Clean up the relationship between dynamic instances, sets of threads and
          convergence tokens.
       3. Redistribute the formal rules into the definitions of the convergence
          intrinsics.
       4. Expand on the semantics of entering a function from outside LLVM,
          and the environment-defined outcome of the entry intrinsic.
       5. Replace the term "cycle" with "closed path". The static rules are defined
          in terms of closed paths, and then a relation is established with cycles.
       6. Specify that if a function contains a controlled convergent operation, then
          all convergent operations in that function must be controlled.
       7. Describe an optional procedure to infer tokens for uncontrolled convergent
          operations.
       8. Introduce controlled maximal convergence-before and controlled m-converged
          property as an update to the original properties in UniformityAnalysis.
       9. Additional constraint that a cycle heart can only occur in the header of a
          reducible cycle (natural loop).
      
      Reviewed By: nhaehnle
      
      Differential Revision: https://reviews.llvm.org/D147116
      da61c865
    • Tuan Chuong Goh's avatar
      [AArch64] Fix cost modelling for SVE Min/Max Intrinsics · e36dd3ea
      Tuan Chuong Goh authored
      Add more legal types for SMIN, SMAX, UMIN, UMAX in cost modelling for AArch64
      
      Differential Revision: https://reviews.llvm.org/D154622
      e36dd3ea
    • Marius Brehler's avatar
      [mlir][emitc] Add div, mul and rem operators · a2426eb6
      Marius Brehler authored
      This adds operations for binary multiplicative arithmetic operators to
      EmitC. The input and output arguments for the remainder operator are
      restricted to index (emitted as size_t), integers and the EmitC opaque
      types (as the operator can be overloaded for a custom type). The
      multiplication and division operator further support floating point
      numbers.
      
      Reviewed By: jpienaar
      
      Differential Revision: https://reviews.llvm.org/D154846
      a2426eb6
    • Andrzej Warzynski's avatar
      [mlir][vector] Refine diagnostic messages · 60c9d299
      Andrzej Warzynski authored
      Clarify a few diagnostics so that they are more consistent with the
      corresponding condition. For example:
      
      ```
        if (positionAttr.size() >
            static_cast<unsigned>(getSourceVectorType().getRank()))
      ```
      
      should lead to ("no greater than"):
      
      ```
          return emitOpError(
              "expected position attribute of rank no greater than vector rank");
      
      ```
      
      as opposed to ("smaller"):
      
      ```
          return emitOpError(
              "expected position attribute of rank smaller than vector rank");
      ```
      
      Differential Revision: https://reviews.llvm.org/D154998
      60c9d299
    • LLVM GN Syncbot's avatar
      [gn build] Port 7d935d08 · 7b7d3c86
      LLVM GN Syncbot authored
      7b7d3c86
    • Sam McCall's avatar
      [dataflow] improve determinism of generated SAT system · 7d935d08
      Sam McCall authored
      Fixes two places where we relied on map iteration order when processing
      values, which leaked nondeterminism into the generated SAT formulas.
      Adds a couple of tests that directly assert that the SAT system is
      equivalent on each run.
      
      It's desirable that the formulas are deterministic based on the input:
      
       - our SAT solver is naive and perfermance is sensitive to even simple
         semantics-preserving transformations like A|B to B|A.
         (e.g. it's likely to choose a different variable to split on).
         Timeout failures are bad, but *flaky* ones are terrible to debug.
       - similarly when debugging, it's important to have a consistent
         understanding of what e.g. "V23" means across runs.
      
      ---
      
      Both changes in this patch were isolated from a nullability analysis of
      real-world code which was extremely slow, spending ages in the SAT
      solver at "random" points that varied on each run.
      I've included a reduced version of the code as a regression test.
      
      One of the changes shows up directly as flow-condition nondeterminism
      with a no-op analysis, the other relied on bits of the nullability
      analysis but I found a synthetic example to show the problem.
      
      Differential Revision: https://reviews.llvm.org/D154948
      7d935d08
    • Corentin Jabot's avatar
      [Clang] Correctly handle $, @, and ` when represented as UCN · 304e9746
      Corentin Jabot authored
      This covers
       * P2558R2 (C++, wg21.link/P2558)
       * N2701 (C, https://www.open-std.org/jtc1/sc22/wg14/www/docs/n2701.htm)
       * N3124 (C, https://www.open-std.org/jtc1/sc22/wg14/www/docs/n3124.pdf)
      
      This patch
       * Disallow representing $ as a UCN in all language mode, which did not
         properly work (see GH62133), and which in made ill-formed in
         C++ and C by P2558 and N3124 respectively
       * Allow a UCN for any character in C2X, in string and character
         literals
      
      Fixes #62133
      
      Reviewed By: #clang-language-wg, tahonermann
      
      Differential Revision: https://reviews.llvm.org/D153621
      304e9746