1. Jan 12, 2024
    • paperchalice's avatar
      [CodeGen] Make CodeGenPassBuilder Pipeline test x86-64 only (#77860) · 17c062c0
      paperchalice authored
      Should fix arm build bots
      17c062c0
    • Joseph Huber's avatar
      [OpenMP] Fix or disable NVPTX tests failing currently (#77844) · ab02372c
      Joseph Huber authored
      Summary:
      This patch is an attempt to get a clean run of `check-openmp` running on
      an NVPTX machine. I simply took the lists of tests that failed on my
      `sm_89` machine and disabled them or fixed them. A lot of these tests
      are disabled on AMDGPU already, so it makes sense that NVPTX fails. The
      others are simply problems with NVPTX optimized debugging which will
      need to be fixed. I opened an issue on one of them.
      ab02372c
    • Tom Stellard's avatar
      github-automation: Use the llvm/llvm-project repo for backport pull requests (#71727) · f33e9276
      Tom Stellard authored
      Now that the project uses PRs for code review, we don't need to use the
      llvm/llvm-project-release-prs repo for reviewing backports.
      f33e9276
    • Tom Stellard's avatar
      [CMake][Release] Add option for enabling LTO to cache file (#77035) · 3ef20e3f
      Tom Stellard authored
      This option is LLVM_RELEASE_ENABLE_LTO and it's turned on by default.
      3ef20e3f
    • Haowei's avatar
      [llvm-ifs] Treat unknown symbol types as error. (#75872) · 8e9c5319
      Haowei authored
      Before this patch, when an unknown symbol type is used in IFS stub, it
      will be treated as a NO_TYPE and parsed without error. This patch makes
      llvm-ifs throw an error when this scenario happens.
      8e9c5319
    • Matthew Voss's avatar
      [clang][FatLTO][UnifiedLTO] Pass -enable-matrix to the LTO driver · f626b1f4
      Matthew Voss authored
      Unified LTO and Fat LTO do not use the regular LTO prelink pipeline when
      -flto/-flto=full is specified on the command line, thus they require
      LowerMatrixIntrinsicsPass to be run during the link stage. To enable
      this, we pass -enable-matrix to the LTO driver, replicating ThinLTO
      behavior. This fix was applied to ThinLTO in https://reviews.llvm.org/D153583.
      
      This fixes #77621.
      f626b1f4
    • LLVM GN Syncbot's avatar
      [gn build] Port ae1c1ed6 · 22bc74e4
      LLVM GN Syncbot authored
      22bc74e4
    • paperchalice's avatar
      [CodeGen] Allow `CodeGenPassBuilder` to add module pass after function pass (#77084) · ae1c1ed6
      paperchalice authored
      In fact, there are several backends, e.g. AArch64, AMDGPU etc. add
      module pass after function pass, this patch removes this constraint.
      This patch also adds a simple unit test for `CodeGenPassBuilder`.
      ae1c1ed6
    • Nico Weber's avatar
      [clang] Mark clang-format-ignore.cpp as unsupported on Windows · dc61ebb4
      Nico Weber authored
      To heal bots that have been broken for days while discussions on
      https://github.com/llvm/llvm-project/pull/76733 are ongoing.
      dc61ebb4
    • Alexandre Ganea's avatar
      [llvm-driver] Fix usage of `InitLLVM` on Windows (#76306) · 3c6f47d6
      Alexandre Ganea authored
      Previously, some tools such as `clang` or `lld` which require strict
      order for certain command-line options, such as `clang -cc1` or `lld
      -flavor`, would not longer work on Windows, when these tools were linked
      as part of `llvm-driver`. This was caused by `InitLLVM` which was part
      of the `*_main()` function of these tools, which in turn calls
      `windows::GetCommandLineArguments`. That function completly replaces
      argc/argv by new UTF-8 contents, so any ajustements to argc/argv made by
      `llvm-driver` prior to calling these tools was reset.
      
      `InitLLVM` is now called by the `llvm-driver`. Any tool that
      participates in (or is part of) the `llvm-driver` doesn't call
      `InitLLVM` anymore.
      3c6f47d6
    • Alexandre Ganea's avatar
      [LLD] Fix llvm-driver cmake integration for LLD (#76305) · 4cee0e3c
      Alexandre Ganea authored
      Previously, even though LLD was linked as part of llvm-driver when using
      `cmake ... -DLLVM_TOOL_LLVM_DRIVER_BUILD=ON`, there were build issues
      when compiling incrementally. Sometimes link errors when linking LLD,
      other times, the `llvm.exe` would be impropely be replaced by `lld.exe`.
      4cee0e3c
    • PiJoules's avatar
      [compiler-rt][fuchsia] Preallocate a vmar for sanitizer internals (#75256) · 93b47053
      PiJoules authored
      In an effort to reduce more mmap fragmentation, allocate a large enough
      vmar where we can map sanitizer internals via DoAnonymousMmap. Objects
      being mapped here include asan's FakeStack, LowLevelAllocator mappings,
      the primary allocator's TwoLevelMap, InternalMmapVector, StackStore, and
      asan's thread internals. The vmar is large enough to hold the total size
      of these objects seen in a "typical" process lifetime. If the vmar is
      full, it will fallback to mapping in the root vmar.
      93b47053
    • Artem Dergachev's avatar
      [analyzer] NFC: Don't regenerate duplicate HTML reports. · 721dd3bc
      Artem Dergachev authored
      This is a performance optimization for HTML diagnostics output mode.
      
      Currently they're incredibly inefficient:
      
      * The HTMLRewriter is re-run from scratch on every file on every report.
        Each such re-run involves re-lexing the entire file and producing
        a syntax-highlighted webpage of the entire file, with text behind macros
        duplicated as pop-up macro expansion tooltips. Then, warning and note
        bubbles are injected into the page. Only the bubble part is different
        across reports; everything else can theoretically be cached.
      
      * Additionally, if duplicate reports are emitted (with the same issue hash),
        HTMLRewriter will be re-run even though the output file is going to be
        discarded due to filename collision. This is mostly an issue for
        path-insensitive bug reports because path-sensitive bug reports
        are already deduplicated by the BugReporter as part of searching
        for the shortest bug path. But on some translation units almost 80% of
        bug reports are dry-run here.
      
      We only get away with all this because there are usually very few reports
      emitted per file. But if loud checkers are enabled, such as `webkit.*`,
      this may explode in complexity and even cause the compiler to run over
      the 32-bit SourceLocation addressing limit. (We're re-lexing everything
      each time, remember?)
      
      This patch hotfixes the *second* problem. Adds a FIXME for the first problem,
      which will require more yak shaving to solve.
      
      rdar://120801986
      721dd3bc
    • Ivan Butygin's avatar
      Revert "[mlir][arith] Add overflow flags support to arith ops (#77211)" · 5f59b720
      Ivan Butygin authored
      Temporarily reverting as it broke python bindings
      
      This reverts commit a7262d2d.
      5f59b720
    • Ivan Butygin's avatar
      Revert "[mlir][arith][nfc] Fix typos (#77700)" · 5afc4f3a
      Ivan Butygin authored
      Temporarily reverting as it broke python bindings
      
      This reverts commit 9ed30012.
      5afc4f3a
    • Ivan Butygin's avatar
      Revert "[mlir][spirv] Lower `arith` overflow flags to corresponding SPIR-V op decorations (#77714)" · 649b3917
      Ivan Butygin authored
      Temporaryly reverting as it broke python bindings
      
      This reverts commit 4278d9b5.
      649b3917
    • James Y Knight's avatar
      Set the default value for MaxAtomicSizeInBitsSupported to 0. · b58f91a3
      James Y Knight authored
      This was planned since its introduction, but wasn't rolled out for a
      little bit longer than intended (ahem...8 years).
      
      All in-tree targets have now been adjusted to call
      setMaxAtomicSizeInBitsSupported explicitly where required, so this
      should be a no-op. The docs in docs/Atomics.rst already claimed the
      default was 0, so that doesn't need updating.
      b58f91a3
    • Jakub Kuderski's avatar
      [mlir] Add op printing flag to skip regions (#77726) · 35132677
      Jakub Kuderski authored
      The new flag, `--mlir-print-skip-regions`, sets the op printing option
      that disables region printing. This results in the usual
      `--mlir-print-ir-*` debug options printing only the names of the
      executed passes and the signatures of the ops.
      
      Example:
      ```mlir
      // -----// IR Dump Before CSE (cse) //----- //
      func.func @bar(%arg0: f32, %arg1: f32) -> f32 {...}
      
      // -----// IR Dump Before Canonicalizer (canonicalize) //----- //
      func.func @bar(%arg0: f32, %arg1: f32) -> f32 {...}
      ```
      
      The main use-case is to be triage compilation issues (crashes, slowness)
      on very deep pass pipelines and with very large IR files, where printing
      IR is prohibitively slow otherwise.
      35132677
    • Amir Ayupov's avatar
      [BOLT] Delta-encode function start addresses in BAT (#76902) · 8fb8ad66
      Amir Ayupov authored
      Further reduce the size of BAT section:
      - large binary: to 12716312 bytes (0.33x original),
      - medium binary: to 1649472 bytes (0.28x original),
      - small binary: to 428 bytes (0.30x original).
      
      Test Plan: Updated bolt/test/X86/bolt-address-translation.test
      8fb8ad66
    • Amir Ayupov's avatar
      [BOLT] Delta-encode offsets in BAT (#76900) · bbe07989
      Amir Ayupov authored
      This change further reduces the size of BAT:
      - large binary: to 13073904 bytes (0.34x original),
      - medium binary: to 1703116 bytes (0.29x original),
      - small binary: to 436 bytes (0.30x original).
      
      Test Plan: Updated bolt/test/X86/bolt-address-translation.test
      bbe07989
    • a-n-n-a-l-e-e's avatar
      [libc++] Re-export libc++abi symbols on Apple platforms when using system-libcxxabi (#77218) · b3981edb
      a-n-n-a-l-e-e authored
      When using LIBCXX_CXX_ABI=system-libcxxabi on Apple platforms, we would not
      re-export the libc++abi symbols unlike when LIBCXX_CXX_ABI=libcxxabi. This
      was caused by overly strict string matching in CMake.
      
      https://github.com/NixOS/nixpkgs/issues/269548
      b3981edb
    • Fangrui Song's avatar
      [asan] Enable StackSafetyAnalysis by default · 7740565f
      Fangrui Song authored
      StackSafetyAnalysis determines whether stack-allocated variables are
      guaranteed to be safe from memory access bugs and enables the removal of
      certain unneeded instrumentations.
      (hwasan enables StackSafetyAnalysis in https://reviews.llvm.org/D108381)
      
      In a release build of clang, text sections are 9% smaller.
      
      Test updates:
      
      * asan-stack-safety.ll: test the -asan-use-stack-safety=1 default
      * lifetime-uar-uas.ll: switch to an indexed store to prevent
        StackSafetyAnalysis from optimizing out instrumentation for %c
      * alloca_vla_interact.cpp: add a load to prevent StackSafetyAnalysis
        from optimizing out `__asan_alloca_poison` for the VLA `array`
      * scariness_score_test.cpp: add -asan-use-stack-safety=0 to make a load
        of a `__asan_poison_memory_region`-poisoned local variable fail as
        intended.
      * other .ll tests: add -asan-use-stack-safety=0
      
      Reviewed By: kstoimenov
      
      Pull Request: https://github.com/llvm/llvm-project/pull/77210
      7740565f
    • Valentin Clement's avatar
    • Fangrui Song's avatar
      [StackSafetyAnalysis] Bail out if MemIntrinsic length is -1 (#77837) · a6d40170
      Fangrui Song authored
      Clang generates llvm.memset.p0.i64 with a length of -1 for the following
      code in
      `-stdlib=libc++ -std=c++20` mode
      
      (https://github.com/llvm/llvm-project/pull/77210#issuecomment-1887650010)
      ```cpp
      bool strtof_clamp(const std::string &str);
      void floatsuffix_check(char *yytext_r) {
        std::string text = yytext_r;
        text.resize(text.size() - 1);
        strtof_clamp(text);
      }
      ```
      
      `Sizes = [0xffffffffffffffff, 0)`. `SizeRange = [0, 0-1)`, leading to
      `assert(!isUnsafe(SizeRange));` failure. Bail out if the length is -1.
      Other negative values are handled by the existing condition.
      a6d40170
    • Valentin Clement (バレンタイン クレメン)'s avatar
      [flang][openacc] Do not accept static and num for gang clause on routine dir (#77673) · 238b5790
      Only the dim argument is allowed on the gang clause for the routine
      directive. Reject static and num arguments in the semantic check.
      238b5790
    • Andy Kaylor's avatar
      Add sync-up for floating-point working group (#71885) · 8b61fc71
      Andy Kaylor authored
      Adding a new working group to discuss floating-point issues
      8b61fc71
    • Daniel Thornburgh's avatar
      [Fuchsia] Add stage2 cmake options · 69bc30b9
      Daniel Thornburgh authored
      69bc30b9
    • Philip Reames's avatar
      Revert "[LSR][TTI][RISCV] Disable terminator folding for RISC-V." · 5ce067d5
      Philip Reames authored
      This reverts commit fdb87640, and thus
      re-enables terminator folding for RISCV.  The reported miscompile has
      been fixed in f5dd70c5.
      5ce067d5
    • Valentin Clement (バレンタイン クレメン)'s avatar
      [flang][openacc] Apply mutually exclusive clauses restriction to routine (#77802) · bdfe5d69
      this patch enforce or fix the enforcement of two restrictions from
      section 2.15.1:
      
      > Only the gang, worker, vector, seq and bind clauses may follow a
      device_type clause.
      
      `seq` was not allowed after `device_type` with the current
      implementation.
      
      > Exactly one of the gang, worker, vector, or seq clauses must appear.
      
      This was not properly checked. This patch check correctly for mutually
      exclusion as described in section 2.4. Mutually exclusive clauses may
      appear on the same directive if they apply for different device_type.
      bdfe5d69
    • Krzysztof Parzyszek's avatar
      Revert "[Flang][Parser] Add missing dependencies to CMakeLists.txt (#77483)" · d4473047
      Krzysztof Parzyszek authored
      This reverts commit cc53ec82.
      
      This commit hasn't accomplished anything. The original issue was that
      `DumpTree`, when called from lowering, caused linker errors due to some
      directive-naming functions being absent. Adding FrontendOpenMP to the
      parser library didn't fix that problem, and according to the notes in
      PR #77483, calling `DumpTree` from lowering isn't really supported.
      d4473047
    • Valentin Clement (バレンタイン クレメン)'s avatar
      [mlir][openacc][flang] Simplify gang, vector and worker representation (#77667) · 40f5f905
      The IR representation for gang, vector and worker has grown with the
      support for device_type. This patch simplify the IR representation for
      gang, vector and worker information on the acc.loop operation.
      
      When the only the keyword is present without any values, the information
      is printed at the same place than when there is values. The device_type
      is omitted if there is no values and it is equal to None. Otherwise the
      full information is displayed. First the keyword only device_type
      information and then the values with their device_type.
      40f5f905
    • Joseph Huber's avatar
      [Libomptarget] Fix GPU Dtors referencing possibly deallocated image (#77828) · 37c1a5e3
      Joseph Huber authored
      Summary:
      The constructors and destructors look up a symbol in the ELF quickly to
      determine if they need to be run on the GPU. This allows us to avoid the
      very slow actions required to do the slower lookup using the vendor API.
      
      One problem occurs with how we handle the lifetime of these images.
      Right now there is no invariant to specify the lifetime of the
      underlying binary image that is loaded. In the typical case, this comes
      from the binary itself in the `.llvm.offloading` section, meaning that
      the lifetime of the binary should match the executable itself. This
      would work fine, if it weren't for the fact that the plugin is loaded
      via `dlopen` and can have a teardown order out of sync with the main
      executable.
      
      This was likely what was occuring when this failed on some systems but
      not others. A potential solution would be to simply copy images into
      memory so the runtime does not rely on external references. Another
      would be to manually zero these out after initialization as to prevent
      this mistake from happening accidentally. The former has the benefit of
      making some checks easier, and allowing for constant initialization be
      done on the ELF itself (normally we can't do this because writing to a
      constant section, e.g. .llvm.offloading is a segfault.). The downside
      would be the extra time required to copy the image in bulk (Although we
      are likely doing this in the vendor runtimes as well).
      
      This patch went with a quick solution to simply set a boolean value at
      initialization time if we need to call destructors.
      
      Fixes: https://github.com/llvm/llvm-project/issues/77798
      37c1a5e3
    • Tacet's avatar
      [ASan][libc++] Initialize `__r_` variable with lambda (#77394) · 75efddba
      Tacet authored
      This commit is a refactor (increases readability) and optimization fix.
      
      This is a fixed commit of
      https://github.com/llvm/llvm-project/pull/76200 First reverthed here:
      https://github.com/llvm/llvm-project/commit/1ea7a56057492d9da1124787a9855cc2edca7df9
      
      Please, check original PR for details.
      
      The difference is a return type of the lambda.
      
      Original description:
      
      This commit addresses optimization and instrumentation challenges
      encountered within comma constructors.
      1) _LIBCPP_STRING_INTERNAL_MEMORY_ACCESS does not work in comma
      constructors.
      2) Code inside comma constructors is not always correctly optimized.
      Problematic code examples:
      - `: __r_(((__str.__is_long() ? 0 : (__str.__annotate_delete(), 0)),
      std::move(__str.__r_))) {`
      - `: __r_(__r_([&](){ if(!__s.__is_long()) __s.__annotate_delete();
      return std::move(__s.__r_);}())) {`
      
      However, lambda with argument seems to be correctly optimized. This
      patch uses that fact.
      
      Use of lambda based on idea from @ldionne.
      75efddba
    • Zequan Wu's avatar
      Revert "[asan] Enable StackSafetyAnalysis by default" · e7f79487
      Zequan Wu authored
      This reverts commit 51fbab13.
      This causes the compiler to crash. Will file a issue to track the status.
      e7f79487
    • Kazu Hirata's avatar
      [Dialect] Fix a warning · 3e82663b
      Kazu Hirata authored
      This patch fixes:
      
        mlir/lib/Dialect/MemRef/IR/MemRefOps.cpp:3154:8: error: unused
        variable 'rank' [-Werror,-Wunused-variable]
      3e82663b
    • Amir Ayupov's avatar
      [BOLT] Encode BAT using ULEB128 (#76899) · 565f40d6
      Amir Ayupov authored
      Reduces BAT section size, bytes:
      - large binary: 38676872 -> 23262524 (0.60x),
      - medium binary (trunk clang): 5938004 -> 3213504 (0.54x),
      - small binary (X86/bolt-address-translation.test): 1436 -> 680 (0.47x).
      
      Test Plan: Updated bolt/test/X86/bolt-address-translation.test
      565f40d6
    • Amir Ayupov's avatar
      [BOLT] Add BOLT Address Translation documentation (#76899) · a7cf0a1f
      Amir Ayupov authored
      Test Plan: Open the page in browser
      a7cf0a1f
    • Kazu Hirata's avatar
      [flang] Fix a warning · fb094471
      Kazu Hirata authored
      This patch fixes:
      
        flang/unittests/Runtime/CommandTest.cpp:702:14: error: variable
        length arrays are a C99 feature [-Werror,-Wvla-extension]
      fb094471
    • Kazu Hirata's avatar
      [Format] Fix a warning · cf3421de
      Kazu Hirata authored
      This patch fixes:
      
        clang/unittests/Format/TokenAnnotatorTest.cpp:2181:29: error: lambda
        capture 'Style' is not used [-Werror,-Wunused-lambda-capture]
      cf3421de
    • Kazu Hirata's avatar
      [flang] Fix a warning · 18734f60
      Kazu Hirata authored
      This patch fixes:
      
        flang/runtime/extensions.cpp:111:12: error: variable length arrays
        are a C99 feature [-Werror,-Wvla-extension]
      18734f60