1. Feb 01, 2024
    • Timm Baeder's avatar
      [clang][Interp] Handle imaginary literals (#79130) · 6ff431b0
      Timm Baeder authored
      Initialize the first element to 0 and the second element to the value of
      the subexpression.
      6ff431b0
    • Aiden Grossman's avatar
      [Github] Build stage2-clang-bolt target for CI container · 5d9ffcd7
      Aiden Grossman authored
      Only the stage2-distribution target is built by default for the
      stage2 distribution installation target. This means that we don't get a
      BOLT optimized binary. This patch explicitly builds the
      stage2-clang-bolt target before the distribution installation target so
      that the clang binary is optimized before it gets installed.
      5d9ffcd7
    • Timm Bäder's avatar
      [clang][Interp] complex binary operators aren't always initializing · a8f317ae
      Timm Bäder authored
      The added test case would trigger the removed assertion.
      a8f317ae
    • Jason Molenda's avatar
      Skip 2 of the three test sets to narrow down the arm-ubuntu · fdd98e50
      Jason Molenda authored
      CI bot crash when running this unittest.  The printfs aren't
      printing into the CI log output.
      fdd98e50
    • Emilia Kond's avatar
      [clang-format] Allow decltype in requires clause (#78847) · 9b68c095
      Emilia Kond authored
      If clang-format is not sure whether a `requires` keyword starts a
      requires clause or a requires expression, it looks ahead to see if any
      token disqualifies it from being a requires clause. Among these tokens
      was `decltype`, since it fell through the switch.
      
      This patch allows decltype to exist in a require clause.
      
      I'm not 100% sure this change won't have repercussions, but that just
      means we need more test coverage!
      
      Fixes https://github.com/llvm/llvm-project/issues/78645
      9b68c095
    • Piotr Zegar's avatar
      [clang-tidy] Add AllowStringArrays option to modernize-avoid-c-arrays (#71701) · b777bb78
      Piotr Zegar authored
      Add AllowStringArrays option, enabling the exclusion of array types with
      deduced sizes constructed from string literals. This includes only var
      declarations of array of characters constructed directly from c-strings.
      
      Closes #59475
      b777bb78
    • Chuanqi Xu's avatar
      [C++20] [Modules] Introduce -fskip-odr-check-in-gmf (#79959) · 8eea582d
      Chuanqi Xu authored
      Close https://github.com/llvm/llvm-project/issues/79240
      
      Cite the comment from @mizvekov in
      //github.com/llvm/llvm-project/issues/79240:
      
      > There are two kinds of bugs / issues relevant here:
      >
      > Clang bugs that this change hides
      > Here we can add a Frontend flag that disables the GMF ODR check, just
      > so
      > we can keep tracking, testing and fixing these issues.
      > The Driver would just always pass that flag.
      > We could add that flag in this current issue.
      > Bugs in user code:
      > I don't think it's worth adding a corresponding Driver flag for
      > controlling the above Frontend flag, since we intend it's behavior to
      > become default as we fix the problems, and users interested in testing
      > the more strict behavior can just use the Frontend flag directly.
      
      This patch follows the suggestion:
      - Introduce the CC1 flag `-fskip-odr-check-in-gmf` which is by default
      off, so that the every existing test will still be tested with checking
      ODR violations.
      - Passing `-fskip-odr-check-in-gmf` in the driver to keep the behavior
      we intended.
      - Edit the document to tell the users who are still interested in more
      strict checks can use `-Xclang -fno-skip-odr-check-in-gmf` to get the
      existing behavior.
      8eea582d
    • Shengchen Kan's avatar
      c82a645e
    • Jason Molenda's avatar
      3b76b864
    • Wanyi's avatar
      [llvm-gsymutil] Print one-time DWO file missing warning under --quiet flag (#79882) · 5a8f290d
      Wanyi authored
      FileCheck test added
      ```
      ./bin/llvm-lit -sv llvm/test/tools/llvm-gsymutil/X86/elf-dwo.yaml
      ```
      
      Manual test steps:
      
      - Create binary with split-dwarf:
      ```
      clang++ -g -gdwarf-4 -gsplit-dwarf main.cpp -o main_split
      ```
      
      - Remove or remane the dwo file to a different name so llvm-gsymutil can't find it
      ```
      mv main_split-main.dwo main_split-main__.dwo
      ```
      
      - Now run llvm-gsymutil conversion, it should print out warning with and
      without the `--quiet` flag
      ```
      $ ./bin/llvm-gsymutil --convert=./main_split
      Input file: ./main_split
      Output file (x86_64): ./main_split.gsym
      warning: Unable to retrieve DWO .debug_info section for main_split-main.dwo
      Loaded 0 functions from DWARF.
      Loaded 12 functions from symbol table.
      Pruned 0 functions, ended with 12 total
      ```
      
      ```
      $ ./bin/llvm-gsymutil --convert=./main_split --quiet
      Input file: ./main_split
      Output file (x86_64): ./main_split.gsym
      warning: Unable to retrieve DWO .debug_info section for some object files. (Remove the --quiet flag for full output)
      Pruned 0 functions, ended with 12 total
      ```
      5a8f290d
    • wangpc's avatar
    • LLVM GN Syncbot's avatar
      [gn build] Port 147d7a64 · 19a10c13
      LLVM GN Syncbot authored
      19a10c13
    • Jason Molenda's avatar
      [lldb] Add support for large watchpoints in lldb (#79962) · 147d7a64
      Jason Molenda authored
      This patch is the next piece of work in my Large Watchpoint proposal,
      https://discourse.llvm.org/t/rfc-large-watchpoint-support-in-lldb/72116
      
      This patch breaks a user's watchpoint into one or more
      WatchpointResources which reflect what the hardware registers can cover.
      This means we can watch objects larger than 8 bytes, and we can watched
      unaligned address ranges. On a typical 64-bit target with 4 watchpoint
      registers you can watch 32 bytes of memory if the start address is
      doubleword aligned.
      
      Additionally, if the remote stub implements AArch64 MASK style
      watchpoints (e.g. debugserver on Darwin), we can watch any power-of-2
      size region of memory up to 2GB, aligned to that same size.
      
      I updated the Watchpoint constructor and CommandObjectWatchpoint to
      create a CompilerType of Array<UInt8> when the size of the watched
      region is greater than pointer-size and we don't have a variable type to
      use. For pointer-size and smaller, we can display the watched granule as
      an integer value; for larger-than-pointer-size we will display as an
      array of bytes.
      
      I have `watchpoint list` now print the WatchpointResources used to
      implement the watchpoint.
      
      I added a WatchpointAlgorithm class which has a top-level static method
      that takes an enum flag mask WatchpointHardwareFeature and a user
      address and size, and returns a vector of WatchpointResources covering
      the request. It does not take into account the number of watchpoint
      registers the target has, or the number still available for use. Right
      now there is only one algorithm, which monitors power-of-2 regions of
      memory. For up to pointer-size, this is what Intel hardware supports.
      AArch64 Byte Address Select watchpoints can watch any number of
      contiguous bytes in a pointer-size memory granule, that is not currently
      supported so if you ask to watch bytes 3-5, the algorithm will watch the
      entire doubleword (8 bytes). The newly default "modify" style means we
      will silently ignore modifications to bytes outside the watched range.
      
      I've temporarily skipped TestLargeWatchpoint.py for all targets. It was
      only run on Darwin when using the in-tree debugserver, which was a proxy
      for "debugserver supports MASK watchpoints". I'll be adding the
      aforementioned feature flag from the stub and enabling full mask
      watchpoints when a debugserver with that feature is enabled, and
      re-enable this test.
      
      I added a new TestUnalignedLargeWatchpoint.py which only has one test
      but it's a great one, watching a 22-byte range that is unaligned and
      requires four 8-byte watchpoints to cover.
      
      I also added a unit test, WatchpointAlgorithmsTests, which has a number
      of simple tests against WatchpointAlgorithms::PowerOf2Watchpoints. I
      think there's interesting possible different approaches to how we cover
      these; I note in the unit test that a user requesting a watch on address
      0x12e0 of 120 bytes will be covered by two watchpoints today, a
      128-bytes at 0x1280 and at 0x1300. But it could be done with a 16-byte
      watchpoint at 0x12e0 and a 128-byte at 0x1300, which would have fewer
      false positives/private stops. As we try refining this one, it's helpful
      to have a collection of tests to make sure things don't regress.
      
      I tested this on arm64 macOS, (genuine) x86_64 macOS, and AArch64
      Ubuntu. I have not modifed the Windows process plugins yet, I might try
      that as a standalone patch, I'd be making the change blind, but the
      necessary changes (see ProcessGDBRemote::EnableWatchpoint) are pretty
      small so it might be obvious enough that I can change it and see what
      the Windows CI thinks.
      
      There isn't yet a packet (or a qSupported feature query) for the gdb
      remote serial protocol stub to communicate its watchpoint capabilities
      to lldb. I'll be doing that in a patch right after this is landed,
      having debugserver advertise its capability of AArch64 MASK watchpoints,
      and have ProcessGDBRemote add eWatchpointHardwareArmMASK to
      WatchpointAlgorithms so we can watch larger than 32-byte requests on
      Darwin.
      
      I haven't yet tackled WatchpointResource *sharing* by multiple
      Watchpoints. This is all part of the goal, especially when we may be
      watching a larger memory range than the user requested, if they then add
      another watchpoint next to their first request, it may be covered by the
      same WatchpointResource (hardware watchpoint register). Also one "read"
      watchpoint and one "write" watchpoint on the same memory granule need to
      be handled, making the WatchpointResource cover all requests.
      
      As WatchpointResources aren't shared among multiple Watchpoints yet,
      there's no handling of running the conditions/commands/etc on multiple
      Watchpoints when their shared WatchpointResource is hit. The goal beyond
      "large watchpoint" is to unify (much more) the Watchpoint and Breakpoint
      behavior and commands. I have a feeling I may be slowly chipping away at
      this for a while.
      
      Re-landing this patch after fixing two undefined behaviors in
      WatchpointAlgorithms found by UBSan and by failures on different
      CI bots.
      
      rdar://108234227
      147d7a64
    • martinboehme's avatar
      [clang][dataflow] Display line numbers in the HTML logger timeline. (#80130) · 0c361270
      martinboehme authored
      This makes it easier to count how many iterations an analysis takes to
      complete.
      It also makes it easier to compare how a change to the analysis code
      affects
      the timeline.
      
      Here's a sample screenshot:
      
      
      ![image](https://github.com/llvm/llvm-project/assets/29098113/b3f44b4d-7037-4f28-9532-5418663250e1)
      0c361270
    • martinboehme's avatar
    • Owen Pan's avatar
      [clang-format] Simplify the AfterPlacementOperator option (#79796) · 908fd09a
      Owen Pan authored
      Change AfterPlacementOperator to a boolean and deprecate SBPO_Never,
      which meant never inserting a space except when after new/delete.
      
      Fixes #78892.
      908fd09a
    • Owen Pan's avatar
      [clang][NFC] Move isSimpleTypeSpecifier() from Sema to Token (#80101) · a8279a8b
      Owen Pan authored
      So that it can be used by clang-format.
      a8279a8b
    • Yi Kong's avatar
    • Jakub Kuderski's avatar
      [mlir][arith] Improve `truncf` folding (#80206) · 730f498c
      Jakub Kuderski authored
      * Use APFloat conversion function instead of going through double to
      check if fold results in information loss.
      * Support folding vector constants.
      730f498c
    • Diego Caballero's avatar
      [mlir][Vector] Add support for sub-byte transpose emulation (#80110) · 8ba018d7
      Diego Caballero authored
      This PR adds patterns to convert a sub-byte vector transpose into a
      sequence of instructions that perform the transpose on i8 vector
      elements. Whereas this rewrite may not lead to the absolute peak
      performance, it should ensure correctness when dealing with sub-byte
      transposes.
      8ba018d7
    • michaelrj-google's avatar
      [libc] Fix read under msan (#80203) · 0e8eb445
      michaelrj-google authored
      The read function wasn't properly unpoisoning its result under msan,
      causing test failures downstream when I tried to roll it out. This patch
      adds the msan unpoison call that fixes the issue.
      0e8eb445
    • Nick Desaulniers's avatar
      [libc][docs] fix stdbit.h docs (#80070) · 0e0d155f
      Nick Desaulniers authored
      Fix rst comment, add checks for recently implemented functions+macro.
      0e0d155f
    • Craig Topper's avatar
      [RISCV] Use Zacas for AtomicRMWInst::Nand i32 and XLen. (#80119) · cf401f72
      Craig Topper authored
      We don't have an AMO instruction for Nand, so with the A extension we
      use an LR/SC loop. If we have Zacas we can use a CAS loop instead.
      
      According to the Zacas spec, a CAS loop scales to highly parallel
      systems better than LR/SC.
      cf401f72
    • Chelsea Cassanova's avatar
      Revert "Reland "[lldb][progress][NFC] Add unit test for progress reports (#79533)"" · 40ebe522
      Chelsea Cassanova authored
      This reverts commit a5a8cbb1.
      
      The test being added by that commit still fails on the assertion that
      Debugger::Initialize has been called more than once.
      40ebe522
    • Congcong Cai's avatar
    • Chelsea Cassanova's avatar
      Reland "[lldb][progress][NFC] Add unit test for progress reports (#79533)" · a5a8cbb1
      Chelsea Cassanova authored
      This reverts commit 209fe1f3.
      
      The original commit failed to due an assertion failure in the unit test
      `ProgressReportTest` that the commit added. The Debugger::Initialize()
      function was called more than once which triggered the assertion, so
      this commit calls that function under a `std::call_once`.
      a5a8cbb1
    • Yaxun (Sam) Liu's avatar
      Partial revert "[HIP] Fix -mllvm option for device lld linker" (#80202) · 7c2e32d6
      Yaxun (Sam) Liu authored
      This partially reverts commit aa964f15
      because it caused perf regressions in rccl due to drop of -mllvm
      -amgpu-kernarg-preload-count=16 from the linker step. Potentially it
      could cause similar regressions for other HIP apps using -mllvm options
      with -fgpu-rdc.
      
      Fixes: SWDEV-443345
      7c2e32d6
    • Philip Reames's avatar
      [lsr][term-fold] Restrict transform to low cost expansions (#74747) · f264da43
      Philip Reames authored
      This is a follow up to an item I noted in my submission comment for
      e947f953. I don't have a real world example where this is triggering
      unprofitably, but avoiding the transform when we estimate the loop to be
      short running from profiling seems quite reasonable. It's also now come
      up as a possibility in a regression twice in two days, so I'd like to
      get this in to close out the possibility if nothing else.
      
      The original review dropped the threshold for short trip count loops. I
      will return to that in a separate review if this lands.
      f264da43
    • Alex Langford's avatar
      [lldb][NFCI] Remove m_being_created from Breakpoint classes (#79716) · db68e922
      Alex Langford authored
      The purpose of m_being_created in these classes was to prevent
      broadcasting an event related to these Breakpoints during the creation
      of the breakpoint (i.e. in the constructor). In Breakpoint and
      Watchpoint, m_being_created had no effect. That is to say, removing it
      does not change behavior.
      However, BreakpointLocation does still use m_being_created. In the
      constructor, SetThreadID is called which does broadcast an event only if
      `m_being_created` is false. Instead of having this logic be roundabout,
      the constructor instead calls `SetThreadIDInternal`, which actually
      changes the thread ID. `SetThreadID` also will call
      `SetThreadIDInternal` in addition to broadcasting a changed event.
      db68e922
    • Philip Reames's avatar
      [RISCV] Improve legalization of e8 m8 VL>256 shuffles (#79330) · ff53d507
      Philip Reames authored
      If we can't produce a large enough index vector in i8, we may need to legalize
      the shuffle (via scalarization - which in turn gets lowered into stack usage).
      This change makes two related changes:
      * Deferring legalization until we actually need to generate the vrgather
        instruction.  With the new recursive structure, this only happens when
        doing the fallback for one of the arms.
      * Check the actual mask values for something outside of the representable
        range.
      
      Both are covered by recently added tests.
      ff53d507
    • Alex MacLean's avatar
      [NVPTX] improve Boolean ISel (#80166) · 5e3ae4c4
      Alex MacLean authored
      Add TableGen patterns to convert more instructions to boolean
      expressions:
      
      - **mul -> and/or**: i1 multiply instructions currently cannot be
      selected causing the compiler to crash. See
      https://github.com/llvm/llvm-project/issues/57404
      - **select -> and/or**: Converting selects to and/or can enable more
      optimizations. `InstCombine` cannot do this as aggressively due to
      poison semantics.
      5e3ae4c4
    • Valentin Clement's avatar
      [flang][hlfir][NFC] Fix typo · 0f728a08
      Valentin Clement authored
      0f728a08
    • Konstantin Zhuravlyov's avatar
    • Usman Nadeem's avatar
      [AArch64][SVE2] Generate urshr rounding shift rights (#78374) · 1d143235
      Usman Nadeem authored
      Add a new node `AArch64ISD::URSHR_I_PRED`.
      
      `srl(add(X, 1 << (ShiftValue - 1)), ShiftValue)` is transformed to
      `urshr`, or to `rshrnb` (as before) if the result it truncated.
      
      `uzp1(rshrnb(uunpklo(X),C), rshrnb(uunpkhi(X), C))` is converted to
      `urshr(X, C)` (tested by the wide_trunc tests).
      
      Pattern matching code in `canLowerSRLToRoundingShiftForVT` is taken
      from prior code in rshrnb. It returns true if the add has NUW or if the
      number of bits used in the return value allow us to not care about the
      overflow (tested by rshrnb test cases).
      1d143235
    • Artem Dergachev's avatar
      [analyzer] Unbreak [[clang::suppress]] on checkers without decl-with-issue. (#79398) · 56e241a0
      Artem Dergachev authored
      
      
      There are currently a few checkers that don't fill in the bug report's
      "decl-with-issue" field (typically a function in which the bug is
      found).
      
      The new attribute `[[clang::suppress]]` uses decl-with-issue to reduce
      the size of the suppression source range map so that it didn't need to
      do that for the entire translation unit.
      
      I'm already seeing a few problems with this approach so I'll probably
      redesign it in some point as it looks like a premature optimization. Not
      only checkers shouldn't be required to pass decl-with-issue (consider
      clang-tidy checkers that never had such notion), but also it's not
      necessarily uniquely determined (consider leak suppressions at
      allocation site).
      
      For now I'm adding a simple stop-gap solution that falls back to
      building the suppression map for the entire TU whenever decl-with-issue
      isn't specified. Which won't happen in the default setup because luckily
      all default checkers do provide decl-with-issue.
      
      ---------
      
      Co-authored-by: default avatarBalazs Benics <benicsbalazs@gmail.com>
      56e241a0
    • Zaara Syeda's avatar
      [AIX] [XCOFF] Add support for common and local common symbols in the TOC (#79530) · a03a6e99
      Zaara Syeda authored
      
      
      This patch adds support for common and local symbols in the TOC for AIX.
      Note that we need to update isVirtualSection so as a common symbol in
      TOC will have the symbol type XTY_CM and will be initialized when placed
      in the TOC so sections with this type are no longer virtual.
      
      ---------
      
      Co-authored-by: default avatarZaara Syeda <syzaara@ca.ibm.com>
      a03a6e99
    • michaelrj-google's avatar
      [libc] Fix condition ordering in scanf (#80083) · 22773e59
      michaelrj-google authored
      The inf and nan string index bounds checks were after the index was
      being used. This patch moves the index usage to the end of the
      condition.
      
      Fixes #79988
      22773e59
    • lhames's avatar
      [ORC] Merge MaterializationResponsibility notifyEmitted and addDependencies · ebe8733a
      lhames authored
      Removes the MaterializationResponsibility::addDependencies and
      addDependenciesForAll methods, and transfers dependency registration to
      the notifyEmitted operation. The new dependency registration allows
      dependencies to be specified for arbitrary subsets of the
      MaterializationResponsibility's symbols (rather than just single symbols
      or all symbols) via an array of SymbolDependenceGroups (pairs of symbol
      sets and corresponding dependencies for that set).
      
      This patch aims to both improve emission performance and simplify
      dependence tracking. By eliminating some states (e.g. symbols having
      registered dependencies but not yet being resolved or emitted) we make
      some errors impossible by construction, and reduce the number of error
      cases that we need to check. NonOwningSymbolStringPtrs are used for
      dependence tracking under the session lock, which should reduce
      ref-counting operations, and intra-emit dependencies are resolved
      outside the session lock, which should provide better performance when
      JITing concurrently (since some dependence tracking can happen in
      parallel).
      
      The Orc C API is updated to account for this change, with the
      LLVMOrcMaterializationResponsibilityNotifyEmitted API being modified and
      the LLVMOrcMaterializationResponsibilityAddDependencies and
      LLVMOrcMaterializationResponsibilityAddDependenciesForAll operations
      being removed.
      ebe8733a
    • Aiden Grossman's avatar
      [Github] Build PGO optimized toolchain in container (#80096) · 9107904e
      Aiden Grossman authored
      This patch adjusts the Docker container intended for CI use to contain a
      PGO+ThinLTO+BOLT optimized clang. The toolchain is built within a Github
      action and takes ~3.5 hours. No caching is utilized. The current PGO
      optimization is fairly minimal, only running clang over hello world.
      This can be adjusted as needed.
      9107904e
    • Philip Reames's avatar
      [LSR] Add a test case mentioned in review · 5282202d
      Philip Reames authored
      As mentioned in https://github.com/llvm/llvm-project/pull/74747, this case is triggering a particularly high cost trip count expansion.
      5282202d