1. Nov 12, 2021
    • Salman Javed's avatar
      [clang-tidy] Re-apply 00769572 with fix for failing ASan tests · 9089a1df
      Salman Javed authored
      Re-apply "Fix lint warning in ClangTidyDiagnosticConsumer.cpp (NFC)"
      with fixes for the failing ASan tests.
      
      This reverts commit 74add1b6.
      9089a1df
    • Gabor Marton's avatar
      [analyzer][solver] Remove reference to RangedConstraintManager · 01c9700a
      Gabor Marton authored
      We no longer need a reference to RangedConstraintManager, we call top
      level `State->assume` functions.
      
      Differential Revision: https://reviews.llvm.org/D113261
      01c9700a
    • Gabor Marton's avatar
      [analyzer][solver] Iterate to a fixpoint during symbol simplification with constants · 806329da
      Gabor Marton authored
      D103314 introduced symbol simplification when a new constant constraint is
      added. Currently, we simplify existing equivalence classes by iterating over
      all existing members of them and trying to simplify each member symbol with
      simplifySVal.
      
      At the end of such a simplification round we may end up introducing a
      new constant constraint. Example:
      ```
        if (a + b + c != d)
          return;
        if (c + b != 0)
          return;
        // Simplification starts here.
        if (b != 0)
          return;
      ```
      The `c == 0` constraint is the result of the first simplification iteration.
      However, we could do another round of simplification to reach the conclusion
      that `a == d`. Generally, we could do as many new iterations until we reach a
      fixpoint.
      
      We can reach to a fixpoint by recursively calling `State->assume` on the
      newly simplified symbol. By calling `State->assume` we re-ignite the
      whole assume machinery (along e.g with adjustment handling).
      
      Why should we do this? By reaching a fixpoint in simplification we are capable
      of discovering infeasible states at the moment of the introduction of the
      **first** constant constraint.
      Let's modify the previous example just a bit, and consider what happens without
      the fixpoint iteration.
      ```
        if (a + b + c != d)
          return;
        if (c + b != 0)
          return;
        // Adding a new constraint.
        if (a == d)
          return;
        // This brings in a contradiction.
        if (b != 0)
          return;
        clang_analyzer_warnIfReached(); // This produces a warning.
                    // The path is already infeasible...
        if (c == 0) // ...but we realize that only when we evaluate `c == 0`.
          return;
      ```
      What happens currently, without the fixpoint iteration? As the inline comments
      suggest, without the fixpoint iteration we are doomed to realize that we are on
      an infeasible path only after we are already walking on that. With fixpoint
      iteration we can detect that before stepping on that. With fixpoint iteration,
      the `clang_analyzer_warnIfReached` does not warn in the above example b/c
      during the evaluation of `b == 0` we realize the contradiction. The engine and
      the checkers do rely on that either `assume(Cond)` or `assume(!Cond)` should be
      feasible. This is in fact assured by the so called expensive checks
      (LLVM_ENABLE_EXPENSIVE_CHECKS). The StdLibraryFuncionsChecker is notably one of
      the checkers that has a very similar assertion.
      
      Before this patch, we simply added the simplified symbol to the equivalence
      class. In this patch, after we have added the simplified symbol, we remove the
      old (more complex) symbol from the members of the equivalence class
      (`ClassMembers`). Removing the old symbol is beneficial because during the next
      iteration of the simplification we don't have to consider again the old symbol.
      
      Contrary to how we handle `ClassMembers`, we don't remove the old Sym->Class
      relation from the `ClassMap`. This is important for two reasons: The
      constraints of the old symbol can still be found via it's equivalence class
      that it used to be the member of (1). We can spare one removal and thus one
      additional tree in the forest of `ClassMap` (2).
      
      Performance and complexity: Let us assume that in a State we have N non-trivial
      equivalence classes and that all constraints and disequality info is related to
      non-trivial classes. In the worst case, we can simplify only one symbol of one
      class in each iteration. The number of symbols in one class cannot grow b/c we
      replace the old symbol with the simplified one. Also, the number of the
      equivalence classes can decrease only, b/c the algorithm does a merge operation
      optionally. We need N iterations in this case to reach the fixpoint. Thus, the
      steps needed to be done in the worst case is proportional to `N*N`. Empirical
      results (attached) show that there is some hardly noticeable run-time and peak
      memory discrepancy compared to the baseline. In my opinion, these differences
      could be the result of measurement error.
      This worst case scenario can be extended to that cases when we have trivial
      classes in the constraints and in the disequality map are transforming to such
      a State where there are only non-trivial classes, b/c the algorithm does merge
      operations. A merge operation on two trivial classes results in one non-trivial
      class.
      
      Differential Revision: https://reviews.llvm.org/D106823
      806329da
    • Neubauer, Sebastian's avatar
      [AMDGPU][NFC] Fix typos · d1f45ed5
      Neubauer, Sebastian authored
      Differential Revision: https://reviews.llvm.org/D113672
      d1f45ed5
    • Florian Hahn's avatar
      [SCEV] Add tests where guards limit both %n and (zext %n). · 5dfe60d1
      Florian Hahn authored
      Suggested in D113577.
      5dfe60d1
    • Kiran Chandramohan's avatar
      [Flang] Add type conversion for FIR integer kind · aa26119b
      Kiran Chandramohan authored
      Convert fir.int<kind> to their llvm equivalent type
      
      This patch is part of the upstreaming effort from fir-dev branch.
      
      Reviewed By: clementval, awarzynski
      
      Differential Revision: https://reviews.llvm.org/D113660
      
      
      
      Co-authored-by: default avatarEric Schweitz <eschweitz@nvidia.com>
      aa26119b
    • Adrian Kuegel's avatar
      Revert "Implement target_clones multiversioning" · bb493460
      Adrian Kuegel authored
      This reverts commit 9deab60a.
      There is a possibly unintended semantic change.
      bb493460
    • Salman Javed's avatar
      Re-land commit 735e4332 after fixing buildbot issue · 379935e5
      Salman Javed authored
      This reverts commit d73e27d9.
      379935e5
    • Kiran Chandramohan's avatar
      [Flang] Add type conversion for FIR heap type · 2b247941
      Kiran Chandramohan authored
      Convert fir.heap type to its llvm equivalent type (llvm.ptr)
      
      This patch is part of the upstreaming effort from fir-dev branch.
      
      Reviewed By: clementval
      
      Differential Revision: https://reviews.llvm.org/D113670
      
      
      
      Co-authored-by: default avatarEric Schweitz <eschweitz@nvidia.com>
      Co-authored-by: default avatarJean Perier <jperier@nvidia.com>
      2b247941
    • Salman Javed's avatar
      Revert "Make minor fixes to docs based on post-commit review of commit 5de69e16" · d73e27d9
      Salman Javed authored
      Sphinx buildbot failing.
      This reverts commit 735e4332.
      d73e27d9
    • Florian Hahn's avatar
      [DSE] Add test case with multiple inbounds stores, followed by OOB. · 9c00afe9
      Florian Hahn authored
      This patch extends the existing out-of-bounds store tests with a case
      with a bigger object and multiple inbounds stores, followed by an OOB
      store. The OOB store is not used to remove the inbounds stores in this
      case at the moment.
      9c00afe9
    • Salman Javed's avatar
      Make minor fixes to docs based on post-commit review of commit 5de69e16 · 735e4332
      Salman Javed authored
      - Jaro–Winkler and Sørensen–Dice should use en-dashes not regular
        dashes. In reStructuredText this is typed as `--`.
      - Letters at the beginning of a sentence should be capitalized.
      735e4332
    • Jean Perier's avatar
      1fda7baf
    • Jean Perier's avatar
      [flang] Fix vector cshift runtime with non zero lower bounds · 6544d9a4
      Jean Perier authored
      The source index should not be compared to zero after applying the
      shift with the modulo, it must be compared to the lower bound.
      Otherwise, the extent is not added in case it should and the computed
      source index may be less than the lower bound, causing invalid results.
      
      Differential Revision: https://reviews.llvm.org/D113659
      6544d9a4
    • Vitaly Buka's avatar
      64d44208
    • Simon Moll's avatar
      [VE] Disable incompatible compiler-rt tests · 496e7f33
      Simon Moll authored
      Some compiler-rt tests are inherently incompatible with VE because..
      
      * No consistent denormal support on VE. We skip denormal fp inputs in builtin tests.
      * `madvise` unsupported on VE.
      * Instruction alignment requirements.
      
      Reviewed By: phosek
      
      Differential Revision: https://reviews.llvm.org/D113093
      496e7f33
    • Mehdi Amini's avatar
    • Simon Moll's avatar
      [VE][NFCi] Remove unused tablegen parameters · 751aa6c2
      Simon Moll authored
      TableGen has started warning about unused template parameters in the isel patterns.  Remove those.
      
      Reviewed By: kaz7
      
      Differential Revision: https://reviews.llvm.org/D113675
      751aa6c2
    • Markus Lavin's avatar
      Fix minor deficiency in machine-sink. · 4e94e25c
      Markus Lavin authored
      Register uses that are MRI->isConstantPhysReg() should not inhibit
      sinking transformation.
      
      Reviewed By: StephenTozer
      
      Differential Revision: https://reviews.llvm.org/D111531
      4e94e25c
    • Stella Laurenzo's avatar
      [mlir] Add MLIR-C dylib. · c2651701
      Stella Laurenzo authored
      Per discussion on discord and various feature requests across bindings (Haskell and Rust bindings authors have asked me directly), we should be building a link-ready MLIR-C dylib which exports the C API and can be used without linking to anything else.
      
      This patch:
      
      * Adds a new MLIR-C aggregate shared library (libMLIR-C.so), which is similar in name and function to libLLVM-C.so.
      * It is guarded by the new CMake option MLIR_BUILD_MLIR_C_DYLIB, which has a similar purpose/name to the LLVM_BUILD_LLVM_C_DYLIB option.
      * On all platforms, this will work with both static, BUILD_SHARED_LIBS, and libMLIR builds, if supported:
        * In static builds: libMLIR-C.so will export the CAPI symbols and statically link all dependencies into itself.
        * In BUILD_SHARED_LIBS: libMLIR-C.so will export the CAPI symbols and have dynamic dependencies on implementation shared libraries.
        * In libMLIR.so mode: same as static. libMLIR.so was not finished for actual linking use within the project. An eventua...
      c2651701
    • Kazu Hirata's avatar
    • David Blaikie's avatar
      DebugInfo/Printing: Improve name of policy for including types for template arguments · 65120988
      David Blaikie authored
      Feedback from Richard Smith that the policy should be named closer to
      the context its used in.
      65120988
    • Serge Pavlov's avatar
      [X86] Preserve FPSW when popping x87 stack · 3057e850
      Serge Pavlov authored
      When compiler converts x87 operations to stack model, it may insert
      instructions that pop top stack element. To do it the compiler inserts
      instruction FSTP right after the instruction that calculates value on
      the stack. It can break the code that uses FPSW set by the last
      instruction. For example, an instruction FXAM is usually followed by
      FNSTSW, but FSTP is inserted after FXAM. As FSTP leaves condition code
      in FPSW undefined, the compiler produces incorrect code.
      
      With this change FSTP in inserted after the FPSW consumer if the last
      instruction sets FPSW.
      
      Differential Revision: https://reviews.llvm.org/D113335
      3057e850
    • Kazu Hirata's avatar
      Revert "[lld-macho] Fix symbol relocs handling for compact unwind's functionAddress" · 835135a8
      Kazu Hirata authored
      This reverts commit e941fe50.
      
      The commit in question causes:
      
        lld/MachO/InputFiles.cpp:916:13: error: use of undeclared identifier
        'it'
      835135a8
    • Jez Ng's avatar
      [lld-macho] Fix symbol relocs handling for compact unwind's functionAddress · e941fe50
      Jez Ng authored
      Clang seems to emit all functionAddress relocs as section relocs, but
      `ld -r` can turn those relocs into symbol ones. It turns out that we
      weren't handling that case correctly when the symbol was a weak def
      whose definition did not prevail.
      
      Reviewed By: #lld-macho, oontvoo
      
      Differential Revision: https://reviews.llvm.org/D113702
      e941fe50
    • Petr Hosek's avatar
      [Fuchsia][CMake] Don't set libcxxabi and libunwind variables on Windows · 8df26e7b
      Petr Hosek authored
      We don't build libcxxabi and libunwind for Windows so don't set the
      corresponding variables to avoid configuration errors.
      
      Differential Revision: https://reviews.llvm.org/D113729
      8df26e7b
    • Mogball's avatar
      [mlir][ods] Fix DenseSet ambiguous reference · 0ecd72ea
      Mogball authored
      0ecd72ea
    • Luís Ferreira's avatar
      [DebugInfo] run clang-format on some unformatted files · 665b4138
      Luís Ferreira authored
      This trivial patch runs clang-format on some unformatted files before
      doing logic changes and prevent hard to review diffs.
      
      Differential Revision: https://reviews.llvm.org/D113572
      665b4138
    • Arthur Eubanks's avatar
      [llvm-reduce] Fix build after D113537 · 87687b4f
      Arthur Eubanks authored
      Forgot to amend D113537 with these changes before committing.
      87687b4f
    • Arthur Eubanks's avatar
      [llvm-reduce] Count chunks by running a preliminary reduction · 6f288bd7
      Arthur Eubanks authored
      Having a separate counting method runs the risk of a mismatch between
      the actual reduction method and the counting method.
      
      Instead, create an Oracle that always returns true for shouldKeep(), run
      the reduction, and count how many times shouldKeep() was called. The
      module should not be modified if shouldKeep() always returns true.
      
      Reviewed By: Meinersbur
      
      Differential Revision: https://reviews.llvm.org/D113537
      6f288bd7
    • Arthur Eubanks's avatar
      [llvm-reduce] Skip replacing metadata and callee operands · be0b47d5
      Arthur Eubanks authored
      Metadata operands tend to require special conditions, especially on dbg
      intrinsics. We also don't have a zero value for metadata.
      
      Replacing callee operands is a little weird, since calling undef/null
      doesn't make sense. It also causes tons of invalid reductions when
      reducing calls to intrinsics since only arguments to intrinsics can be
      of the metadata type.
      
      Reviewed By: Meinersbur
      
      Differential Revision: https://reviews.llvm.org/D113532
      be0b47d5
    • Arthur Eubanks's avatar
      [gn build] Fix Android compiler-rt targets · 463ee15e
      Arthur Eubanks authored
      If a sysroot was specified, it would take precedence over the Android
      NDK sysroot since it would appear after in the command line.
      
      Also only build runtimes for enabled target arches. Many places have
      copied this around so create and use supported_android_toolchains.
      
      Reviewed By: pcc
      
      Differential Revision: https://reviews.llvm.org/D113606
      463ee15e
    • Mehdi Amini's avatar
      Revert "[mlir] Allow out-of-tree python building from installed MLIR." · 1a6c26d1
      Mehdi Amini authored
      This reverts commit c7be8b75.
      
      Build is broken (multiple buildbots)
      1a6c26d1
    • LLVM GN Syncbot's avatar
      [gn build] Port c15f930e · 72e94776
      LLVM GN Syncbot authored
      72e94776
    • Michael Kruse's avatar
      [llvm-reduce] Introduce operands-skip pass. · c15f930e
      Michael Kruse authored
      Add a new "operands-skip" pass whose goal is to remove instructions in the middle of dependency chains. For instance:
      ```
        %baseptr = alloca i32
        %arrayidx = getelementptr i32, i32* %baseptr, i32 %idxprom
        store i32 42, i32* %arrayidx
      ```
      might be reducible to
      ```
        %baseptr = alloca i32
        %arrayidx = getelementptr ...  ; now dead, together with the computation of %idxprom
        store i32 42, i32* %baseptr
      ```
      Other passes would either replace `%baseptr` with undef (operands, instructions) or move it to become a function argument (operands-to-args), both of which might fail the interestingness check.
      
      In principle the implementation allows operand replacement with any value or instruction in the function that passes the filter constraints (same type, dominance, "more reduced"), but is limited in this patch to values that are directly or indirectly used to compute the current operand value, motivated by the example above. Additionally, function arguments are added...
      c15f930e
    • Stella Laurenzo's avatar
      [mlir] Allow out-of-tree python building from installed MLIR. · c7be8b75
      Stella Laurenzo authored
      * Depends on D111504, which provides the boilerplate for building aggregate shared libraries from installed MLIR.
      * Adds a full-fledged Python example dialect and tests to the Standalone example (need to do a bit of tweaking in the top level CMake and lit tests to adapt better to if not building with Python enabled).
      * Rips out remnants of custom extension building in favor of `pybind11_add_module` which does the right thing.
      * Makes python and extension sources installable (outputs to src/python/${name} in the install tree): Both Python and C++ extension sources get installed as downstreams need all of this in order to build a derived version of the API.
      * Exports sources targets (with our properties that make everything work) by converting them to INTERFACE libraries (which have export support), as recommended for the forseeable future by CMake devs. Renames custom properties to start with lower-case letter, as also recommended/required (groan).
      * Adds a ROOT_DIR argument to `declare_mlir_python_extension` since now all C++ sources for an extension must be under the same directory (to line up at install time).
      * Need to validate against a downstream or two and adjust, prior to submitting.
      
      Downstreams will need to adapt by:
      
      * Remove absolute paths from any SOURCES for `declare_mlir_python_extension` (I believe all downstreams are just using `${CMAKE_CURRENT_SOURCE_DIR}` here, which can just be ommitted). May need to set `ROOT_DIR` if not relative to the current source directory.
      * To allow further downstreams to install/build, will need to make sure that all C++ extension headers are also listed under SOURCES for `declare_mlir_python_extension`.
      
      Reviewed By: stephenneuendorffer, mikeurbach
      
      Differential Revision: https://reviews.llvm.org/D111513
      c7be8b75
    • Mogball's avatar
      [mlir][ods] Escape attribute summaries · e1d6f29a
      Mogball authored
      e1d6f29a
    • Phoebe Wang's avatar
      [X86][FP16] Avoid to generate VZEXT_MOVL with i16 · 74b979ab
      Phoebe Wang authored
      This fixes the crash due to lacking VZEXT_MOVL support with i16.
      
      Reviewed By: LuoYuanke, RKSimon
      
      Differential Revision: https://reviews.llvm.org/D113661
      74b979ab
    • Michael Kruse's avatar
      Revert "[llvm-reduce] Introduce operands-skip pass." · ed7b3715
      Michael Kruse authored
      This reverts commit fa4210a9.
      
      It causes compile failures, presumably because conflicting with another
      patch landed after I checked locally.
      ed7b3715
    • Matthias Springer's avatar
      [mlir][linalg][bufferize] Decouple ComprehensiveBufferize from Linalg · d1c8df87
      Matthias Springer authored
      The remaining dialects will be decoupled from ComprehensiveBufferize in separate commits.
      
      Differential Revision: https://reviews.llvm.org/D113459
      d1c8df87