platform/upstream/llvm.git
2 years ago[Sema] Avoid isNullPointerConstant invocation
Justin Stitt [Sun, 14 Aug 2022 20:28:49 +0000 (13:28 -0700)]
[Sema] Avoid isNullPointerConstant invocation

DiagnoseNullConversion is needlessly calling isNullPointerConstant which
is an expensive routine due to its calls to a constant evaluator --
which we don't need.

Building the Linux Kernel (x86_64) with this fix has improved build
times by ~2.1%. This is mainly due to the following methods no longer
needing to be called anywhere near as often:
1) ExprConstant::CheckICE (reduced CPU cycles by ~90%)
2) IntExprEvaluator::VisitBinaryOperator (reduced CPU cycles by ~50%)

Reviewed By: rtrieu, nickdesaulniers

Differential Revision: https://reviews.llvm.org/D131532

2 years agoInstCombine: use poison instead of undef as placeholder in insertvalue [NFC]
Nuno Lopes [Sun, 14 Aug 2022 20:37:23 +0000 (21:37 +0100)]
InstCombine: use poison instead of undef as placeholder in insertvalue [NFC]
These vectors are fully initialized so the placeholder value is irrelevant

2 years agoRevert "[clang] adds unary type transformations as compiler built-ins"
Nico Weber [Sun, 14 Aug 2022 19:57:38 +0000 (15:57 -0400)]
Revert "[clang] adds unary type transformations as compiler built-ins"

This reverts commit bc60cf2368de90918719dc7e3d7c63a72cc007ad.
Doesn't build on Windows and breaks gcc 9 build, see
https://reviews.llvm.org/D116203#3722094 and
https://reviews.llvm.org/D116203#3722128

Also revert two follow-ups. One fixed a warning added in
bc60cf2368de90918719dc7e3d7c63a72cc007ad, the other
makes use of the feature added in bc60cf2368de90918719dc7e3d7c63a72cc007ad
in libc++:

Revert "[libcxx][NFC] utilises compiler builtins for unary transform type-traits"
This reverts commit 06a1d917ef1f507aaa2f6891bb654696c866ea3a.

Revert "[Sema] Fix a warning"
This reverts commit c85abbe879ef3257de4db862ce249b060cc3d2a4.

2 years ago[flang] Remove redundant string initialization (NFC)
Kazu Hirata [Sun, 14 Aug 2022 19:52:01 +0000 (12:52 -0700)]
[flang] Remove redundant string initialization (NFC)

Identified with readability-redundant-string-init.

2 years ago[mlir] Remove redundant member initialization (NFC)
Kazu Hirata [Sun, 14 Aug 2022 19:51:59 +0000 (12:51 -0700)]
[mlir] Remove redundant member initialization (NFC)

Identified with readability-redundant-member-init.

2 years ago[Transforms] Qualify auto in range-based for loops (NFC)
Kazu Hirata [Sun, 14 Aug 2022 19:51:58 +0000 (12:51 -0700)]
[Transforms] Qualify auto in range-based for loops (NFC)

Identified with readability-qualified-auto.

2 years ago[Support] Drop unnecessary const from a return type (NFC)
Kazu Hirata [Sun, 14 Aug 2022 19:51:56 +0000 (12:51 -0700)]
[Support] Drop unnecessary const from a return type (NFC)

Identified with readability-const-return-type.

2 years ago[JITLink] Fix some missing std::moves.
Lang Hames [Sun, 14 Aug 2022 18:42:26 +0000 (11:42 -0700)]
[JITLink] Fix some missing std::moves.

This should fix failures on some bots due to 1cf81274f42
(e.g. https://lab.llvm.org/buildbot#builders/196/builds/16684)

2 years ago[Sema] Fix a warning
Kazu Hirata [Sun, 14 Aug 2022 18:25:19 +0000 (11:25 -0700)]
[Sema] Fix a warning

This patch fixes:

  clang/lib/Sema/SemaType.cpp:9469:3: error: default label in switch
  which covers all enumeration values
  [-Werror,-Wcovered-switch-default]

2 years ago[gn build] Port 1cf81274f425
LLVM GN Syncbot [Sun, 14 Aug 2022 17:56:25 +0000 (17:56 +0000)]
[gn build] Port 1cf81274f425

2 years ago[M68k] Fix MSVC llvm::Optional<> deprecation warnings
Simon Pilgrim [Sun, 14 Aug 2022 17:54:37 +0000 (18:54 +0100)]
[M68k] Fix MSVC llvm::Optional<> deprecation warnings

Use has_value()/value() instead of hasValue()/getValue()

2 years ago[JITLink] Add eh-frame CFI inspector, fix crash on malformed FDEs.
Lang Hames [Sat, 13 Aug 2022 03:52:34 +0000 (20:52 -0700)]
[JITLink] Add eh-frame CFI inspector, fix crash on malformed FDEs.

Add a fix to check that FDE pc-begin targets are defined before calling
getBlock (which will crash if the target is not defined). FDE pc-begins
pointing at undefined symbols are expected to arise only in obscure
circumstances (malformed objects, or removal of targets by JITLink
passes), but we want to handle them gracefully. With this patch the
FDE will be retained, but without any keepalive edge to it. Unless
some pass takes action to mark it as live it will be dead-stripped.

To make it easier for passes to connect FDEs to their targets a new
EHFrameCFIBlockInspector utility is added. This allows clients to
quickly determine whether a CFI record is a CIE or an FDE (assuming
that it's valid), and retrieve any personality, pc-begin, cie, or
LSDA edges associated with it.

2 years ago[libcxx][NFC] utilises compiler builtins for unary transform type-traits
Christopher Di Bella [Sun, 14 Aug 2022 16:53:00 +0000 (16:53 +0000)]
[libcxx][NFC] utilises compiler builtins for unary transform type-traits

Depends on D116203

Reviewed By: #libc, philnik

Differential Revision: https://reviews.llvm.org/D131732

2 years ago[clang] adds unary type transformations as compiler built-ins
Christopher Di Bella [Wed, 10 Aug 2022 21:31:03 +0000 (21:31 +0000)]
[clang] adds unary type transformations as compiler built-ins

Adds

* `__add_lvalue_reference`
* `__add_pointer`
* `__add_rvalue_reference`
* `__decay`
* `__make_signed`
* `__make_unsigned`
* `__remove_all_extents`
* `__remove_extent`
* `__remove_const`
* `__remove_volatile`
* `__remove_cv`
* `__remove_pointer`
* `__remove_reference`
* `__remove_cvref`

These are all compiler built-in equivalents of the unary type traits
found in [[meta.trans]][1]. The compiler already has all of the
information it needs to answer these transformations, so we can skip
needing to make partial specialisations in standard library
implementations (we already do this for a lot of the query traits). This
will hopefully improve compile times, as we won't need use as much
memory in such a base part of the standard library.

[1]: http://wg21.link/meta.trans

Co-authored-by: zoecarver
Reviewed By: aaron.ballman, rsmith

Differential Revision: https://reviews.llvm.org/D116203

2 years ago[LV] Add tests for vectorizing select of minimum idx idiom.
Florian Hahn [Sun, 14 Aug 2022 16:44:11 +0000 (17:44 +0100)]
[LV] Add tests for vectorizing select of minimum idx idiom.

Test cases for selecting the index with the minimum value.

2 years ago[X86] combineVectorShiftImm - fold (shl (add X, X), C) -> (shl X, (C + 1))
Simon Pilgrim [Sun, 14 Aug 2022 16:41:58 +0000 (17:41 +0100)]
[X86] combineVectorShiftImm - fold (shl (add X, X), C) -> (shl X, (C + 1))

Noticed while investigating the regressions in D106675

2 years ago[libc++][test] fix C4267 warning in bitset.members\to_ulong.pass.cpp
Igor Zhukov [Sun, 14 Aug 2022 10:33:15 +0000 (17:33 +0700)]
[libc++][test] fix C4267 warning in bitset.members\to_ulong.pass.cpp

Reviewed By: philnik

Differential Revision: https://reviews.llvm.org/D131854

2 years ago[X86] Add test coverage for lshr/ashr with freeze
Simon Pilgrim [Sun, 14 Aug 2022 14:29:59 +0000 (15:29 +0100)]
[X86] Add test coverage for lshr/ashr with freeze

2 years ago[DAG] canCreateUndefOrPoison - add freeze(shl(x,y)) -> shl(freeze(x),y) support
Simon Pilgrim [Sun, 14 Aug 2022 12:54:52 +0000 (13:54 +0100)]
[DAG] canCreateUndefOrPoison - add freeze(shl(x,y)) -> shl(freeze(x),y) support

These are guaranteed not to create undef/poison if the shift amount is known to be in range

2 years ago[clang][doc] Removes an extra space.
Mark de Wever [Sun, 14 Aug 2022 13:16:43 +0000 (15:16 +0200)]
[clang][doc] Removes an extra space.

2 years ago[X86] Add test coverage for shl nsw with freeze
Simon Pilgrim [Sun, 14 Aug 2022 12:42:35 +0000 (13:42 +0100)]
[X86] Add test coverage for shl nsw with freeze

2 years ago[X86] freeze-binary.ll - tweak freeze_mul_nsw test to avoid mul by pow-2
Simon Pilgrim [Sun, 14 Aug 2022 12:35:56 +0000 (13:35 +0100)]
[X86] freeze-binary.ll - tweak freeze_mul_nsw test to avoid mul by pow-2

Enabling freeze(shl()) -> shl(freeze()) was affecting this test

2 years ago[X86] Add test coverage for shl with freeze
Simon Pilgrim [Sun, 14 Aug 2022 12:32:58 +0000 (13:32 +0100)]
[X86] Add test coverage for shl with freeze

2 years ago[DAG] canCreateUndefOrPoison - add freeze(and/or/xor(x,y)) -> and/or/xor(freeze(x...
Simon Pilgrim [Sun, 14 Aug 2022 12:14:46 +0000 (13:14 +0100)]
[DAG] canCreateUndefOrPoison - add freeze(and/or/xor(x,y)) -> and/or/xor(freeze(x),y) support

These are guaranteed not to create undef/poison

2 years ago[X86] Add test coverage for and/or/xor with freeze
Simon Pilgrim [Sun, 14 Aug 2022 12:01:59 +0000 (13:01 +0100)]
[X86] Add test coverage for and/or/xor with freeze

2 years ago[libc++] Uses operator<=> in string.
Mark de Wever [Tue, 19 Jul 2022 05:56:23 +0000 (07:56 +0200)]
[libc++] Uses operator<=> in string.

Implements part of:
- P1614R2 The Mothership has Landed

Reviewed By: avogelsgesang, #libc, philnik

Differential Revision: https://reviews.llvm.org/D131421

2 years ago[libc++][test] Disables clang-tidy test for GCC.
Mark de Wever [Sat, 13 Aug 2022 13:01:44 +0000 (15:01 +0200)]
[libc++][test] Disables clang-tidy test for GCC.

Increasing the constexpr evaluation limit breaks this clang-tidy test
for GCC. As discussed in D131317 disable the test in GCC.

Reviewed By: philnik, #libc

Differential Revision: https://reviews.llvm.org/D131835

2 years ago[ORC_RT][COFF] Fix cross compilation with mingw headers
Martin Storsjö [Sun, 14 Aug 2022 10:47:16 +0000 (13:47 +0300)]
[ORC_RT][COFF] Fix cross compilation with mingw headers

Mingw headers are all lowercase, and can be used for cross compilation
from case sensitive file systems.

The official Windows SDK headers aren't self-consistent wrt upper/lower
case, so those headers can't be used on case sensitive systems without
a layer providing case insensitivity anyway.

This matches other includes of windows.h throughout the codebase.

2 years ago[Polly] Remove the test case that depends on InstCombine and DeLICM.
Roman Gareev [Sun, 14 Aug 2022 09:50:22 +0000 (12:50 +0300)]
[Polly] Remove the test case that depends on InstCombine and DeLICM.

2 years ago[Orc] Use IntervalMap to store free memory regions in MapperJITLinkMemoryManager
Anubhab Ghosh [Tue, 9 Aug 2022 12:22:13 +0000 (17:52 +0530)]
[Orc] Use IntervalMap to store free memory regions in MapperJITLinkMemoryManager

MapperJITLinkMemoryManager uses a free list to keep track of available
memory regions. Using an IntervalMap instead of vector allow automatic
coalescing of memory regions as they are freed.

Differential Revision: https://reviews.llvm.org/D131831

2 years ago[gn build] Port 7ae66e5e9593
LLVM GN Syncbot [Sun, 14 Aug 2022 08:35:03 +0000 (08:35 +0000)]
[gn build] Port 7ae66e5e9593

2 years ago[libc++] Implement P2417R2 (A more constexpr bitset)
Nikolas Klauser [Sat, 13 Aug 2022 11:52:35 +0000 (13:52 +0200)]
[libc++] Implement P2417R2 (A more constexpr bitset)

Reviewed By: ldionne, #libc

Spies: jloser, arichardson, libcxx-commits, arphaman

Differential Revision: https://reviews.llvm.org/D131218

2 years ago[libc++] Granularize the rest of type_traits
Nikolas Klauser [Sat, 13 Aug 2022 21:10:31 +0000 (23:10 +0200)]
[libc++] Granularize the rest of type_traits

Reviewed By: ldionne, #libc

Spies: libcxx-commits, mgorny

Differential Revision: https://reviews.llvm.org/D130471

2 years ago[NFC] Combine test cases of verifier
Liqin.Weng [Sun, 14 Aug 2022 02:12:16 +0000 (10:12 +0800)]
[NFC] Combine test cases of verifier

Reviewed By: benshi001

Differential Revision: https://reviews.llvm.org/D126443

2 years ago[Triple] Add llvm::Triple::isRISCV{32,64}
Alexey Baturo [Sun, 14 Aug 2022 01:51:35 +0000 (18:51 -0700)]
[Triple] Add llvm::Triple::isRISCV{32,64}

Reviewed By: vitalybuka, MaskRay, craig.topper

Differential Revision: https://reviews.llvm.org/D131339

2 years ago[X86][FP16] Promote FP16->[U]INT to FP16->FP32->[U]INT
Phoebe Wang [Sun, 14 Aug 2022 01:03:09 +0000 (09:03 +0800)]
[X86][FP16] Promote FP16->[U]INT to FP16->FP32->[U]INT

This is to avoid f16->i64 being lowered to `__fixhfdi/__fixunshfdi` on 32-bits since neither libgcc nor compiler-rt provide them. https://godbolt.org/z/cjWEsea5v

It also helps to improve the performance by promoting the vector type.

Reviewed By: LuoYuanke

Differential Revision: https://reviews.llvm.org/D131828

2 years ago[llvm] Update FileSystem test that failed spuriously
Ben Langmuir [Sun, 14 Aug 2022 01:12:39 +0000 (18:12 -0700)]
[llvm] Update FileSystem test that failed spuriously

This test failed spuriously in an environment that appears to ignore the
'x' bit permission on directories. Allow for that possibility.

2 years agofix some bad logic that was removing all successor phi nodes, not just
John Regehr [Sun, 14 Aug 2022 01:14:10 +0000 (19:14 -0600)]
fix some bad logic that was removing all successor phi nodes, not just
out of chunk ones. the non-default second argument to
removePredecessor() is necessary to avoid creating invalid IR on
examples like the one in the provided test case

Differential Revision: https://reviews.llvm.org/D131843

2 years ago[llvm-readobj] Remove unused member variable. NFC
Fangrui Song [Sun, 14 Aug 2022 01:14:24 +0000 (18:14 -0700)]
[llvm-readobj] Remove unused member variable. NFC

2 years ago[libc++] Implement `operator<=>` for `thread::id`
Adrian Vogelsgesang [Sun, 31 Jul 2022 23:12:42 +0000 (16:12 -0700)]
[libc++] Implement `operator<=>` for `thread::id`

The new operator<=> is mapped onto the existing functions
__libcpp_thread_id_equal and __libcpp_thread_id_less. Introducing a
new __libcpp_thread_id_compare_three_way might lead to more efficient
code. Given that we can still introduce __libcpp_thread_id_compare_three_way
later, for this commit I opted to not break ABI. If requested, I will
add __libcpp_thread_id_compare_three_way in a follow-up commit.

Implements part of P1614R2 "The Mothership has Landed"

Differential Revision: https://reviews.llvm.org/D131362

2 years ago[libc++] Add a bunch of missing _LIBCPP_HIDE_FROM_ABI
Nikolas Klauser [Sat, 13 Aug 2022 11:23:16 +0000 (13:23 +0200)]
[libc++] Add a bunch of missing _LIBCPP_HIDE_FROM_ABI

Reviewed By: ldionne, Mordante, var-const, huixie90, #libc

Spies: jloser, libcxx-commits, arichardson, miyuki

Differential Revision: https://reviews.llvm.org/D129968

2 years ago[AArch64] Fix signed integer overflow in CSINC case
Vitaly Buka [Fri, 12 Aug 2022 22:43:05 +0000 (15:43 -0700)]
[AArch64] Fix signed integer overflow in CSINC case

https://lab.llvm.org/staging/#/builders/224/builds/2/steps/16/logs/stdio

Reviewed By: dmgreen

Differential Revision: https://reviews.llvm.org/D131815

2 years ago[DAG] canCreateUndefOrPoison - add freeze(add/sub/mul(x,y)) -> add/sub/mul(freeze...
Simon Pilgrim [Sat, 13 Aug 2022 19:57:51 +0000 (20:57 +0100)]
[DAG] canCreateUndefOrPoison - add freeze(add/sub/mul(x,y)) -> add/sub/mul(freeze(x),y,z) support

These are guaranteed not to create undef/poison as long as there are no poison generating flags

2 years ago[X86] Add test coverage for add/sub/mul with freeze
Simon Pilgrim [Sat, 13 Aug 2022 19:42:41 +0000 (20:42 +0100)]
[X86] Add test coverage for add/sub/mul with freeze

2 years agoUse llvm::erase_value (NFC)
Kazu Hirata [Sat, 13 Aug 2022 19:55:50 +0000 (12:55 -0700)]
Use llvm::erase_value (NFC)

2 years agoUse llvm::erase_if (NFC)
Kazu Hirata [Sat, 13 Aug 2022 19:55:48 +0000 (12:55 -0700)]
Use llvm::erase_if (NFC)

2 years agoRemove unused forward declarations (NFC)
Kazu Hirata [Sat, 13 Aug 2022 19:55:47 +0000 (12:55 -0700)]
Remove unused forward declarations (NFC)

2 years agoEnsure newlines at the end of files (NFC)
Kazu Hirata [Sat, 13 Aug 2022 19:55:45 +0000 (12:55 -0700)]
Ensure newlines at the end of files (NFC)

2 years ago[clangd] Drop unnecessary const from return types (NFC)
Kazu Hirata [Sat, 13 Aug 2022 19:55:44 +0000 (12:55 -0700)]
[clangd] Drop unnecessary const from return types (NFC)

Identified with readability-const-return-type.

2 years ago[llvm] Qualify auto in range-based for loops (NFC)
Kazu Hirata [Sat, 13 Aug 2022 19:55:42 +0000 (12:55 -0700)]
[llvm] Qualify auto in range-based for loops (NFC)

Identified with readability-qualified-auto.

2 years ago __has_trivial_copy should map to __is_trivially_copyable
Zachary Henkel [Sat, 13 Aug 2022 19:52:41 +0000 (22:52 +0300)]
 __has_trivial_copy should map to __is_trivially_copyable

Found during clang 15 RC1 testing due to the new diagnostic added by @royjacobson since clang 14.  Uncertain if this fix meets the bar to also be applied to the release branch.

If accepted, I'll need someone with commit access to submit on my behalf.

Reviewed By: royjacobson, aaron.ballman, erichkeane

Differential Revision: https://reviews.llvm.org/D131730

2 years ago[OpenMP] Fix another after scope after D129608
Vitaly Buka [Sat, 13 Aug 2022 19:13:27 +0000 (12:13 -0700)]
[OpenMP] Fix another after scope after D129608

https://lab.llvm.org/buildbot/#/builders/5/builds/26770

2 years ago[MC] Leverage constexpr `std::array` in `SubtargetFeature.h`
Joe Loser [Sat, 13 Aug 2022 04:14:28 +0000 (22:14 -0600)]
[MC] Leverage constexpr `std::array` in `SubtargetFeature.h`

Replace C-style array with `std::array` since `std::array<T, N>::operator[]` is
`constexpr` in C++17. This also allows us to replace `array_lengthof` calls with
member `size()` function.

Differential Revision: https://reviews.llvm.org/D131826

2 years agoUse Optional::transform instead of Optional::map (NFC)
Kazu Hirata [Sat, 13 Aug 2022 18:48:26 +0000 (11:48 -0700)]
Use Optional::transform instead of Optional::map (NFC)

I'm planning to deprecate map in favor of transform for consistency
with std::optional::transform in C++23.

2 years ago[ADT] Implement Optional::transform
Kazu Hirata [Sat, 13 Aug 2022 18:48:25 +0000 (11:48 -0700)]
[ADT] Implement Optional::transform

This patch implements Optional::transform for consistency with
std::optional::transform in C++23.

Note that the new function is identical to Optional::map.  My plan is
to deprecate Optional::map after migrating all of its uses to
Optional::transform.

Differential Revision: https://reviews.llvm.org/D131829

2 years ago[flang][openacc] Handle array section and derived-type components operands
Valentin Clement [Sat, 13 Aug 2022 18:40:03 +0000 (20:40 +0200)]
[flang][openacc] Handle array section and derived-type components operands

This patch lowers correctly operands with array section
and derived-type component.

Depends on D131764

Reviewed By: razvanlupusoru

Differential Revision: https://reviews.llvm.org/D131765

2 years ago[unittest] Update HostTest::isSupportedArchAndOS
Fangrui Song [Sat, 13 Aug 2022 17:27:34 +0000 (10:27 -0700)]
[unittest] Update HostTest::isSupportedArchAndOS

2 years ago[CostModel][X86] Add cost kinds test coverage for select operators
Simon Pilgrim [Sat, 13 Aug 2022 17:08:03 +0000 (18:08 +0100)]
[CostModel][X86] Add cost kinds test coverage for select operators

2 years agoRevert "[AArch64][GlobalISel] Recognise some CCMPri"
Florian Hahn [Sat, 13 Aug 2022 16:44:40 +0000 (17:44 +0100)]
Revert "[AArch64][GlobalISel] Recognise some CCMPri"

This reverts commit 38c2366b3ffcc11da178b8d52814ef609e08d40f.

This patch seems to break boostraping LLVM with `-fglobal-isel -O3`
on AArch64 hardware. Without the revert, there are 500+ test
failures for the `check-llvm-codegen-x86` target.

2 years ago[OpenMP] Fix use after scope after D129608
Vitaly Buka [Sat, 13 Aug 2022 16:39:49 +0000 (09:39 -0700)]
[OpenMP] Fix use after scope after D129608

Broken builder https://lab.llvm.org/buildbot/#/builders/5/builds/26764

2 years ago[mlir][shape] Rename dim.dim to dim.index (NFC)
Jacques Pienaar [Sat, 13 Aug 2022 16:27:22 +0000 (09:27 -0700)]
[mlir][shape] Rename dim.dim to dim.index (NFC)

dim member on dim was confusing, change to be consistent with
tensor::dim.

2 years ago[CostModel] Rename vselect-cost.ll to select.ll
Simon Pilgrim [Sat, 13 Aug 2022 16:30:42 +0000 (17:30 +0100)]
[CostModel] Rename vselect-cost.ll to select.ll

This covers more than just vector select costs

2 years ago[CostModel][X86] Add cost kinds test coverage for fp comparisons
Simon Pilgrim [Sat, 13 Aug 2022 16:20:49 +0000 (17:20 +0100)]
[CostModel][X86] Add cost kinds test coverage for fp comparisons

2 years ago[CostModel][X86] Add cost kinds test coverage for fp arithmetic operators
Simon Pilgrim [Sat, 13 Aug 2022 15:42:36 +0000 (16:42 +0100)]
[CostModel][X86] Add cost kinds test coverage for fp arithmetic operators

2 years ago[InstCombine] fix "X|(X^Y)" pattern-matching for commuted variants
Sanjay Patel [Sat, 13 Aug 2022 15:00:41 +0000 (11:00 -0400)]
[InstCombine] fix "X|(X^Y)" pattern-matching for commuted variants

2 years ago[InstCombine] add tests for or-xor; NFC
Sanjay Patel [Sat, 13 Aug 2022 14:26:16 +0000 (10:26 -0400)]
[InstCombine] add tests for or-xor; NFC

The existing pattern matching fails to handle all commutes.

2 years agoUpdate the implementation status of some C11 features
Aaron Ballman [Sat, 13 Aug 2022 14:16:27 +0000 (10:16 -0400)]
Update the implementation status of some C11 features

This also starts to add some test coverage for specific papers to
validate conformance against.

2 years ago[InstCombine] reduce or-xor-or patterns
Sanjay Patel [Sat, 13 Aug 2022 13:47:28 +0000 (09:47 -0400)]
[InstCombine] reduce or-xor-or patterns

(A | ?) | (A ^ B) --> (A | ?) | B
https://alive2.llvm.org/ce/z/dbNQw4

This extends the existing transform to peek through
another 'or' instruction for the common operand.

This is the underlying missing fold that should allow
issue #56711 and issue #57120 to reduce even more.

2 years ago[Instcombine] Add (simplified) pointless loop unroll / vectorization test for Issue...
Simon Pilgrim [Sat, 13 Aug 2022 13:31:49 +0000 (14:31 +0100)]
[Instcombine] Add (simplified) pointless loop unroll / vectorization test for Issue #37628

2 years ago[InstCombine] move comments closer to relevant code; NFC
Sanjay Patel [Sat, 13 Aug 2022 12:36:58 +0000 (08:36 -0400)]
[InstCombine] move comments closer to relevant code; NFC

2 years ago[InstCombine] add tests for or-xor-or; NFC
Sanjay Patel [Fri, 12 Aug 2022 18:08:11 +0000 (14:08 -0400)]
[InstCombine] add tests for or-xor-or; NFC

2 years ago[AVR] Remove debug location of spill/reload instructions
Liqin.Weng [Sat, 13 Aug 2022 12:57:22 +0000 (20:57 +0800)]
[AVR] Remove debug location of spill/reload instructions

Reviewed By: MatzeB, benshi001

Differential Revision: https://reviews.llvm.org/D129262

2 years ago[Instcombine] known-phi-br.ll - fix test bounds for positive tests
Simon Pilgrim [Sat, 13 Aug 2022 12:48:55 +0000 (13:48 +0100)]
[Instcombine] known-phi-br.ll - fix test bounds for positive tests

I was off by one in a couple of the inverse predicate tests....

2 years ago[gn build] port 7260cdd2e13a3 more
Nico Weber [Sat, 13 Aug 2022 12:41:49 +0000 (08:41 -0400)]
[gn build] port 7260cdd2e13a3 more

2 years ago[Driver] Support linking to compiler-rt for target AVR
Ben Shi [Sat, 13 Aug 2022 12:23:25 +0000 (20:23 +0800)]
[Driver] Support linking to compiler-rt for target AVR

Reviewed By: aykevl

Differential Revision: https://reviews.llvm.org/D128133

2 years ago[RISCV] Fold (sub constant, (setcc x, y, eq/neq)) -> (add constant - 1, (setcc x...
LiaoChunyu [Sat, 13 Aug 2022 12:27:21 +0000 (20:27 +0800)]
[RISCV] Fold (sub constant, (setcc x, y, eq/neq)) -> (add constant - 1, (setcc x, y, neq/eq))

(setcc x, y, eq/neq) are seqz, snez that set rd = 0/1.

addi is used to process immediate, which can save instructions for load immediate.

Reviewed By: craig.topper

Differential Revision: https://reviews.llvm.org/D131471

2 years ago[Instcombine] Add some value tracking tests for cases where the conditional branch...
Simon Pilgrim [Sat, 13 Aug 2022 12:00:46 +0000 (13:00 +0100)]
[Instcombine] Add some value tracking tests for cases where the conditional branch feeding a phi gives us known bits of the value based off the branch condition

Part of Issue #37628

2 years ago[libc++] Simplify __config a bit more and add underscores to attributes
Nikolas Klauser [Tue, 9 Aug 2022 11:22:25 +0000 (13:22 +0200)]
[libc++] Simplify __config a bit more and add underscores to attributes

Reviewed By: ldionne, #libc

Spies: libcxx-commits

Differential Revision: https://reviews.llvm.org/D129457

2 years ago[Support] computeHostNumPhysicalCores: use sched_getaffinity for all non-Android...
Fangrui Song [Sat, 13 Aug 2022 08:36:12 +0000 (01:36 -0700)]
[Support] computeHostNumPhysicalCores: use sched_getaffinity for all non-Android Linux with no custom implementation

Make the sched_getaffinity based implementation available to all architectures
(except s390x/x86 which have a custom implementation). The `CPU_ALLOC(2048)`
code supports all `CONFIG_NR_CPUS` values in Linux kernel `arch/*/configs/`.

The function is mainly used by in-process ThinLTO to decide the default number
of threads. Returning -1 will use just one thread.

Android is excluded because of the higher API level requirement:
`sched_getaffinity; # introduced-arm=12 introduced-arm64=21 introduced-x86=12 introduced-x86_64=21`

2 years ago[test][sanitizer] Disable netdb tests on Android
Vitaly Buka [Sat, 13 Aug 2022 08:07:05 +0000 (01:07 -0700)]
[test][sanitizer] Disable netdb tests on Android

2 years ago[Driver] Use addOptInFlag. NFC
Fangrui Song [Sat, 13 Aug 2022 07:51:04 +0000 (00:51 -0700)]
[Driver] Use addOptInFlag. NFC

2 years agoReapply [Orc] Properly deallocate mapped memory in MapperJITLinkMemoryManager
Anubhab Ghosh [Fri, 12 Aug 2022 11:35:39 +0000 (17:05 +0530)]
Reapply [Orc] Properly deallocate mapped memory in MapperJITLinkMemoryManager

When memory is deallocated from MapperJITLinkMemoryManager deinitialize
actions are run through mapper and in case of InProcessMapper, memory
protections of the region are reset to read/write as they were previously
changed and can be reused in future.

Differential Revision: https://reviews.llvm.org/D131768

2 years ago[lldb][ARC] Fix -Wtautological-bitwise-compare warning
Fangrui Song [Sat, 13 Aug 2022 07:18:36 +0000 (00:18 -0700)]
[lldb][ARC] Fix -Wtautological-bitwise-compare warning

2 years ago[test][sanitizer] Fix REQUIRES in the test
Vitaly Buka [Sat, 13 Aug 2022 05:41:46 +0000 (22:41 -0700)]
[test][sanitizer] Fix REQUIRES in the test

2 years ago[test][asan] Remove -fsanitize-address-use-after-scope
Vitaly Buka [Sat, 13 Aug 2022 05:36:26 +0000 (22:36 -0700)]
[test][asan] Remove -fsanitize-address-use-after-scope

It's enabled by default in D31479.

2 years ago[libcxx][hwasan] Add basic HWAddress support
Vitaly Buka [Sat, 13 Aug 2022 05:12:28 +0000 (22:12 -0700)]
[libcxx][hwasan] Add basic HWAddress support

2 years ago(Reland) [fastalloc] Support allocating specific register class in fastalloc
Luo, Yuanke [Thu, 23 Jun 2022 01:18:47 +0000 (09:18 +0800)]
(Reland) [fastalloc] Support allocating specific register class in fastalloc

Reland commit 719658d078c4

The base RA support infrastructure that only allow a specific register
class be allocated in RA pss. Since greedy RA, basic RA derived from
base RA, they all allow allocating specific register class. Fast RA
doesn't support allocating register for specific register class. This
patch is to enable ShouldAllocateClass in fast RA, so that it can
support allocating register for specific register class.

Differential Revision: https://reviews.llvm.org/D131825

2 years ago[RISCV] isImpliedByDomCondition returns an Optional<bool> not a bool.
Craig Topper [Sat, 13 Aug 2022 05:15:22 +0000 (22:15 -0700)]
[RISCV] isImpliedByDomCondition returns an Optional<bool> not a bool.

We were incorrectly checking that it returned an implicaton result,
not that the implication result itself was true.

2 years ago[ORC] Silence copy elision warning.
Sunho Kim [Sat, 13 Aug 2022 05:17:18 +0000 (14:17 +0900)]
[ORC] Silence copy elision warning.

2 years ago[openmp] Remove __ANDROID_API__ < 19 workaround
Fangrui Song [Sat, 13 Aug 2022 05:15:38 +0000 (22:15 -0700)]
[openmp] Remove __ANDROID_API__ < 19 workaround

https://github.com/android/ndk/wiki/Changelog-r24 shows that the NDK has
moved forward to at least a minimum target API of 19. Remove old workaround.

2 years ago[ORC] Specify the typename.
Sunho Kim [Sat, 13 Aug 2022 04:58:50 +0000 (13:58 +0900)]
[ORC] Specify the typename.

2 years agoRevert "[Orc] Properly deallocate mapped memory in MapperJITLinkMemoryManager"
Anubhab Ghosh [Sat, 13 Aug 2022 04:50:57 +0000 (10:20 +0530)]
Revert "[Orc] Properly deallocate mapped memory in MapperJITLinkMemoryManager"

This reverts commit 143555b2ed30746fbcc8ff84e9cef4267688f110.

2 years ago[ORC_RT][COFF] Initial platform support for COFF/x86_64.
Sunho Kim [Sat, 13 Aug 2022 04:47:31 +0000 (13:47 +0900)]
[ORC_RT][COFF] Initial platform support for COFF/x86_64.

Initial platform support for COFF/x86_64.

Completed features:
* Statically linked orc runtime.
* Full linking/initialization of static/dynamic vc runtimes and microsoft stl libraries.
* SEH exception handling.
* Full static initializers support
* dlfns
* JIT side symbol lookup/dispatch

Things to note:
* It uses vc runtime libraries found in vc toolchain installations.
* Bootstrapping state is separated because when statically linking orc runtime it needs microsoft stl functions to initialize the orc runtime, but static initializers need to be ran in order to fully initialize stl libraries.
* Process symbols can't be used blidnly on msvc platform; otherwise duplicate definition error gets generated. If process symbols are used, it's destined to get out-of-reach error at some point.
* Atexit currently not handled -- will be handled in the follow-up patches.

Reviewed By: lhames

Differential Revision: https://reviews.llvm.org/D130479

2 years ago[Orc] Properly deallocate mapped memory in MapperJITLinkMemoryManager
Anubhab Ghosh [Fri, 12 Aug 2022 11:35:39 +0000 (17:05 +0530)]
[Orc] Properly deallocate mapped memory in MapperJITLinkMemoryManager

When memory is deallocated from MapperJITLinkMemoryManager deinitialize
actions are run through mapper and in case of InProcessMapper, memory
protections of the region are reset to read/write as they were previously
changed and can be reused in future.

Differential Revision: https://reviews.llvm.org/D131768

2 years ago[clang-format] Distinguish logical and after bracket from reference
jackh [Sat, 13 Aug 2022 03:12:10 +0000 (11:12 +0800)]
[clang-format] Distinguish logical and after bracket from reference

Fix commit `b646f0955574` and remove redundant code.

Differential Revision: https://reviews.llvm.org/D131750

2 years ago[DAGCombine] Replace std::monostate equivalent in DAGCombiner.cpp
Joe Loser [Fri, 12 Aug 2022 14:22:59 +0000 (08:22 -0600)]
[DAGCombine] Replace std::monostate equivalent in DAGCombiner.cpp

Remove the `UnitT` type and operators in favor of using `std::monostate`
directly.

Differential Revision: https://reviews.llvm.org/D131778

2 years ago[mlir][python] add a todo to replace throw in dense array iterator
Jeff Niu [Sat, 13 Aug 2022 03:35:38 +0000 (23:35 -0400)]
[mlir][python] add a todo to replace throw in dense array iterator

2 years ago[mlir] Remove colon from empty dense array syntax
Jeff Niu [Sat, 13 Aug 2022 01:32:15 +0000 (21:32 -0400)]
[mlir] Remove colon from empty dense array syntax

E.g. `array<i32:>` -> `array<i32>`

Reviewed By: rriddle, jpienaar

Differential Revision: https://reviews.llvm.org/D131823

2 years ago[mlir][ods] Rename Confined and AllAttrConstraintsOf
Jeff Niu [Sat, 13 Aug 2022 01:22:26 +0000 (21:22 -0400)]
[mlir][ods] Rename Confined and AllAttrConstraintsOf

Confined -> ConfinedAttr
AllAttrConstraintsOf -> AllOfAttr

To be in line with ConfinedType and AllOfType.

Reviewed By: rriddle

Differential Revision: https://reviews.llvm.org/D131822

2 years ago[mlir] Deprecate OptionalParseResult::{hasValue,getValue}
Kazu Hirata [Sat, 13 Aug 2022 02:19:24 +0000 (19:19 -0700)]
[mlir] Deprecate OptionalParseResult::{hasValue,getValue}

This patch deprecates hasValue and getValue for consistency with
std::optional and llvm::Optional.  Note that I've migrated all known
uses of them to has_value and value, respectively.

Differential Revision: https://reviews.llvm.org/D131366