1. Apr 24, 2023
    • Joshua Cao's avatar
      [SCEV] Add trip multiple tests · da36d1f0
      Joshua Cao authored
      da36d1f0
    • Joshua Cao's avatar
      [SCEV] Add ranges tests · fd77fab0
      Joshua Cao authored
      fd77fab0
    • WANG Xuerui's avatar
      [Clang][Driver] Handle LoongArch multiarch tuples · 61fee67c
      WANG Xuerui authored
      This follows v1.00 of the [[ https://loongson.github.io/LoongArch-Documentation/LoongArch-toolchain-conventions-EN.html | LoongArch Toolchain Conventions ]],
      but notably with [[ https://github.com/loongson/LoongArch-Documentation/pull/80 | this patch ]]
      applied (a proper version bump to v2.00 was not done, so it is
      indistinguishable from the "original" but now incompatible v1.00
      otherwise).
      
      Only `loongarch64` is implemented in `Linux::getMultiarchTriple`
      because support for LA32 and ILP32* ABIs are incomplete right now.
      
      The Debian sysroot layout is based on Han Gao's recent porting effort,
      specifically the ghcr.io/rabenda/beige:loong64-v23-preview-20230330
      container image.
      
      Reviewed By: SixWeining
      
      Differential Revision: https://reviews.llvm.org/D142688
      61fee67c
    • Jean Perier's avatar
      [flang] Turn on use-desc-for-alloc by default · ffe4029d
      Jean Perier authored
      Currently, local allocatables and contiguous/scalar pointers (and some
      other conditions) are lowered to a set of independent variables in FIR
      (one for the address, one for each bound and one for character length).
      The intention was to help LLVM get rids of descriptors. But LLVM knows
      how to do that anyway in those cases:
      
      ```
      subroutine foo(x)
       real, target :: x(100)
       real, pointer, contiguous :: p(:)
       p => x
       call bar(p(50))
      end subroutine
      ```
      
      The output fir the option on or off is the same after llvm opt -O1,
      there is no descriptor anymore, the indirection is removed.
      
      ```
      define void @foo_(ptr %0) local_unnamed_addr {
        %2 = getelementptr [100 x float], ptr %0, i64 0, i64 49
        tail call void @bar_(ptr %2)
        ret void
      }
      ```
      
      So the benefit of not using a descriptor in lowering is questionable,
      and although it is abstracted as much as possible in the so called
      MutableBoxValue class that represent allocatable/pointer in lowering
      it is still causing bugs from time to time, and will also be a bit
      problematic when emitting debug info for the pointer/allocatable.
      
      In HLFIR lowering, the simplification to always use a descriptor in
      lowering was already made. This patch allows decorrelating the impact
      from this change from the bigger impact HLFIR will have so that it
      is easier to get feedback if this causes performance issues.
      
      The lowering tests relying on the previous behavior are only updated
      to set back this option to true. The reason is that I think we should
      preserve coverage of the code dealing with the "non descriptor" approach
      in lowering until we actually get rid of it. The other reason is that
      the test will have to be or are already covered by equivalent HLFIR
      tests, which use descriptors.
      
      Differential Revision: https://reviews.llvm.org/D148910
      ffe4029d
    • Craig Topper's avatar
      [TableGen] Make getRegisterValueType stricter about HwModes. · d20c29d9
      Craig Topper authored
      I don't think this code would work correctly if the register class
      used used HwModes. Add asserts to make sure it's not used with HwModes.
      
      Also fix a long outdated comment on the function.
      d20c29d9
    • zhanglimin's avatar
      [lsan][test] Obtaining page size using sysconf(_SC_PAGESIZE) · fd9f7b90
      zhanglimin authored
      The effectiveness of the mprotect function depends on whether
      the first argument is aligned to a page boundary. If mprotect
      doesn't work, the kernel will not generate a SIGSEGV signal for
      the process when the calling process tries to access memory in
      a manner that violates the protection. If so, this test fails.
      
      The problem for this test is that it uses a fixed 4 kB page size
      and is aligned. This fails when the page size is not 4 kB. For
      example, this fails on LoongArch which uses a 16 kB pagesize.
      
      Reviewed By: SixWeining, xen0n, MaskRay, vitalybuka
      
      Differential Revision: https://reviews.llvm.org/D148407
      fd9f7b90
    • Christian Ulmann's avatar
      [LoopInfo] SFINAE mechanism for hoist into check · dc2b8ae9
      Christian Ulmann authored
      This commit introduces an SFINAE mechanism to make the LLVM hoist into
      check member function not leak into the users of LoopInfo.
      
      Depends on D148235
      
      Reviewed By: ftynse
      
      Differential Revision: https://reviews.llvm.org/D148504
      dc2b8ae9
    • Christian Ulmann's avatar
      [LoopInfo] Move generic LoopInfo into own files · f5425c12
      Christian Ulmann authored
      This commit splits the generic part of `LoopInfo` into separate files.
      These new `GenericLoopInfo` files are located in `llvm/Support` to be inline
      with `GenericDomTree`.
      
      Furthermore, this change ensures that MLIR's Bazel build does not have
      to link against `LLVMAnalysis` just to use these template headers.
      
      Depends on D148219
      
      Reviewed By: ftynse
      
      Differential Revision: https://reviews.llvm.org/D148235
      f5425c12
    • Shengchen Kan's avatar
      [X86][tablgen] Fix typo in comments, NFC · 9616fd1a
      Shengchen Kan authored
      9616fd1a
    • Mehdi Amini's avatar
    • Craig Topper's avatar
      [TableGen] Remove unused ForceMode and CodeGen fields from TypeInfer. NFC · 7a6dc3d2
      Craig Topper authored
      As well as the ForceMode field in PatternToMatch.
      7a6dc3d2
    • Wang, Xin10's avatar
      Clean come dead code · 76cc9492
      Wang, Xin10 authored
      These codes deleted are dead code, we never go into it.
      1. In AggressiveAntiDepBreaker.cpp, have assert AntiDepReg != 0.
      2. IfConversion.cpp, Kind can only be one unique value, so isFalse && isRev
          can never be true.
      3. DAGCombiner.cpp, at line 3675, we have considered the condition like
      ```
        // fold (sub x, c) -> (add x, -c)
        if (N1C) {
          return DAG.getNode(ISD::ADD, DL, VT, N0,
                             DAG.getConstant(-N1C->getAPIntValue(), DL, VT));
        }
      ```
      4. ScheduleDAGSDNodes.cpp, we have Latency > 1 at line 663
      5. MasmParser.cpp, code exists in a switch-case block which decided by
          the value FirstTokenKind, at line 1621, FirstTokenKind could only be
          one of AsmToken::Dollar, AsmToken::At and AsmToken::Identifier.
      
      Reviewed By: skan
      
      Differential Revision: https://reviews.llvm.org/D148610
      76cc9492
  2. Apr 23, 2023
  3. Apr 24, 2023
    • Manna, Soumi's avatar
      [NFC][clang] Fix static analyzer concerns · ff4d2207
      Manna, Soumi authored
      Reported by Coverity:
      
      AUTO_CAUSES_COPY
      Unnecessary object copies can affect performance.
      
      1. Inside "SemaDeclCXX.cpp" file, in <unnamed>::DiagnoseUninitializedFields(clang::Sema &, clang::CXXConstructorDecl const *): Using the auto keyword without an & causes the copy of an object of type CXXBaseSpecifier.
      
      2. Inside "ClangAttrEmitter.cpp" file, in clang::EmitClangAttrParsedAttrImpl(llvm::RecordKeeper &, llvm::raw_ostream &): Using the auto keyword without an & causes the copy of an object of type pair.
      
      3. Inside "Marshallers.h" file, in clang::ast_matchers::dynamic::internal::MapAnyOfBuilderDescriptor::buildMatcherCtor(clang::ast_matchers::dynamic::SourceRange, llvm::ArrayRef<clang::ast_matchers::dynamic::ParserValue>, clang::ast_matchers::dynamic::Diagnostics *): Using the auto keyword without an & causes the copy of an object of type ParserValue.
      
      4. Inside "CGVTables.cpp" file, in clang::CodeGen::CodeGenModule::GetVCallVisibilityLevel(clang::CXXRecordDecl const *, llvm::DenseSet<clang::CXXRecordDecl const *, llvm::DenseMapInfo<clang::CXXRecordDecl const *, void>> &): Using the auto keyword without an & causes the copy of an object of type CXXBaseSpecifier.
      
      5. Inside "ASTContext.cpp" file, in hasTemplateSpecializationInEncodedString(clang::Type const *, bool): Using the auto keyword without an & causes the copy of an object of type CXXBaseSpecifier.
      
      6. Inside "ComputeDependence.cpp" file, in clang::computeDependence(clang::DependentScopeDeclRefExpr *): Using the auto keyword without an & causes the copy of an object of type TemplateArgumentLoc.
      
      Reviewed By: tahonermann, erichkeane
      
      Differential Revision: https://reviews.llvm.org/D148812
      ff4d2207
    • Teresa Johnson's avatar
      [MemProf] Don't use constexpr via lambda capture due to MSVC issues (NFC) · 96926883
      Teresa Johnson authored
      Modifies a104e270 slightly to switch a
      constexpr used via a lambda capture to a const, due to issues with MSVC.
      See https://reviews.llvm.org/D140949#inline-1438809 for context.
      96926883
    • Fangrui Song's avatar
      [test] Simplify libunwind REQUIRES · bda5f77f
      Fangrui Song authored
      bda5f77f
    • Haojian Wu's avatar
      [bazel] Port for 8ac8c922 · c0c1281b
      Haojian Wu authored
      c0c1281b
    • Daniel Kiss's avatar
      [lld][AArch64] Add BTI landing pad to PLT when it is accessed by a range extension thunk. · 60827df7
      Daniel Kiss authored
      Adding BTI to those PLT's which accessed with by a range extension thunk due to those preform an indirect call.
      Fixes: #62140
      
      Reviewed By: MaskRay
      
      Differential Revision: https://reviews.llvm.org/D148704
      60827df7
    • Simon Pilgrim's avatar
      [CostModel][X86] getMemoryOpCost - increase cost of sub-32-bit vector load/stores · aca5f9ae
      Simon Pilgrim authored
      For 8-bit/16-bit vector loads/stores we scalarize and transfer to/from the vector unit, or use the (usually slow) PINSR/PEXTR instructions.
      
      Fixes #59867
      aca5f9ae
    • Simon Pilgrim's avatar
      97927c38
    • Fangrui Song's avatar
      Remove ExplicitEmulatedTLS and simplify -femulated-tls handling · 0d333bf0
      Fangrui Song authored
      Currently clangDriver passes -femulated-tls and -fno-emulated-tls to cc1.
      cc1 forwards the option to LLVMCodeGen and ExplicitEmulatedTLS is used
      to decide the value. Simplify this by moving the Clang decision to
      clangDriver and moving the LLVM decision to InitTargetOptionsFromCodeGenFlags.
      0d333bf0
    • Hanhan Wang's avatar
      [mlir][Vector] Add 16x16 strategy to vector.transpose lowering. · 8d163e50
      Hanhan Wang authored
      It adds a `shuffle_16x16` strategy LowerVectorTranspose and renames `shuffle` to `shuffle_1d`. The idea is similar to 8x8 cases in x86Vector::avx2. The general algorithm is:
      
      ```
      interleave 32-bit lanes using
          8x _mm512_unpacklo_epi32
          8x _mm512_unpackhi_epi32
      interleave 64-bit lanes using
          8x _mm512_unpacklo_epi64
          8x _mm512_unpackhi_epi64
      permute 128-bit lanes using
         16x _mm512_shuffle_i32x4
      permute 256-bit lanes using again
         16x _mm512_shuffle_i32x4
      ```
      
      After the first stage, they got transposed to
      
      ```
       0  16   1  17   4  20   5  21   8  24   9  25  12  28  13  29
       2  18   3  19   6  22   7  23  10  26  11  27  14  30  15  31
      32  48  33  49 ...
      34  50  35  51 ...
      64  80  65  81 ...
      ...
      ```
      
      After the second stage, they got transposed to
      
      ```
       0  16  32  48 ...
       1  17  33  49 ...
       2  18  34  49 ...
       3  19  35  51 ...
      64  80  96 112 ...
      65  81  97 114 ...
      66  82  98 113 ...
      67  83  99 115 ...
      ...
      ```
      
      After the thrid stage, they got transposed to
      
      ```
        0  16  32  48   8  24  40  56  64  80  96  112 ...
        1  17  33  49 ...
        2  18  34  50 ...
        3  19  35  51 ...
        4  20  36  52 ...
        5  21  37  53 ...
        6  22  38  54 ...
        7  23  39  55 ...
      128 144 160 176 ...
      129 145 161 177 ...
      ...
      ```
      
      After the last stage, they got transposed to
      
      ```
      0  16  32  48  64  80  96 112 ... 240
      1  17  33  49  66  81  97 113 ... 241
      2  18  34  50  67  82  98 114 ... 242
      ...
      15  31  47  63  79  96 111 127 ... 255
      ```
      
      Reviewed By: dcaballe
      
      Differential Revision: https://reviews.llvm.org/D148685
      8d163e50
    • Simon Pilgrim's avatar
      1746c783
    • Nathan Sidwell's avatar
      [BOLT] Remove unsupported ELF type reloc handling · 5b9f0309
      Nathan Sidwell authored
      Drop unsupported ELF format reloc handling -- RewriteInstance lacks
      this flexibility elsewhere.
      
      Reviewed By: rafauler
      
      Differential Revision: https://reviews.llvm.org/D148946
      5b9f0309
    • David Green's avatar
      [ARM] Fix qsat for armv5te/armv6 + thumb-mode · 15d28212
      David Green authored
      This is a Thumb1 target, so will not have qsat instructions available. There
      was a mismatch between hasBaseDSP and the instruction patterns when +dsp was
      present, which is set by clang (but maybe shouldn't be). The target being
      thumb1-only should override that, implying that it does not have any qadds.
      
      Fixes #62273
      15d28212
    • Kazu Hirata's avatar
      [clang-tidy] Modernize FileState (NFC) · 76469d5a
      Kazu Hirata authored
      76469d5a
    • Mathieu Fehr's avatar
      [mlir][irdl] Add IRDL registration · 8ac8c922
      Mathieu Fehr authored
      This patch add support for loading IRDL dialects at runtime
      with `mlir-opt`.
      
      Given the following `dialect.irdl` file:
      ```mlir
      module {
        irdl.dialect @cmath {
          irdl.type @complex {
            %0 = irdl.is f32
            %1 = irdl.is f64
            %2 = irdl.any_of(%0, %1)
            irdl.parameters(%2)
          }
      
          irdl.operation @norm {
            %0 = irdl.any
            %1 = irdl.parametric @complex<%0>
            irdl.operands(%1)
            irdl.results(%0)
          }
      }
      ```
      
      the IRDL file can be loaded with the `mlir-opt --irdl-file=dialect.irdl`
      command, and the following file can then be parsed:
      
      ```mlir
      func.func @conorm(%p: !cmath.complex<f32>, %q: !cmath.complex<f32>) -> f32 {
        %norm_p = "cmath.norm"(%p) : (!cmath.complex<f32>) -> f32
        %norm_q = "cmath.norm"(%q) : (!cmath.complex<f32>) -> f32
        %pq = arith.mulf %norm_p, %norm_q : f32
        return %pq : f32
      }
      ```
      
      To minimize the size of this patch, the operation, attribute, and type verifier are all always returning `success()`.
      
      Depends on D144692
      
      Reviewed By: rriddle, Mogball, mehdi_amini
      
      Differential Revision: https://reviews.llvm.org/D144693
      8ac8c922
  4. Apr 23, 2023