1. May 13, 2022
    • Sanjay Patel's avatar
      [InstCombine] freeze operand in div+mul fold · 2fa8fc3d
      Sanjay Patel authored
      As discussed in issue #37809, this transform is not safe
      if the input is an undefined value.
      
      This is similar to recent changes for urem and sdiv:
      d428f09b
      99ef341c
      
      There is no difference in codegen on the basic examples,
      but this could lead to regressions. We may need to
      improve freeze analysis or lowering if that happens.
      
      Presumably, in real cases that are similar to the tests
      where a subsequent transform removes the rem, we
      will also be able to remove the freeze by seeing that
      the parameter has 'noundef'.
      2fa8fc3d
    • Philip Reames's avatar
      [RISCV] Extend dataflow workaround from D119518 to fallthrough blocks · 52b5f1f7
      Philip Reames authored
      We've got a lurking problem with our data flow implementation where different phases disagree, resulting in possible miscompiles. D119518 introduced a workaround, but failed to consider blocks without terminators (e.g. fallthroughs).
      
      I have a deeper rework of the algorithm in flight over in D125232, but this patch is specifically a minimal fix for an active miscompile. That change can be reworked over this once landed.
      
      Differential Revision: https://reviews.llvm.org/D125408
      52b5f1f7
    • Louis Dionne's avatar
      2f21f5b0
    • Aaron Ballman's avatar
      Check for resource exhaustion when recursively parsing declarators · c6710417
      Aaron Ballman authored
      With sufficiently tortured code, it's possible to cause a stack
      overflow when parsing declarators. Thus, we now check for resource
      exhaustion when recursively parsing declarators so that we can at least
      warn the user we're about to crash before we actually crash.
      
      Fixes #51642
      
      Differential Revision: https://reviews.llvm.org/D124915
      c6710417
    • Louis Dionne's avatar
      [libc++abi] Refactor exception type demangling into a separate function · 6089fd6c
      Louis Dionne authored
      As a fly-by fix, also let `__cxa_demangle` allocate its buffer alone,
      since we are not allowed to pass a non-malloc'd buffer to it.
      
      Differential Revision: https://reviews.llvm.org/D125268
      6089fd6c
    • Simon Pilgrim's avatar
    • Simon Pilgrim's avatar
      [CostModel][X86] Auto generate masked load/store LV costs using UTC_ARGS --filter control · 14e83ada
      Simon Pilgrim authored
      Also fix a sse42 -> sse4.2 typo so that we actually test costs for sse4.2
      14e83ada
    • Simon Pilgrim's avatar
      [CostModel][X86] Auto generate gather/scatter LV costs using UTC_ARGS --filter control · a5c45c4d
      Simon Pilgrim authored
      Also fix a sse42 -> sse4.2 typo so that we actually test costs for sse4.2
      a5c45c4d
    • Stephen Long's avatar
      [Headers][MSVC] Define wchar_t in stddef.h like MSVC if not using the builtin type · 7f9837cf
      Stephen Long authored
       MSVC expects wchar_t to be defined in stddef.h if /Zc:wchar_t- is specified
      
      Reviewed By: efriedma
      
      Differential Revision: https://reviews.llvm.org/D124026
      7f9837cf
    • Hongtao Yu's avatar
      [CSSPGO][llvm-profgen] Do not duplicate context profiles into base profile... · 23191a4f
      Hongtao Yu authored
      [CSSPGO][llvm-profgen] Do not duplicate context profiles into base profile when converting CS flat profile to nested.
      
      Recent experiments with our two large internal services showed that duplicating context profiles into base profile caused code size inflation and didn't deliver good performance compared to no such duplication. It was a trick we made to catch up with the CS flat profile and I'm now turning it off by default.
      
      The code size inflation mainly comes from the enriched based profiles. A base profile for a function represents the uninlined (or outlined) portion of the whole function running time. Such portion could be very small if a function is inlined into most of its hot callsites. Duplicating context profiles of the function into its base profiles could cause the outlined body to be hot enough and in turn get many of its callees inlined, thus increases the code size. The size inflation could further cause perf regression.
      
      Reviewed By: wenlei
      
      Differential Revision: https://reviews.llvm.org/D124796
      23191a4f
    • Craig Topper's avatar
      [TypePromotion] Promote undef by converting to 0. · cec249c6
      Craig Topper authored
      If we're promoting an undef I think that means that we expect the
      upper bits are zero. undef doesn't guarantee that.
      
      This patch replaces undef with 0 to ensure this. This matches how
      a zext or sext of undef would be folded by InstCombine/InstSimplify.
      
      I haven't found a failure from this was just thinking through the code.
      
      Differential Revision: https://reviews.llvm.org/D123174
      cec249c6
    • Craig Topper's avatar
      [RISCV] Use tail agnostic policy when selecting riscv_fma_vl to instructions · 40e96545
      Craig Topper authored
      riscv_fma_vl doesn't have a tail, so use the tail_agnostic policy.
      
      We were already doing this for some patterns. I think the patterns
      with fneg and mask were added later and I copied the tail policy
      from the unmasked patterns.
      
      Reviewed By: khchen
      
      Differential Revision: https://reviews.llvm.org/D125424
      40e96545
    • Yaxun (Sam) Liu's avatar
      [clang]Silence warning in MicrosoftCXXABI.cpp · 0f292141
      Yaxun (Sam) Liu authored
      Silence warning with gcc 9.3 about:
      
      [1/351] Building CXX object tools/clang/lib/AST/CMakeFiles/obj.clangAST.dir/MicrosoftCXXABI.cpp.o
      ../../clang/lib/AST/MicrosoftCXXABI.cpp:57:12: warning: 'virtual unsigned int {anonymous}::MicrosoftNumberingContext::getManglingNumber(const clang::VarDecl*, unsigned int)' was hidden [-Woverloaded-virtual]
         57 |   unsigned getManglingNumber(const VarDecl *VD,
            |            ^~~~~~~~~~~~~~~~~
      ../../clang/lib/AST/MicrosoftCXXABI.cpp:80:12: warning:   by 'virtual unsigned int {anonymous}::MSHIPNumberingContext::getManglingNumber(const clang::TagDecl*, unsigned int)' [-Woverloaded-virtual]
         80 |   unsigned getManglingNumber(const TagDecl *TD,
            |            ^~~~~~~~~~~~~~~~~
      
      Change-Id: Ia519e77c6454eb020228478dd6498eaf7864dae8
      0f292141
    • Martin Storsjö's avatar
      [libcxx] Switch __cxx_contention_t to int32_t on 32 bit AIX · 39328a65
      Martin Storsjö authored
      I guess this is an ABI break for the 32 bit AIX configuration, but I'm
      not sure if that one is meant to be ABI stable yet or not.
      
      Previously, this used int32_t for this type on linux, but int64_t
      on all other platforms. This was added in D68480 /
      54fa9ecd, but I don't really see
      any discussion around this detail there.
      
      Switching this to 32 bit on 32 bit AIX silences these libcxx build
      warnings:
      
      ```
      In file included from /scratch/powerllvm/cpap8006/llvm-project/libcxx-ci/libcxx/src/atomic.cpp:12:
      /scratch/powerllvm/cpap8006/llvm-project/libcxx-ci/build/aix/include/c++/v1/atomic:1005:12: warning: large atomic operation may incur significant performance penalty; the access size (8 bytes) exceeds the max lock-free size (4  bytes) [-Watomic-alignment]
          return __c11_atomic_fetch_add(&__a->__a_value, __delta, static_cast<__memory_order_underlying_t>(__order));
                 ^
      /scratch/powerllvm/cpap8006/llvm-project/libcxx-ci/build/aix/include/c++/v1/atomic:948:12: warning: large atomic operation may incur significant performance penalty; the access size (8 bytes) exceeds the max lock-free size (4  bytes) [-Watomic-alignment]
          return __c11_atomic_load(const_cast<__ptr_type>(&__a->__a_value), static_cast<__memory_order_underlying_t>(__order));
                 ^
      /scratch/powerllvm/cpap8006/llvm-project/libcxx-ci/build/aix/include/c++/v1/atomic:1000:12: warning: large atomic operation may incur significant performance penalty; the access size (8 bytes) exceeds the max lock-free size (4  bytes) [-Watomic-alignment]
          return __c11_atomic_fetch_add(&__a->__a_value, __delta, static_cast<__memory_order_underlying_t>(__order));
                 ^
      /scratch/powerllvm/cpap8006/llvm-project/libcxx-ci/build/aix/include/c++/v1/atomic:1022:12: warning: large atomic operation may incur significant performance penalty; the access size (8 bytes) exceeds the max lock-free size (4  bytes) [-Watomic-alignment]
          return __c11_atomic_fetch_sub(&__a->__a_value, __delta, static_cast<__memory_order_underlying_t>(__order));
                 ^
      4 warnings generated.
      ```
      
      Differential Revision: https://reviews.llvm.org/D124519
      39328a65
  2. May 12, 2022