1. Jun 11, 2023
  2. Jun 02, 2023
  3. Jun 01, 2023
    • Paul Walker's avatar
      [Clang][Sema] Fix invalid cast when validating SVE types within CheckVariableDeclarationType. · ad815b67
      Paul Walker authored
      Fixes #62087
      
      Differential Revision: https://reviews.llvm.org/D148919
      
      (cherry picked from commit 2bb7e00b)
      ad815b67
    • Mariya Podchishchaeva's avatar
      [clang] Fix crash when handling nested immediate invocations · cf85b3e5
      Mariya Podchishchaeva authored
      Before this patch it was expected that if there was several immediate
      invocations they all belong to the same expression evaluation context.
      During parsing of non local variable initializer a new evaluation context is
      pushed, so code like this
      ```
      namespace scope {
      struct channel {
          consteval channel(const char* name) noexcept { }
      };
      consteval const char* make_channel_name(const char* name) { return name;}
      
      channel rsx_log(make_channel_name("rsx_log"));
      }
      ```
      produced a nested immediate invocation whose subexpressions are attached
      to different expression evaluation contexts. The constructor call
      belongs to TU context and `make_channel_name` call to context of
      variable initializer.
      
      This patch removes this assumption and adds tracking of previously
      failed immediate invocations, so it is possible when handling an
      immediate invocation th check that its subexpressions from possibly another
      evaluation context contains errors and not produce duplicate
      diagnostics.
      
      Fixes https://github.com/llvm/llvm-project/issues/58207
      
      Reviewed By: aaron.ballman, shafik
      
      Differential Revision: https://reviews.llvm.org/D146234
      
      (cherry picked from commit a5e1a93e)
      cf85b3e5
    • Qiongsi Wu's avatar
      [CMake][AIX] Fixing AIX rpath · e32cbe93
      Qiongsi Wu authored
      Recent commit https://github.com/llvm/llvm-project/commit/8f833f88ab78265a8e0ebb0d1522771d67c708a9 modified the installation rpath and did not set `BUILD_WITH_INSTALL_RPATH` correctly on AIX, which led to installation failures on AIX. This patch sets `BUILD_WITH_INSTALL_RPATH` on AIX to fix the installation failures.
      
      Reviewed By: buttaface, daltenty
      
      Differential Revision: https://reviews.llvm.org/D148866
      
      (cherry picked from commit 887828d5)
      e32cbe93
    • Butta's avatar
      [CMake] Don't set absolute paths as install runpaths on ELF platforms in llvm_setup_rpath() · b98da4c7
      Butta authored
      If any LLVM subprojects are built separately, the LLVM build directory
      LLVM_LIBRARY_DIR is added to both the build and install runpaths in
      llvm_setup_rpath(), which is incorrect when installed. Separate the
      build and install runpaths on ELF platforms and finally remove the
      incorrect call to this function for compiler-rt, as previously attempted
      in 21c008d5. That prior attempt was reverted in 959dbd17, where it
      was said to break the build on macOS and Windows, so I made sure to keep
      those platforms the same.
      
      Two examples of incorrect runpaths that are currently added, one from
      the latest LLVM 16 toolchain for linux x86_64:
      
        > readelf -d clang+llvm-16.0.0-x86_64-linux-gnu-ubuntu-18.04/lib/clang/16/lib/x86_64-unknown-linux-gnu/libclang_rt.*so | ag "File:|runpath"
        File: clang+llvm-16.0.0-x86_64-linux-gnu-ubuntu-18.04/lib/clang/16/lib/x86_64-unknown-linux-gnu/libclang_rt.asan.so
        0x000000000000001d (RUNPATH)            Library runpath: [$ORIGIN/../lib:/tmp/llvm_release/final/Phase3/Release/llvmCore-16.0.0-final.obj/./lib]
        File: clang+llvm-16.0.0-x86_64-linux-gnu-ubuntu-18.04/lib/clang/16/lib/x86_64-unknown-linux-gnu/libclang_rt.dyndd.so
        0x000000000000001d (RUNPATH)            Library runpath: [$ORIGIN/../lib:/tmp/llvm_release/final/Phase3/Release/llvmCore-16.0.0-final.obj/./lib]
        File: clang+llvm-16.0.0-x86_64-linux-gnu-ubuntu-18.04/lib/clang/16/lib/x86_64-unknown-linux-gnu/libclang_rt.hwasan_aliases.so
        0x000000000000001d (RUNPATH)            Library runpath: [$ORIGIN/../lib:/tmp/llvm_release/final/Phase3/Release/llvmCore-16.0.0-final.obj/./lib]
        File: clang+llvm-16.0.0-x86_64-linux-gnu-ubuntu-18.04/lib/clang/16/lib/x86_64-unknown-linux-gnu/libclang_rt.hwasan.so
        0x000000000000001d (RUNPATH)            Library runpath: [$ORIGIN/../lib:/tmp/llvm_release/final/Phase3/Release/llvmCore-16.0.0-final.obj/./lib]
        File: clang+llvm-16.0.0-x86_64-linux-gnu-ubuntu-18.04/lib/clang/16/lib/x86_64-unknown-linux-gnu/libclang_rt.memprof.so
        0x000000000000001d (RUNPATH)            Library runpath: [$ORIGIN/../lib:/tmp/llvm_release/final/Phase3/Release/llvmCore-16.0.0-final.obj/./lib]
        File: clang+llvm-16.0.0-x86_64-linux-gnu-ubuntu-18.04/lib/clang/16/lib/x86_64-unknown-linux-gnu/libclang_rt.scudo_standalone.so
        0x000000000000001d (RUNPATH)            Library runpath: [$ORIGIN/../lib:/tmp/llvm_release/final/Phase3/Release/llvmCore-16.0.0-final.obj/./lib]
        File: clang+llvm-16.0.0-x86_64-linux-gnu-ubuntu-18.04/lib/clang/16/lib/x86_64-unknown-linux-gnu/libclang_rt.tsan.so
        0x000000000000001d (RUNPATH)            Library runpath: [$ORIGIN/../lib:/tmp/llvm_release/final/Phase3/Release/llvmCore-16.0.0-final.obj/./lib]
        File: clang+llvm-16.0.0-x86_64-linux-gnu-ubuntu-18.04/lib/clang/16/lib/x86_64-unknown-linux-gnu/libclang_rt.ubsan_minimal.so
        0x000000000000001d (RUNPATH)            Library runpath: [$ORIGIN/../lib:/tmp/llvm_release/final/Phase3/Release/llvmCore-16.0.0-final.obj/./lib]
        File: clang+llvm-16.0.0-x86_64-linux-gnu-ubuntu-18.04/lib/clang/16/lib/x86_64-unknown-linux-gnu/libclang_rt.ubsan_standalone.so
        0x000000000000001d (RUNPATH)            Library runpath: [$ORIGIN/../lib:/tmp/llvm_release/final/Phase3/Release/llvmCore-16.0.0-final.obj/./lib]
      
      Another is in the Swift toolchain, which builds lldb separately:
      
        > readelf -d swift-5.9-DEVELOPMENT-SNAPSHOT-2023-03-24-a-ubuntu20.04/usr/{bin/lldb*,lib/liblldb.so}|ag "File:|runpath"
        File: swift-5.9-DEVELOPMENT-SNAPSHOT-2023-03-24-a-ubuntu20.04/usr/bin/lldb
        0x000000000000001d (RUNPATH)            Library runpath: [$ORIGIN/../lib:/home/build-user/build/buildbot_linux/llvm-linux-x86_64/./lib]
        File: swift-5.9-DEVELOPMENT-SNAPSHOT-2023-03-24-a-ubuntu20.04/usr/bin/lldb-argdumper
        0x000000000000001d (RUNPATH)            Library runpath: [$ORIGIN/../lib:/home/build-user/build/buildbot_linux/llvm-linux-x86_64/./lib]
        File: swift-5.9-DEVELOPMENT-SNAPSHOT-2023-03-24-a-ubuntu20.04/usr/bin/lldb-server
        0x000000000000001d (RUNPATH)            Library runpath: [$ORIGIN/../lib:/home/build-user/build/buildbot_linux/llvm-linux-x86_64/./lib]
        File: swift-5.9-DEVELOPMENT-SNAPSHOT-2023-03-24-a-ubuntu20.04/usr/lib/liblldb.so
        0x000000000000001d (RUNPATH)            Library runpath: [$ORIGIN/../lib:/home/build-user/build/buildbot_linux/llvm-linux-x86_64/./lib:/home/build-user/build/buildbot_linux/swift-linux-x86_64/lib/swift/linux:$ORIGIN/../lib/swift/linux]
      
      This patch should fix this problem of absolute paths from the build host
      leaking out into the toolchain's runpaths.
      
      Differential revision: https://reviews.llvm.org/D146918
      
      (cherry picked from commit 8f833f88)
      b98da4c7
  4. May 31, 2023
  5. May 19, 2023
  6. May 17, 2023
  7. May 16, 2023
    • Tom Dohrmann's avatar
      fix stack probe lowering for x86_intrcc · df309b12
      Tom Dohrmann authored
      The x86_intrcc calling convention will build two STACKALLOC_W_PROBING machine instructions if the function takes an error code. This is caused by an additional call to emitSPUpdate in llvm/lib/Target/X86/X86FrameLowering.cpp:1650. Previously only the first STACKALLOC_W_PROBING machine instruction was properly handled, the second one was simply ignored. This lead to miscompilations where the stack pointer wasn't properly updated (see https://github.com/rust-lang/rust/issues/109918). This patch fixes this by handling all STACKALLOC_W_PROBING machine instructions.
      
      To be honest I don't quite understand why this didn't lead to more noticeable miscompilations previously.
      
      This is my first time contributing to LLVM.
      
      Reviewed By: pengfei
      
      Differential Revision: https://reviews.llvm.org/D150033
      
      (cherry picked from commit f6154364)
      df309b12
    • Valentin Clement's avatar
      [flang] Fix optional assertion in PFTBuilder · 1a04a5f1
      Valentin Clement authored
      D142279 enabled assertion in libstdc++ and one was triggered
      in the PFTBuilder because an optional was access even if it was
      null.
      This patch fix this issue and add a regression test.
      
      Reviewed By: jeanPerier
      
      Differential Revision: https://reviews.llvm.org/D143589
      
      (cherry picked from commit 3f55311a)
      1a04a5f1
    • Alan Zhao's avatar
      [clang] Fix default initializers being ignored when initializing templated aggregate types · bef3459f
      Alan Zhao authored
      Previously, when checking whether an in-class initializer exists when
      performing parenthesized aggregate initialization, Clang checks that the
      output of FieldDecl::getInClassInitializer() is non-null. This is
      incorrect; if the field is part of a templated type, then
      getInClassInitializer() will return nullptr if we haven't called
      Sem::BuildCXXDefaultInitExpr(...) before, even if
      FieldDecl::hasInClassInitializer() returns true. The end result is that
      Clang incorrectly ignores the in class initializer and
      value-initializes the field. The fix therefore is to instead call
      FieldDecl::hasInClassInitializer(), which is what we do for braced init
      lists [0].
      
      Before this patch, Clang does correctly recognize the in-class field
      initializer in certain cases. This is Sema::BuildCXXDefaultInitExpr(...)
      populates the in class initializer of the corresponding FieldDecl
      object. Therefore, if that method was previously called with the same
      FieldDecl object, as can happen with a decltype(...) or a braced list
      initialization, FieldDecl::getInClassInitializer() will return a
      non-null expression, and the field becomes properly initialized.
      
      Fixes 62266
      
      [0]: https://github.com/llvm/llvm-project/blob/be5f35e24f4c15caf3c4aeccddc54c52560c28a0/clang/lib/Sema/SemaInit.cpp#L685
      
      Reviewed By: shafik
      
      Differential Revision: https://reviews.llvm.org/D149389
      bef3459f
  8. May 14, 2023
  9. May 06, 2023
  10. May 03, 2023