1. Apr 12, 2021
    • Nathan James's avatar
      [NFC] Remove redundant string copy · bcbea2ab
      Nathan James authored
      bcbea2ab
    • Malhar Jajoo's avatar
      [ARM] Updates to arm-block-placement pass · 58f3201a
      Malhar Jajoo authored
      The patch makes two updates to the arm-block-placement pass:
      - Handle arbitrarily nested loops
      - Extends the search (for t2WhileLoopStartLR) to the predecessor of the
        preHeader.
      
      Differential Revision: https://reviews.llvm.org/D99649
      58f3201a
    • Paul C. Anagnostopoulos's avatar
    • Tobias Gysi's avatar
      [mlir][linalg] adding operation to access the iteration index of enclosing linalg ops. · 93f9922d
      Tobias Gysi authored
      The `linalg.index` operation provides access to the iteration indexes of immediately enclosing linalg operations. It takes a dimension `dim` attribute and returns the iteration index in the given dimension. Having `linalg.index` allows us to unify `linalg.generic` and `linalg.indexed_generic` and also enables index access in named operations.
      
      Differential Revision: https://reviews.llvm.org/D100292
      93f9922d
    • Andrew Savonichev's avatar
      Revert "[AArch64] Add Machine InstCombiner patterns for FMUL indexed variant" · f037b07b
      Andrew Savonichev authored
      This reverts commit cca9b598.
      
      Buildbot reported an error for CodeGen/AArch64/machine-combiner-fmul-dup.mir:
      
      *** Bad machine code: Virtual register killed in block, but needed live out. ***
      - function:    indexed_2s
      - basic block: %bb.0 entry (0x640fee8)
      Virtual register %7 is used after the block.
      
      *** Bad machine code: Virtual register defs don't dominate all uses. ***
      - function:    indexed_2s
      - v. register: %7
      LLVM ERROR: Found 2 machine code errors.
      f037b07b
    • Andrew Savonichev's avatar
      [AArch64] Add Machine InstCombiner patterns for FMUL indexed variant · cca9b598
      Andrew Savonichev authored
      This patch adds DUP+FMUL => FMUL_indexed pattern to InstCombiner.
      FMUL_indexed is normally selected during instruction selection, but it
      does not work in cases when VDUP and VMUL are in different basic
      blocks.
      
      Differential Revision: https://reviews.llvm.org/D99662
      cca9b598
    • Raphael Isemann's avatar
      [lldb] Delete dead StackFrameList::Merge · 5a5a94ed
      Raphael Isemann authored
      That code is unused since it's check-in in 2010 (and I believe it would leak
      memory when called as it releases the passed unique_ptr), so let's delete it.
      
      Reviewed By: vsk
      
      Differential Revision: https://reviews.llvm.org/D100212
      5a5a94ed
    • Raphael Isemann's avatar
      [lldb] Don't recursively load types of static member variables in the DWARF AST parser · 34c697c8
      Raphael Isemann authored
      When LLDB's DWARF parser is parsing the member DIEs of a struct/class it
      currently fully resolves the types of static member variables in a class before
      adding the respective `VarDecl` to the record.
      
      For record types fully resolving the type will also parse the member DIEs of the
      respective class. The other way of resolving is just 'forward' resolving the type
      which will try to load only the minimum amount of information about the type
      (for records that would only be the name/kind of the type). Usually we always
      resolve types on-demand so it's rarely useful to speculatively fully resolve
      them on the first use.
      
      This patch changes makes that we only 'forward' resolve the types of static
      members. This solves the fact that LLDB unnecessarily loads debug information
      to parse the type if it's maybe not needed later and it also avoids a crash where
      the parsed type might in turn reference the surrounding class that is currently
      being parsed.
      
      The new test case demonstrates the crash that might happen. The crash happens
      with the following steps:
      
      1. We parse class `ToLayout` and it's members.
      
      2. We parse the static class member and fully resolve its type
      (`DependsOnParam2<ToLayout>`).
      
      3. That type has a non-static class member `DependsOnParam1<ToLayout>` for which
      LLDB will try to calculate the size.
      
      4. The layout (and size)`DependsOnParam1<ToLayout>` turns depends on the
      `ToLayout` size/layout.
      
      5. Clang will calculate the record layout/size for `ToLayout` even though we are
      currently parsing it and it's missing it's non-static member.
      
      The created is missing the offset for the yet unparsed non-static member. If we
      later try to get the offset we end up hitting different asserts. Most common is
      the one in `TypeSystemClang::DumpValue` where it checks that the record layout
      has offsets for the current FieldDecl.
      
      ```
              assert(field_idx < record_layout.getFieldCount());
      ```
      
      Fixed rdar://67910011
      
      Reviewed By: shafik
      
      Differential Revision: https://reviews.llvm.org/D100180
      34c697c8
    • Alexey Lapshin's avatar
      Fix chrome os failure after 021de7cf. · ee8a5e4b
      Alexey Lapshin authored
      chrome os build failed after D98511:
      https://bugs.chromium.org/p/chromium/issues/detail?id=1197970
      
      This patch fixes permission issue appeared after D98511.
      ee8a5e4b
    • Sebastian Neubauer's avatar
      [AMDGPU] Kill temporary register after restoring · 6cc91adf
      Sebastian Neubauer authored
      Not a correctness issue, but the temporary register is not used
      afterwards and should be dead.
      
      Differential Revision: https://reviews.llvm.org/D100295
      6cc91adf
    • Bradley Smith's avatar
      f2593a0b
    • Stephen Tozer's avatar
      Reapply "[DebugInfo] Correctly track SDNode dependencies for list debug values" · aa3e78a5
      Stephen Tozer authored
      Fixed memory leak error by using BumpAllocator for SDDbgValue arrays.
      
      This reverts commit 1b589172.
      aa3e78a5
    • Esme-Yi's avatar
      dff922f3
    • Esme-Yi's avatar
      c965e14a
    • Tobias Gysi's avatar
      [mlir][linalg] fixing hard-coded variable names in a test (NFC) · 33ce6f02
      Tobias Gysi authored
      The patch fixes hard-coded variable names in the vector-to-loops test.
      33ce6f02
    • Dmitry Preobrazhensky's avatar
      [AMDGPU][MC][NFC] Removed extra spaces · 67b39661
      Dmitry Preobrazhensky authored
      Fixed bugs 49646, 49647.
      
      Differential Revision: https://reviews.llvm.org/D100173
      67b39661
    • Simon Pilgrim's avatar
      [IR] Fix Wdocumentation warning. NFCI. · 199a21bd
      Simon Pilgrim authored
      199a21bd
    • Sander de Smalen's avatar
      [AArch64] ACLE: Fix issue for mismatching enum types with builtins. · 6bf806b3
      Sander de Smalen authored
      This patch fixes an issue with the SVE prefetch and qinc/qdec intrinsics
      that take an `enum` argument, but where the builtin prototype encodes
      these as `int`. Some code in SemaDecl found the mismatch and chose
      to forget about the builtin altogether, which meant that any future
      code using that builtin would fail. The code that forgets about the
      builtin was actually obsolete after D77491 and should have been removed.
      This patch now removes that code.
      
      This patch also fixes another issue with the SVE prefetch intrinsic
      when built with C++, where the builtin didn't accept the correct
      pointer type, which should be `const void *`.
      
      Reviewed By: tambre
      
      Differential Revision: https://reviews.llvm.org/D100046
      6bf806b3
    • Sebastian Neubauer's avatar
      [AMDGPU] Fix ubsan error · 7a8e65dd
      Sebastian Neubauer authored
      The RegScavenger can be null sometimes, so a pointer is needed.
      
      Fixes UBSan error introduced in f9a8c6a0.
      7a8e65dd
    • Muhammad Omair Javaid's avatar
      [LLDB] Fix buildbots breakage due to TestGuessLanguage.py · 428b17ce
      Muhammad Omair Javaid authored
      Fix LLDB buidbot breakage due to D99250.
      
      Differential Revision: https://reviews.llvm.org/D99250
      428b17ce
    • Sebastian Neubauer's avatar
      [AMDGPU] Fix saving fp and bp · b76c2a6c
      Sebastian Neubauer authored
      Spilling the fp or bp to scratch could overwrite VGPRs of inactive
      lanes. Fix that by using only the active lanes of the scavenged VGPR.
      
      This builds on the assumptions that
      1. a function is never called with exec=0
      2. lanes do not die in a function, i.e. exec!=0 in the function epilog
      3. no new lanes are active when exiting the function, i.e. exec in the
         epilog is a subset of exec in the prolog.
      
      Differential Revision: https://reviews.llvm.org/D96869
      b76c2a6c
    • Sebastian Neubauer's avatar
      [AMDGPU] Autogenerate test. NFC · ca3bae94
      Sebastian Neubauer authored
      ca3bae94
    • Sebastian Neubauer's avatar
      [AMDGPU] Unify spill code · 32bc9a9b
      Sebastian Neubauer authored
      Instead of reimplementing spilling in prolog and epilog, reuse
      buildSpillLoadStore.
      
      Reviewed By: scott.linder
      
      Differential Revision: https://reviews.llvm.org/D99269
      32bc9a9b
    • Sebastian Neubauer's avatar
      [AMDGPU] Save VGPR of whole wave when spilling · f9a8c6a0
      Sebastian Neubauer authored
      Spilling SGPRs to scratch uses a temporary VGPR. LLVM currently cannot
      determine if a VGPR is used in other lanes or not, so we need to save
      all lanes of the VGPR. We even need to save the VGPR if it is marked as
      dead.
      
      The generated code depends on two things:
      - Can we scavenge an SGPR to save EXEC?
      - And can we scavenge a VGPR?
      
      If we can scavenge an SGPR, we
      - save EXEC into the SGPR
      - set the needed lane mask
      - save the temporary VGPR
      - write the spilled SGPR into VGPR lanes
      - save the VGPR again to the target stack slot
      - restore the VGPR
      - restore EXEC
      
      If we were not able to scavenge an SGPR, we do the same operations, but
      everytime the temporary VGPR is written to memory, we
      - write VGPR to memory
      - flip exec (s_not exec, exec)
      - write VGPR again (previously inactive lanes)
      
      Surprisingly often, we are able to scavenge an SGPR, even though we are
      at the brink of running out of SGPRs.
      Scavenging a VGPR does not have a great effect (saves three instructions
      if no SGPR was scavenged), but we need to know if the VGPR we use is
      live before or not, otherwise the machine verifier complains.
      
      Differential Revision: https://reviews.llvm.org/D96336
      f9a8c6a0
    • Sven van Haastregt's avatar
      [OpenCL] Accept .rgba in OpenCL 3.0 · 731bf28a
      Sven van Haastregt authored
      The .rgba vector component accessors are supported in OpenCL C 3.0.
      
      Previously, the diagnostic would check `OpenCLVersion` for version 2.2
      (value 220) and report those accessors are an OpenCL 2.2 feature.
      However, there is no "OpenCL C version 2.2", so change the check and
      diagnostic text to 3.0 only.
      
      A spurious `OpenCLVersion` argument was passed into the diagnostic;
      remove that.
      
      Differential Revision: https://reviews.llvm.org/D99969
      731bf28a
    • Stelios Ioannou's avatar
      [AArch64] Adds memory operands for indexed loads. · a655f250
      Stelios Ioannou authored
      This patch adds the memory operands for indexed loads so
      that certain optimizations can take place.
      
      Differential Revision: https://reviews.llvm.org/D100215/
      
      Change-Id: I539fcf046ca4ad1e7df1d893f57d751419d8364d
      a655f250
    • Esme-Yi's avatar
      [DebugInfo] Fix the mismatching between C++ language tags and Dwarf versions. · 62fa9b93
      Esme-Yi authored
      Summary: The tags DW_LANG_C_plus_plus_14 and DW_LANG_C_plus_plus_11, introduced in Dwarf-5, are unexpected in previous versions. Fixing the mismathing doesn't have any drawbacks for any other debuggers, but helps dbx.
      
      Reviewed By: aprantl, shchenz
      
      Differential Revision: https://reviews.llvm.org/D99250
      62fa9b93
    • Balázs Kéri's avatar
      [clang][AST] Handle overload callee type in CallExpr::getCallReturnType. · 6e519910
      Balázs Kéri authored
      The function did not handle every case. In some cases this
      caused assertion failure.
      After the fix the function returns DependentTy if the exact
      return type can not be determined.
      
      It seems that clang itself does not call the function in the
      affected cases but some checker or other code may call it.
      
      Reviewed By: hokein
      
      Differential Revision: https://reviews.llvm.org/D95244
      6e519910
    • Zhang Qing Shan's avatar
      [NFC][Debug] Fix unnecessary deep-copy for vector to save compiling time · d69c236e
      Zhang Qing Shan authored
      We saw some big compiling time impact after enabling the debug entry value
      feature for X86 platform(D73534). Compiling time goes from 900s->1600s with
      our testcase. It is caused by allocating/freeing the memory busily.
      
      'using FwdRegWorklist = MapVector<unsigned, SmallVector<FwdRegParamInfo, 2>>;'
      The value for this map is vector, and we miss the reference when access the
      element. The same happens for `auto CalleesMap = MF->getCallSitesInfo();` which is a DenseMap.
      
      Reviewed by: djtodoro, flychen50
      
      Differential Revision: https://reviews.llvm.org/D100162
      d69c236e
    • Mikael Holmen's avatar
      [libtooling][clang-tidy] Fix compiler warnings in testcase [NFC] · 2dd22da9
      Mikael Holmen authored
      Without the fix we get:
      
      06:31:09 In file included from ../../clang-tools-extra/unittests/clang-tidy/ClangTidyDiagnosticConsumerTest.cpp:3:
      06:31:09 ../utils/unittest/googletest/include/gtest/gtest.h:1392:11: error: comparison of integers of different signs: 'const int' and 'const unsigned int' [-Werror,-Wsign-compare]
      06:31:09   if (lhs == rhs) {
      06:31:09       ~~~ ^  ~~~
      06:31:09 ../utils/unittest/googletest/include/gtest/gtest.h:1421:12: note: in instantiation of function template specialization 'testing::internal::CmpHelperEQ<int, unsigned int>' requested here
      06:31:09     return CmpHelperEQ(lhs_expression, rhs_expression, lhs, rhs);
      06:31:09            ^
      06:31:09 ../../clang-tools-extra/unittests/clang-tidy/ClangTidyDiagnosticConsumerTest.cpp:60:3: note: in instantiation of function template specialization 'testing::internal::EqHelper<false>::Compare<int, unsigned int>' requested here
      06:31:09   EXPECT_EQ(4, Errors[0].Message.FileOffset);
      06:31:09   ^
      06:31:09 ../utils/unittest/googletest/include/gtest/gtest.h:1924:63: note: expanded from macro 'EXPECT_EQ'
      06:31:09                       EqHelper<GTEST_IS_NULL_LITERAL_(val1)>::Compare, \
      06:31:09                                                               ^
      06:31:09 ../utils/unittest/googletest/include/gtest/gtest.h:1392:11: error: comparison of integers of different signs: 'const int' and 'const unsigned long' [-Werror,-Wsign-compare]
      06:31:09   if (lhs == rhs) {
      06:31:09       ~~~ ^  ~~~
      06:31:09 ../utils/unittest/googletest/include/gtest/gtest.h:1421:12: note: in instantiation of function template specialization 'testing::internal::CmpHelperEQ<int, unsigned long>' requested here
      06:31:09     return CmpHelperEQ(lhs_expression, rhs_expression, lhs, rhs);
      06:31:09            ^
      06:31:09 ../../clang-tools-extra/unittests/clang-tidy/ClangTidyDiagnosticConsumerTest.cpp:64:3: note: in instantiation of function template specialization 'testing::internal::EqHelper<false>::Compare<int, unsigned long>' requested here
      06:31:09   EXPECT_EQ(1, Errors[0].Message.Ranges.size());
      06:31:09   ^
      06:31:09 ../utils/unittest/googletest/include/gtest/gtest.h:1924:63: note: expanded from macro 'EXPECT_EQ'
      06:31:09                       EqHelper<GTEST_IS_NULL_LITERAL_(val1)>::Compare, \
      06:31:09                                                               ^
      06:31:09 2 errors generated.
      2dd22da9
    • Jim Lin's avatar
      [NFC] [Clang]: fix spelling mistake in assert message · 8a2d375a
      Jim Lin authored
      Reviewed By: Jim
      
      Differential Revision: https://reviews.llvm.org/D71541
      8a2d375a
    • Jim Lin's avatar
      fix typo in a CMake SANITIZER_CAN_USE_CXXABI variable initial definition · dd4c999c
      Jim Lin authored
      The current variable name isn't used anywhere else, which indicates it's
      a typo.  Let's fix it before someone copy+pastes it somewhere else.
      
      Reviewed By: Jim
      
      Differential Revision: https://reviews.llvm.org/D39157
      dd4c999c
    • Bing1 Yu's avatar
      [X86] Pass to transform tdpbsud&tdpbusd&tdpbuud intrinsics to scalar operation · 747111ea
      Bing1 Yu authored
      Reviewed By: pengfei
      
      Differential Revision: https://reviews.llvm.org/D99244
      747111ea
    • Evgeniy Brevnov's avatar
      [NARY] Don't optimize min/max if there are side uses · 36b932d6
      Evgeniy Brevnov authored
      Say we have
      %1=min(%a,%b)
      %2=min(%b,%c)
      %3=min(%2,%a)
      
      The optimization will try to reassociate the later one so that we can rewrite it to %3=min(%1, %c) and remove %2.
      But if %2 has another uses outside of %3 then we can't remove %2 and end up with:
      
      %1=min(%a,%b)
      %2=min(%b,%c)
      %3=min(%1, %c)
      
      This doesn't harm by itself except it is not profitable and changes IR for no good reason.
      What is bad it triggers next iteration which finds out that optimization is applicable to %2 and %3 and generates:
      
      %1=min(%a,%b)
      %2=min(%b,%c)
      %3=min(%1,%c)
      %4=min(%2,%a)
      
      and so on...
      
      The solution is to prevent optimization in the first place if intermediate result (%2) has side uses and
      known to be not removed.
      
      Reviewed By: mkazantsev
      
      Differential Revision: https://reviews.llvm.org/D100170
      36b932d6
    • Freddy Ye's avatar
      [X86] Remove FeatureCLWB from FeaturesICLClient · 5cb47be4
      Freddy Ye authored
      Reviewed By: craig.topper
      
      Differential Revision: https://reviews.llvm.org/D100279
      5cb47be4
    • Jez Ng's avatar
      [lld-macho][nfc] Convert tabs to spaces · 74283fc8
      Jez Ng authored
      74283fc8
    • Chen Zheng's avatar
      bb346146
    • yifeng.dongyifeng's avatar
      [Clang][Coroutine][DebugInfo] In c++ coroutine, clang will emit different... · 3a6a80b6
      yifeng.dongyifeng authored
      [Clang][Coroutine][DebugInfo] In c++ coroutine, clang will emit different debug info variables for parameters and move-parameters.
      
      The first one is the real parameters of the coroutine function, the
      other one just for copying parameters to the coroutine frame.
      
      Considering the following c++ code:
      ```
      struct coro {
        ...
      };
      
      coro foo(struct test & t) {
        ...
        co_await suspend_always();
          ...
          co_await suspend_always();
          ...
          co_await suspend_always();
      }
      
      int main(int argc, char *argv[]) {
        auto c = foo(...);
          c.handle.resume();
            ...
        }
      ```
      
      Function foo is the standard coroutine function, and it has only
      one parameter named t (ignoring this at first),
      when we use the llvm code to compile this function, we can get the
      following ir:
      
      ```
      !2921 = distinct !DISubprogram(name: "foo", linkageName:
      "_ZN6Object3fooE4test", scope: !2211, file: !45, li\
      ne: 48, type: !2329, scopeLine: 48, flags: DIFlagPrototyped |
      DIFlagAllCallsDescribed, spFlags: DISPFlagDefi\
      nition | DISPFlagOptimized, unit: !44, declaration: !2328,
      retainedNodes: !2922)
      !2924 = !DILocalVariable(name: "t", arg: 2, scope: !2921, file: !45,
      line: 48, type: !838)
      ...
      !2926 = !DILocalVariable(name: "t", scope: !2921, type: !838, flags:
      DIFlagArtificial)
      ```
      We can find there are two `the same` DIVariable named t in the same
      dwarf scope for foo.resume.
      And when we try to use llvm-dwarfdump to dump the dwarf info of this
      elf, we get the following output:
      
      ```
      0x00006684:   DW_TAG_subprogram
                      DW_AT_low_pc    (0x00000000004013a0)
                      DW_AT_high_pc   (0x00000000004013a8)
                      DW_AT_frame_base        (DW_OP_reg7 RSP)
                      DW_AT_object_pointer    (0x0000669c)
                      DW_AT_GNU_all_call_sites        (true)
                      DW_AT_specification     (0x00005b5c "_ZN6Object3fooE4test")
      
      0x000066a5:     DW_TAG_formal_parameter
                      DW_AT_name    ("t")
                      DW_AT_decl_file       ("/disk1/yifeng.dongyifeng/my_code/llvm/build/bin/coro-debug-1.cpp")
                      DW_AT_decl_line       (48)
                      DW_AT_type    (0x00004146 "test")
      
      0x000066ba:     DW_TAG_variable
                        DW_AT_name    ("t")
                        DW_AT_type    (0x00004146 "test")
                        DW_AT_artificial      (true)
      ```
      The elf also has two 't' in the same scope.
      But unluckily, it might let the debugger
      confused. And failed to print parameters for O0 or above.
      This patch will make coroutine parameters and move
      parameters use the same DIVar and try to fix the problems
      that I mentioned before.
      
      Test Plan: check-clang
      
      Reviewed By: aprantl, jmorse
      
      Differential Revision: https://reviews.llvm.org/D97533
      3a6a80b6
    • Qiu Chaofan's avatar
      [PowerPC] Lower f128 SETCC/SELECT_CC as libcall if p9vector disabled · ece73458
      Qiu Chaofan authored
      XSCMPUQP is not available for pre-P9 subtargets. This patch will lower
      them into libcall for correct behavior on power7/power8.
      
      Reviewed By: steven.zhang
      
      Differential Revision: https://reviews.llvm.org/D92083
      ece73458
    • Zakk Chen's avatar
      [RISCV][Clang] Add some RVV Permutation intrinsic functions. · 59d5b8c2
      Zakk Chen authored
      
      
      Support the following instructions.
      1. Vector Slide Instructions
      2. Vector Register Gather Instructions
      3. Vector Compress Instruction
      
      Authored-by: default avatarRoger Ferrer Ibanez <rofirrim@gmail.com>
      Co-Authored-by: default avatarZakk Chen <zakk.chen@sifive.com>
      
      Reviewed By: craig.topper
      
      Differential Revision: https://reviews.llvm.org/D100127
      59d5b8c2