1. Nov 11, 2023
    • Kazu Hirata's avatar
      [llvm] Stop including llvm/ADT/MapVector.h (NFC) · c22fffcb
      Kazu Hirata authored
      Identified with clangd.
      c22fffcb
    • Kazu Hirata's avatar
      [llvm] Stop including llvm/ADT/SetVector.h (NFC) · 84a48ee9
      Kazu Hirata authored
      Identified with clangd.
      84a48ee9
    • Kazu Hirata's avatar
      [llvm] Stop including llvm/ADT/StringMap.h (NFC) · 8dad9f85
      Kazu Hirata authored
      Identified with clangd.
      8dad9f85
    • Craig Topper's avatar
      [RISCV][GISel] Promote s32 constant shift amounts to s64 on RV64. · bab2cf2d
      Craig Topper authored
      This allows us to reuse isel patterns from SelectionDAG.
      
      This is similar to what is done on AArch64.
      bab2cf2d
    • Fangrui Song's avatar
    • Björn Pettersson's avatar
      [clangd] Check for valid location in ExtractionContext::exprIsValidOutside (#71162) · 5bd0f0d9
      Björn Pettersson authored
      If the code has a call to an implicitly declared function, an expression
      could end up referencing declarations without valid source locations. So
      when doing the exprIsValidOutside check we could end up calling
      SourceManager::isPointWithin using invalid source locations, and then a
      debug build would crash with an assertion failure in
      SourceManager::isBeforeInTranslationUnit.
      
      This patch make sure that we deal with the invalid locations (by
      considering a ReferencedDecl with invalid location as not being inside
      the Scope).
      5bd0f0d9
    • Fangrui Song's avatar
    • Craig Topper's avatar
    • Craig Topper's avatar
    • Craig Topper's avatar
      [RISCV] Peek through zext in selectShiftMask. · a93dfb58
      Craig Topper authored
      This improves the code for -riscv-experimental-rv64-legal-i32
      a93dfb58
    • Craig Topper's avatar
      [RISCV] Add test case showing unnecessary zext of shift amounts with... · 83cc24e5
      Craig Topper authored
      [RISCV] Add test case showing unnecessary zext of shift amounts with -riscv-experimental-rv64-legal-i32. NFC
      83cc24e5
    • Walter Erquinigo's avatar
      [LLDB] Ensure the data of apple accelerator tables is kept around (#71828) · 309596f2
      Walter Erquinigo authored
      lldb's AppleDWARFIndex is created with a few
      `llvm::AppleAcceleratorTable` variables, but they only hold pointers to
      the underlying data, which doesn't prevent the data owner (lldb's
      DataBufferHeap) from being disposed.
      
      Because of this, an asan build of lldb was showing an error in which a
      jitted accelerator table was being fred before read, which made my lldb
      fall in an infinite loop trying to parse corrupted accel table data.
      This issue only happens when I'm using a jitted execution and not when
      debugging a precompiled binary, probably because in the jit case the
      underlying data has to necessarily be copied via gdb-remote instead of
      mmaping a debug info file.
      
      The correct fix seems to also store the underlying storage along with
      the accelerator tables in AppleDWARFIndex.
      309596f2
    • spaceotter's avatar
      [mlir][gpu] Separate the barrier elimination code from transform ops (#71762) · 00c3c731
      spaceotter authored
      
      
      Allows the barrier elimination code to be run from C++ as well. The code
      from transforms dialect is copied as-is, the pass and populate functions
      have beed added at the end.
      
      Co-authored-by: default avatarEric Eaton <eric@nod-labs.com>
      00c3c731
    • Shoaib Meenai's avatar
      [Analysis] Make test require asserts · bdd396f3
      Shoaib Meenai authored
      This is a hacky fix to get the bots green, because just reverting the
      original commit causes more failures. This should be replaced with a
      proper fix by the author.
      bdd396f3
    • Shoaib Meenai's avatar
      Revert "Revert "[IR] Mark lshr and ashr constant expressions as undesirable"" · c5dd1bbc
      Shoaib Meenai authored
      This reverts commit 8ee07a4b.
      
      The revert is breaking AMDGPU backend tests (which I didn't have
      enabled), and I don't want to risk breakages over the weekend, so just
      revert for now.
      c5dd1bbc
    • Shoaib Meenai's avatar
      Revert "Revert "[Clang] Generate test checks (NFC)"" · 55ac3323
      Shoaib Meenai authored
      This reverts commit 3bb7ecc5.
      
      The revert breaks AMDGPU backend tests (which I didn't have enabled
      locally), and I don't want to risk more breakages before the weekend, so
      just restore things as they were.
      55ac3323
    • Shoaib Meenai's avatar
      Revert "[Clang] Generate test checks (NFC)" · 3bb7ecc5
      Shoaib Meenai authored
      This reverts commit cd7ba9f3.
      
      This is causing test failures on builds without assertions:
      
      /data/users/smeenai/llvm-project/clang/test/Analysis/builtin_signbit.cpp:14:21: error: CHECK-BE32-NEXT: expected string not found in input
      // CHECK-BE32-NEXT: entry:
                          ^
      
      Bots are also failing, e.g. https://lab.llvm.org/buildbot/#/builders/67/builds/13266/steps/7/logs/stdio
      3bb7ecc5
    • Shoaib Meenai's avatar
      Revert "[IR] Mark lshr and ashr constant expressions as undesirable" · 8ee07a4b
      Shoaib Meenai authored
      This reverts commit 82f68a99.
      
      cd7ba9f3 needs to be reverted to fix
      test failures on builds without assertions, and this one needs to be
      reverted first for that.
      8ee07a4b
    • Vidhush Singhal's avatar
      [Attributor] New attribute to identify what byte ranges are alive for an allocation (#66148) · 754b93e4
      Vidhush Singhal authored
      Changes the size of allocations automatically.
      For now, implements the case when a single range from start of the
      allocation is alive and the allocation can be reduced.
      754b93e4
    • jimingham's avatar
      Fix a little thinko in sending events to secondary listeners. (#71997) · 0f8d3e62
      jimingham authored
      If `unique` is true, I was redoing the uniqueness check for the
      secondary listeners, which is racy since a "duplicate" event could come
      in between deciding to send the event to the main listener and checking
      for the shadow listener, and then the two streams would get out of sync.
      
      There's not a good way to write a direct test for this, but the
      test_shadow_listeners test has been flakey and this is the only racy
      part of that system I can find. So the test would be that that
      test_shadow_listeners becomes not flakey.
      0f8d3e62
    • Jonas Devlieghere's avatar
      [lldb] Read Checksum from DWARF line tables (#71458) · 64f62de9
      Jonas Devlieghere authored
      Read the MD5 checksum from DWARF line tables and store it in the
      corresponding support files.
      
      This is a re-land after fixing an off-by-one error in LLDB's
      ParseSupportFilesFromPrologue (fixed in #71984).
      64f62de9
    • Johannes Doerfert's avatar
      [OpenMP][FIX] Ensure device reduction geps work for multi-var reductions · 7318fe63
      Johannes Doerfert authored
      If we have more than one reduction variable we need to be consistent
      wrt. indexing. In 3de645ef we broke this
      as the buffer type was reduced to a singleton but the index computation
      was not adjusted to account for that offset. This fixes it by
      interleaving the reduction variables properly in a array-of-struct
      style. We can revert it back to struct-of-array in a follow up if turns
      out to be a problem. I doubt it since half the accesses should benefit
      from the locallity this layout offers and only the other half were
      consecutive before.
      7318fe63
    • Quinn Dawkins's avatar
    • Jonas Devlieghere's avatar
      [lldb] Fix a off-by-one error in ParseSupportFilesFromPrologue (#71984) · fa7e07ed
      Jonas Devlieghere authored
      This fixes a subtle and previously harmless off-by-one bug in
      ParseSupportFilesFromPrologue. The function accounts for the start index
      being one-based for DWARF v4 and earlier and zero-based for DWARF v5 and
      later. However, the same care wasn't taken for the end index.
      
      This bug existed unnoticed because GetFileByIndex gracefully handles an
      invalid index. However, the bug manifested itself after #71458, which
      added a call to getFileNameEntry which requires the index to be valid.
      
      No test as the bug cannot be observed without the changes from #71458.
      Once that PR is merged, this will be covered by all the DWARF v5 tests.
      fa7e07ed
    • Jay Foad's avatar
      [AMDGPU] Simplify commuted operand handling. NFCI. (#71965) · 0448a1c0
      Jay Foad authored
      SIInstrInfo::commuteInstructionImpl should accept indices to commute in
      either order. This simplifies SIFoldOperands::tryAddToFoldList where
      OtherIdx, CommuteIdx0 and CommuteIdx1 are no longer needed.
      0448a1c0
    • William Junda Huang's avatar
      [SampleProfile] Fix bug where remapper returns empty string and crashing... · 683f2df6
      William Junda Huang authored
      [SampleProfile] Fix bug where remapper returns empty string and crashing Sample Profile loader (#71479)
      
      Normally SampleContext does not allow using an empty StirngRef to
      construct an object, this is to prevent bugs reading the profile.
      However empty names may be emitted by a function which its name is
      intentionally set to empty, or a bug in the remapper that returns an
      empty string. Regardless, converting it to FunctionId first will prevent
      the assert, and that assert check is unnecessary, which will be
      addressed in another patch
      683f2df6
    • Owen Pan's avatar
      [clang-format] Handle variable declarations in BreakAfterAttributes (#71935) · 199fc973
      Owen Pan authored
      Also fixed a bug in `isStartOfName()` and cleaned up some old test
      cases.
      
      Fixed #71563.
      
      This is a rework of #71755.
      199fc973
    • Alexander Yermolovich's avatar
      [BOLT][DWARF] Fix --dwarf-output-path (#71886) · ce17c6d3
      Alexander Yermolovich authored
      Fixed a bug where when --dwarf-output-path is specified
      and DW_AT_dwo_name contains part of the path the output path would
      contain both.
      Which lead to llvm-bolt crash, because the path didn't exist.
      Example:
      llvm-bolt .... --dwarf-output-path=/some/path/ 
      DW_AT_dwo_name  ("objects/o1/split.dwo")
      
      It would try to write .dwo file to /some/path/objects/o1/split.dwo.dwo
      instead of to
      /some/path/split.dwo.dwo
      ce17c6d3
    • Fangrui Song's avatar
      [asan] Report executable/DSO name for report_globals=2 and odr-violation checking (#71879) · ee7d41d1
      Fangrui Song authored
      For an odr-violation error due to a source file linked into two DSOs, or
      one DSO and the main executable, it can be difficult to identify the DSO
      name. Let's print the module name in the error report.
      
      ```
      echo 'extern long var; int main() { return var; }' > a.cc
      echo 'long var;' > b.cc
      clang++ -fpic -fsanitize=address -shared b.cc -o b.so
      clang++ -fsanitize=address a.cc b.cc ./b.so -o a
      ```
      
      w/o this patch:
      ```
      ==1375386==ERROR: AddressSanitizer: odr-violation (0x56067cb06240):
        [1] size=8 'var' b.cc
        [2] size=8 'var' b.cc
      ...
      ```
      w/ this patch:
      ```
      ==1375386==ERROR: AddressSanitizer: odr-violation (0x56067cb06240):
        [1] size=8 'var' b.cc in /tmp/c/a
        [2] size=8 'var' b.cc in ./b.so
      ```
      
      In addition, update the `report_globals=2` message to include the module
      name
      ```
      ==1451005==Added Global[0x7fcfe59ae040]: beg=0x7fcfe59ae140 size=8/32 name=var source=b.cc module=./b.so dyn_init=0 odr_indicator=0x55754f939260
      ```
      ee7d41d1
    • Craig Topper's avatar
      [RISCV][GISel] Legalizer and register bank selection for G_JUMP_TABLE and G_BRJT (#71970) · ca603343
      Craig Topper authored
      Testing together since they should come paired.
      
      Instruction selection will be a separate PR.
      ca603343
    • Joseph Huber's avatar
      [OpenMP] Rework handling of global ctor/dtors in OpenMP (#71739) · 237adfca
      Joseph Huber authored
      Summary:
      This patch reworks how we handle global constructors in OpenMP.
      Previously, we emitted individual kernels that were all registered and
      called individually. In order to provide more generic support, this
      patch moves all handling of this to the target backend and the runtime
      plugin. This has the benefit of supporting the GNU extensions for
      constructors an destructors, removing a class of failures related to
      shared library destruction order, and allows targets other than OpenMP
      to use the same support without needing to change the frontend.
      
      This is primarily done by calling kernels that the backend emits to
      iterate a list of ctor / dtor functions. For x64, this is automatic and
      we get it for free with the standard `dlopen` handling. For AMDGPU, we
      emit `amdgcn.device.init` and `amdgcn.device.fini` functions which
      handle everything atuomatically and simply need to be called. For NVPTX,
      a patch https://github.com/llvm/llvm-project/pull/71549 provides the
      kernels to call, but the runtime needs to set up the array manually by
      pulling out all the known constructor / destructor functions.
      
      One concession that this patch requires is the change that for GPU
      targets in OpenMP offloading we will use `llvm.global_dtors` instead of
      using `atexit`. This is because `atexit` is a separate runtime function
      that does not mesh well with the handling we're trying to do here. This
      should be equivalent in all cases except for cases where we would need
      to destruct manually such as:
      
      ```
      struct S { ~S() { foo(); } };
      void foo() {
        static S s;
      }
      ```
      
      However this is broken in many other ways on the GPU, so it is not
      regressing any support, simply increasing the scope of what we can
      handle.
      
      This changes the handling of ctors / dtors. This patch now outputs a
      information message regarding the deprecation if the old format is used.
      This will be completely removed in a later release.
      
      Depends on: https://github.com/llvm/llvm-project/pull/71549
      237adfca
    • Alex Langford's avatar
      [lldb] Change interface of StructuredData::Array::GetItemAtIndexAsDictionary (#71961) · 133bcace
      Alex Langford authored
      Similar to my previous patch (#71613) where I changed
      `GetItemAtIndexAsString`, this patch makes the same change to
      `GetItemAtIndexAsDictionary`.
      
      `GetItemAtIndexAsDictionary` now returns a std::optional that is either
      `std::nullopt` or is a valid pointer. Therefore, if the optional is
      populated, we consider the pointer to always be valid (i.e. no need to
      check pointer validity).
      133bcace
    • Peiming Liu's avatar
    • lntue's avatar
      [libc] Fix missing ; in spec.td. (#71977) · de793141
      lntue authored
      de793141
    • Ryosuke Niwa's avatar
      Fix WebKit static analyzers to support ref and deref methods to be defined on... · 09273d40
      Ryosuke Niwa authored
      Fix WebKit static analyzers to support ref and deref methods to be defined on different classes. (#69985)
      
      09273d40
    • Min-Yih Hsu's avatar
      [gold] Enable `MCTargetOptions::AsmVerbose` along with `emit-asm` (#71606) · 9e13d644
      Min-Yih Hsu authored
      Print comments into assembly output if we're using `emit-asm`.
      9e13d644
    • Haojian Wu's avatar
    • Quinn Dawkins's avatar
      [mlir][vector] Notify the rewriter when sinking out of warp ops (#71964) · aa2376a0
      Quinn Dawkins authored
      A number of the warp distribution patterns work by rewriting a warp op
      in place by moving a contained op outside. This notifies the rewriter
      that the warp op is changing in this case.
      aa2376a0
    • Mingming Liu's avatar
      Revert "[Support]Look up in top-level subcommand as a fallback when looking... · 2e912a2b
      Mingming Liu authored
      Revert "[Support]Look up in top-level subcommand as a fallback when looking options for a custom subcommand (#71975)
      
      …ooking options for a custom subcommand. (#71776)"
      
      This reverts commit b88308b1.
      
      The build-bot is unhappy
      (https://lab.llvm.org/buildbot/#/builders/186/builds/13096),
      `GroupingAndPrefix` fails after `TopLevelOptInSubcommand` (the newly
      added test).
      
      Revert while I look into this (might be related with test sharding but
      not sure)
      
      ```
      
      [----------] 3 tests from CommandLineTest
      [ RUN      ] CommandLineTest.TokenizeWindowsCommandLine2
      [       OK ] CommandLineTest.TokenizeWindowsCommandLine2 (0 ms)
      [ RUN      ] CommandLineTest.TopLevelOptInSubcommand
      [       OK ] CommandLineTest.TopLevelOptInSubcommand (0 ms)
      [ RUN      ] CommandLineTest.GroupingAndPrefix
       #0 0x00ba8118 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/home/tcwg-buildbot/worker/clang-armv7-global-isel/stage1/unittests/Support/./SupportTests+0x594118)
       #1 0x00ba5914 llvm::sys::RunSignalHandlers() (/home/tcwg-buildbot/worker/clang-armv7-global-isel/stage1/unittests/Support/./SupportTests+0x591914)
       #2 0x00ba89c4 SignalHandler(int) (/home/tcwg-buildbot/worker/clang-armv7-global-isel/stage1/unittests/Support/./SupportTests+0x5949c4)
       #3 0xf7828530 __default_sa_restorer /build/glibc-9MGTF6/glibc-2.31/signal/../sysdeps/unix/sysv/linux/arm/sigrestorer.S:67:0
       #4 0x00af91f0 (anonymous namespace)::CommandLineParser::ResetAllOptionOccurrences() (/home/tcwg-buildbot/worker/clang-armv7-global-isel/stage1/unittests/Support/./SupportTests+0x4e51f0)
       #5 0x00af8e1c llvm::cl::ResetCommandLineParser() (/home/tcwg-buildbot/worker/clang-armv7-global-isel/stage1/unittests/Support/./SupportTests+0x4e4e1c)
       #6 0x0077cda0 (anonymous namespace)::CommandLineTest_GroupingAndPrefix_Test::TestBody() (/home/tcwg-buildbot/worker/clang-armv7-global-isel/stage1/unittests/Support/./SupportTests+0x168da0)
       #7 0x00bc5adc testing::Test::Run() (/home/tcwg-buildbot/worker/clang-armv7-global-isel/stage1/unittests/Support/./SupportTests+0x5b1adc)
       #8 0x00bc6cc0 testing::TestInfo::Run() (/home/tcwg-buildbot/worker/clang-armv7-global-isel/stage1/unittests/Support/./SupportTests+0x5b2cc0)
       #9 0x00bc7880 testing::TestSuite::Run() (/home/tcwg-buildbot/worker/clang-armv7-global-isel/stage1/unittests/Support/./SupportTests+0x5b3880)
      #10 0x00bd7974 testing::internal::UnitTestImpl::RunAllTests() (/home/tcwg-buildbot/worker/clang-armv7-global-isel/stage1/unittests/Support/./SupportTests+0x5c3974)
      #11 0x00bd6ebc testing::UnitTest::Run() (/home/tcwg-buildbot/worker/clang-armv7-global-isel/stage1/unittests/Support/./SupportTests+0x5c2ebc)
      #12 0x00bb1058 main (/home/tcwg-buildbot/worker/clang-armv7-global-isel/stage1/unittests/Support/./SupportTests+0x59d058)
      #13 0xf78185a4 __libc_start_main /build/glibc-9MGTF6/glibc-2.31/csu/libc-start.c:342:3
      ```
      2e912a2b
    • Dominik Adamski's avatar
      [OMPIRBuilder] Do not call __kmpc_push_num_threads for device parallel (#71934) · f2f5f1bf
      Dominik Adamski authored
      Function __kmpc_push_num_threads should be called only if we specify
      number of threads for host parallel region.
      
      Number of threads specified by the user should be passed as one of
      arguments of __kmpc_parallel_51 function.
      f2f5f1bf