ShihPo Hung [Tue, 19 Jan 2021 07:58:36 +0000 (23:58 -0800)]
[RISCV] refactor VPatBinary (NFC)
Make it easier to reuse for intrinsic vrgatherei16
which needs to encode both LMUL & EMUL in the instruction name,
like PseudoVRGATHEREI16_VV_M1_M1 and PseudoVRGATHEREI16_VV_M1_M2.
Reviewed By: craig.topper
Differential Revision: https://reviews.llvm.org/D94951
Juneyoung Lee [Wed, 13 Jan 2021 02:43:38 +0000 (11:43 +0900)]
Allow nonnull/align attribute to accept poison
Currently LLVM is relying on ValueTracking's `isKnownNonZero` to attach `nonnull`, which can return true when the value is poison.
To make the semantics of `nonnull` consistent with the behavior of `isKnownNonZero`, this makes the semantics of `nonnull` to accept poison, and return poison if the input pointer isn't null.
This makes many transformations like below legal:
```
%p = gep inbounds %x, 1 ; % p is non-null pointer or poison
call void @f(%p) ; instcombine converts this to call void @f(nonnull %p)
```
Instead, this semantics makes propagation of `nonnull` to caller illegal.
The reason is that, passing poison to `nonnull` does not immediately raise UB anymore, so such program is still well defined, if the callee does not use the argument.
Having `noundef` attribute there re-allows this.
```
define void @f(i8* %p) { ; functionattr cannot mark %p nonnull here anymore
call void @g(i8* nonnull %p) ; .. because @g never raises UB if it never uses %p.
ret void
}
```
Another attribute that needs to be updated is `align`. This patch updates the semantics of align to accept poison as well.
Reviewed By: jdoerfert
Differential Revision: https://reviews.llvm.org/D90529
wlei [Wed, 20 Jan 2021 00:20:11 +0000 (16:20 -0800)]
[llvm-profgen][NFC] Fix the incorrect computation of callsite sample count
Differential Revision: https://reviews.llvm.org/D95009
Sergey Dmitriev [Wed, 20 Jan 2021 00:40:52 +0000 (16:40 -0800)]
[llvm-link] Improve link time for bitcode archives [NFC]
Linking large bitcode archives currently takes a lot of time with llvm-link,
this patch adds couple improvements which reduce link time for archives
- Use one Linker instance for archive instead of recreating it for each member
- Lazy load archive members
Reviewed By: tra, jdoerfert
Differential Revision: https://reviews.llvm.org/D94643
Stella Laurenzo [Wed, 20 Jan 2021 00:02:02 +0000 (16:02 -0800)]
[mlir][python] Swap shape and element_type order for MemRefType.
* Matches how all of the other shaped types are declared.
* No super principled reason fro this ordering beyond that it makes the one that was different be like the rest.
* Also matches ordering of things like ndarray, et al.
Reviewed By: ftynse, nicolasvasilache
Differential Revision: https://reviews.llvm.org/D94812
Nico Weber [Wed, 20 Jan 2021 00:02:40 +0000 (19:02 -0500)]
[gn build] fix libcxx gn file with libcxx_abi_namespace set
Nico Weber [Tue, 19 Jan 2021 23:51:39 +0000 (18:51 -0500)]
[gn build] (manually) port
933518fff82c
Ian Levesque [Thu, 15 Oct 2020 02:18:30 +0000 (22:18 -0400)]
[xray] Honor xray-never function-instrument attribute
function-instrument=xray-never wasn't actually honored before. We were
getting lucky that it worked because CodeGenFunction would omit the
other xray attributes when a function was annotated with
xray_never_instrument. This patch adds proper support.
Differential Revision: https://reviews.llvm.org/D89441
Wei Mi [Tue, 19 Jan 2021 23:26:52 +0000 (15:26 -0800)]
Fix Wmissing-field-initializers warnings.
Wei Mi [Wed, 6 Jan 2021 07:24:43 +0000 (23:24 -0800)]
[SampleFDO] Add the support to split the function profiles with context into
separate sections.
For ThinLTO, all the function profiles without context has been annotated to
outline functions if possible in prelink phase. In postlink phase, profile
annotation in postlink phase is only meaningful for function profile with
context. If the profile is large, it is better to split the profile into two
parts, one with context and one without, so the profile reading in postlink
phase only has to read the part with context. To have the profile splitting,
we extend the ExtBinary format to support different section arrangement. It
will be flexible to add other section layout in the future without the need
to create new class inheriting from ExtBinary class.
Differential Revision: https://reviews.llvm.org/D94435
Jackson Fellows [Tue, 19 Jan 2021 22:41:45 +0000 (22:41 +0000)]
Implement constant folding for DivFOp
Add a constant folder for DivFOp. Analogous to existing folders for
AddFOp, SubFOp, and MulFOp. Matches the behavior of existing LLVM
constant folding (https://github.com/llvm/llvm-project/blob/
999f5da6b3088fa4c0bb9d05b358d015ca74c71f/llvm/lib/IR/ConstantFold.cpp#L1432).
Reviewed By: ftynse
Differential Revision: https://reviews.llvm.org/D94939
Sam Clegg [Tue, 19 Jan 2021 22:29:05 +0000 (14:29 -0800)]
Revert "[WebAssembly] call_indirect issues table number relocs"
This reverts commit
418df4a6ab35d343cc0f2608c90a73dd9b8d0ab1.
This change broke emscripten tests, I believe because it started
generating 5-byte a wide table index in the call_indirect instruction.
Neither v8 nor wabt seem to be able to handle that. The spec
currently says that this is single 0x0 byte and:
"In future versions of WebAssembly, the zero byte occurring in the
encoding of the call_indirectcall_indirect instruction may be used to
index additional tables."
So we need to revisit this change. For backwards compat I guess
we need to guarantee that __indirect_function_table is always at
address zero. We could also consider making this a single-byte
relocation with and assert if have more than 127 tables (for now).
Differential Revision: https://reviews.llvm.org/D95005
Stephen Kelly [Sun, 17 Jan 2021 16:22:41 +0000 (16:22 +0000)]
Add API to retrieve a clade kind from ASTNodeKind
Differential Revision: https://reviews.llvm.org/D94877
Eric Christopher [Tue, 19 Jan 2021 22:31:31 +0000 (14:31 -0800)]
Remove unused functions.
Stephen Kelly [Sun, 17 Jan 2021 16:26:02 +0000 (16:26 +0000)]
Remove TypedMatcherOps from VariantValue
It provides no features or advantage over ASTNodeKind-based handling.
Differential Revision: https://reviews.llvm.org/D94876
Richard Smith [Tue, 19 Jan 2021 22:37:10 +0000 (14:37 -0800)]
[msabi] Mangle a template argument referring to array-to-pointer decay
applied to an array the same as the array itself.
This follows MS ABI, and corrects a regression from the implementation
of generalized non-type template parameters, where we "forgot" how to
mangle this case.
Craig Topper [Tue, 19 Jan 2021 22:31:42 +0000 (14:31 -0800)]
[RISCV] Remove NotHasStdExtZbb predicate from zext.h/sext.b/sext.h InstAliases. NFC
NotHasStdExtZbb doesn't have an AssemblerPredicate associated with it
so it didn't do anything. We don't need it either because the sorting
rules in tablegen prioritize by number of predicates. So the
dedicated instructions in the B extension that have predicates
will be prioritized automatically.
Stephen Kelly [Sat, 16 Jan 2021 14:25:11 +0000 (14:25 +0000)]
[ASTMatchers] Allow use of mapAnyOf in more contexts
Add an operator overload to ArgumentAdaptingMatcherFunc to allow use of
mapAnyOf within hasAncestor, hasParent etc.
Differential Revision: https://reviews.llvm.org/D94864
Stella Stamenova [Tue, 19 Jan 2021 22:09:09 +0000 (14:09 -0800)]
[lldb/test] Skip TestProcessAttach: test_attach_to_process_from_different_dir_by_id on Windows
This test is flakey on Windows and on failure it hangs causing the test suite to fail and future builds (on the buildbot, especially) to fail because they cannot re-write the files that are currently in use
Sean Silva [Fri, 15 Jan 2021 02:28:48 +0000 (18:28 -0800)]
[mlir][splitting std] move 2 more ops to `tensor`
- DynamicTensorFromElementsOp
- TensorFromElements
Differential Revision: https://reviews.llvm.org/D94994
Stephen Kelly [Tue, 19 Jan 2021 20:50:54 +0000 (20:50 +0000)]
[ASTMatchers] NFC Rearrange declarations to allow more arg adapting
Stella Laurenzo [Tue, 19 Jan 2021 21:16:16 +0000 (13:16 -0800)]
[mlir][python] Add facility for extending generated python ODS.
* This isn't exclusive with other mechanisms for more ODS centric op definitions, but based on discussions, we feel that we will always benefit from a python escape hatch, and that is the most natural way to write things that don't fit the mold.
* I suspect this facility needs further tweaking, and once it settles, I'll document it and add more tests.
* Added extensions for linalg, since it is unusable without them and continued to evolve my e2e example.
Reviewed By: ftynse
Differential Revision: https://reviews.llvm.org/D94752
Sam Clegg [Tue, 19 Jan 2021 20:10:15 +0000 (12:10 -0800)]
[lld][WebAssembly] Don't defined indirect function table in relocatable output
Object files (and the output --relocatable) should never define
__indirect_function_table. It should always be linker synthesized
with the final output executable.
Differential Revision: https://reviews.llvm.org/D94993
Richard Smith [Tue, 19 Jan 2021 19:54:06 +0000 (11:54 -0800)]
Revert "DR2064: decltype(E) is only a dependent type if E is type-dependent, not
if E is merely instantiation-dependent."
This change leaves us unable to distinguish between different function
templates that differ in only instantiation-dependent ways, for example
template<typename T> decltype(int(T())) f();
template<typename T> decltype(int(T(0))) f();
We'll need substantially better support for types that are
instantiation-dependent but not dependent before we can go ahead with
this change.
This reverts commit
e3065ce238475ec202c707f4c58d90df171626ca.
Richard Smith [Tue, 19 Jan 2021 20:09:12 +0000 (12:09 -0800)]
Ensure we don't strip the ConstantExpr carrying a non-type template
argument's value off it during substitution.
Siva Chandra [Fri, 15 Jan 2021 09:34:58 +0000 (01:34 -0800)]
[libc] Extend the current fenv functions to aarch64.
This change does not try to move the common parts of x86 and aarch64 and
build few abstractions over them. While this is possible, x86 story
needs a bit of cleanup, especially around manipulation of the mxcsr
register. Moreover, on x86 one can raise exceptions without performing
exception raising operations. So, all of this can be done in follow up
patches.
Reviewed By: lntue
Differential Revision: https://reviews.llvm.org/D94947
Alexey Bataev [Tue, 19 Jan 2021 20:22:53 +0000 (12:22 -0800)]
[OPENMP]Do not use OMP_MAP_TARGET_PARAM for data movement directives.
OMP_MAP_TARGET_PARAM flag is used to mark the data that shoud be passed
as arguments to the target kernels, nothing else. But the compiler still
marks the data with OMP_MAP_TARGET_PARAM flags even if the data is
passed to the data movement directives, like target data, target update
etc. This flag is just ignored for this directives and the compiler does
not need to emit it.
Reviewed By: cchen
Differential Revision: https://reviews.llvm.org/D91261
Arthur Eubanks [Thu, 7 Jan 2021 22:01:04 +0000 (14:01 -0800)]
[polly][NewPM][test] Fix polly tests under -enable-new-pm
In preparation for turning on opt's -enable-new-pm by default, this pins
uses of passes via the legacy "opt -passname" with pass names beginning
with "polly-" and "polyhedral-info" to the legacy PM. Many of these
tests use -analyze, which isn't supported in the new PM.
(This doesn't affect uses of "opt -passes=passname").
rL240766 accidentally removed `-polly-prepare` in
phi_not_grouped_at_top.ll, and it also doesn't use the output of
-analyze.
Reviewed By: Meinersbur
Differential Revision: https://reviews.llvm.org/D94266
Mircea Trofin [Sat, 16 Jan 2021 02:19:56 +0000 (18:19 -0800)]
[NFC] Disallow unused prefixes under Other
Differential Revision: https://reviews.llvm.org/D94853
Alexey Bataev [Tue, 19 Jan 2021 19:19:09 +0000 (11:19 -0800)]
Revert "[SLP]Merge reorder and reuse shuffles."
This reverts commit
438682de6a38ac97f89fa38faf5c8dc9b09cd9ad to fix the
bug with the reducing size of the resulting vector for the entry node
with multiple users.
Jeroen Dobbelaere [Tue, 19 Jan 2021 19:45:35 +0000 (20:45 +0100)]
[NFC] cleanup noalias2.ll test
D75825 and D75828 modified llvm/test/Transforms/Inline/noalias2.ll to handle llvm.assume. The checking though was broken.
The NO_ASSUME has been replaced by a normal CHECK; the ASSUME rules were never triggered and have been removed.
The test checks have been regenerated.
Reviewed By: nikic
Differential Revision: https://reviews.llvm.org/D94978
Mitch Phillips [Tue, 19 Jan 2021 19:20:23 +0000 (11:20 -0800)]
Revert "[PDB] Defer relocating .debug$S until commit time and parallelize it"
This reverts commit
6529d7c5a45b1b9588e512013b02f891d71bc134.
Reason: Broke the ASan buildbots.
http://lab.llvm.org:8011/#/builders/99/builds/1567
peter klausler [Sat, 16 Jan 2021 00:59:52 +0000 (16:59 -0800)]
[flang] Refine WhyNotModifiable()
The utility routine WhyNotModifiable() needed to become more
aware of the use of pointers in data-refs; the targets of
pointer components are sometimes modifiable even when the
leftmost ("base") symbol of a data-ref is not.
Added a new unit test for WhyNotModifiable() that uses internal
READ statements (mostly), since I/O semantic checking uses
WhyNotModifiable() for all its definability checking.
Differential Revision: https://reviews.llvm.org/D94849
Fangrui Song [Tue, 19 Jan 2021 19:42:52 +0000 (11:42 -0800)]
[ELF] Support R_PPC64_ADDR16_HIGH
R_PPC64_ADDR16_HI represents bits 16-31 of a 32-bit value
R_PPC64_ADDR16_HIGH represents bits 16-31 of a 64-bit value.
In the Linux kernel, `LOAD_REG_IMMEDIATE_SYM` defined in `arch/powerpc/include/asm/ppc_asm.h`
uses @l, @high, @higher, @highest to load the 64-bit value of a symbol.
Fixes https://github.com/ClangBuiltLinux/linux/issues/1260
Fangrui Song [Tue, 19 Jan 2021 19:16:27 +0000 (11:16 -0800)]
[ELF] Error for out-of-range R_PPC64_ADDR16_HA, R_PPC64_ADDR16_HI and their friends
There are no tests for REL16_* and TPREL16_*.
Fangrui Song [Tue, 19 Jan 2021 19:32:53 +0000 (11:32 -0800)]
[ELF] Improve R_PPC64_ADDR* relocation tests
Jonas Devlieghere [Tue, 19 Jan 2021 19:37:45 +0000 (11:37 -0800)]
[llvm] Protect signpost map with a mutex
Use a mutex to protect concurrent access to the signpost map. This fixes
nondeterministic crashes in LLDB that appeared after using signposts in
the timer implementation.
Differential revision: https://reviews.llvm.org/D94285
Wim Leflere [Tue, 19 Jan 2021 19:33:30 +0000 (14:33 -0500)]
[libc++][P1679] add string contains
C++23 string contains implementation and tests
Paper: https://wg21.link/P1679R3
Standard (string): https://eel.is/c++draft/string.contains
Standard (string_view): https://eel.is/c++draft/string.view.ops#lib:contains,basic_string_view
Differential Revision: https://reviews.llvm.org/D93912
Mariya Podchishchaeva [Mon, 18 Jan 2021 15:53:08 +0000 (18:53 +0300)]
[ScalarizeMaskedMemIntrin] Add missing dependency
The pass has dependency on 'TargetTransformInfoWrapperPass', but the
corresponding call to INITIALIZE_PASS_DEPENDENCY was missing.
Differential Revision: https://reviews.llvm.org/D94916
Nikita Popov [Sat, 16 Jan 2021 11:41:35 +0000 (12:41 +0100)]
Reapply [InstCombine] Replace one-use select operand based on condition
Relative to the original change, this adds a check that the
instruction on which we're replacing operands is safe to speculatively
execute, because that's what we're effectively doing. We're executing
the instruction with the replaced operand, which is fine if it's pure,
but not fine if can cause side-effects or UB (aka is not speculatable).
Additionally, we cannot (generally) replace operands in phi nodes,
as these may refer to a different loop iteration. This is also covered
by the speculation check.
-----
InstCombine already performs a fold where X == Y ? f(X) : Z is
transformed to X == Y ? f(Y) : Z if f(Y) simplifies. However,
if f(X) only has one use, then we can always directly replace the
use inside the instruction. To actually be profitable, limit it to
the case where Y is a non-expr constant.
This could be further extended to replace uses further up a one-use
instruction chain, but for now this only looks one level up.
Among other things, this also subsumes D94860.
Differential Revision: https://reviews.llvm.org/D94862
Nikita Popov [Tue, 19 Jan 2021 19:11:20 +0000 (20:11 +0100)]
[InstCombine] Add additional tests for select operand replacement (NFC)
In particular, add tests for speculatable and non-speculatable
instructions.
Arthur Eubanks [Mon, 14 Dec 2020 23:03:28 +0000 (15:03 -0800)]
[wasm][LLD] Rename --lto-new-pass-manager to --no-lto-legacy-pass-manager
This follows a similar ELF change.
Reviewed By: MaskRay, sbc100
Differential Revision: https://reviews.llvm.org/D93253
Craig Topper [Tue, 19 Jan 2021 18:58:49 +0000 (10:58 -0800)]
[RISCV] Add DAG combine to turn (setcc X, 1, setne) -> (setcc X, 0, seteq) if we can prove X is 0/1.
If we are able to compare with 0 instead of 1, we might be able
to fold the setcc into a beqz/bnez.
Often these setccs start life as an xor that gets converted to
a setcc by DAG combiner's rebuildSetcc. I looked into a detecting
(xor X, 1) and converting to (seteq X, 0) based on boolean contents
being 0/1 in rebuildSetcc instead of using computeKnownBits. It was
very perturbing to AMDGPU tests which I didn't look closely at.
It had a few changes on a couple other targets, but didn't seem
to be much if any improvement.
Reviewed By: lenary
Differential Revision: https://reviews.llvm.org/D94730
Shilei Tian [Tue, 19 Jan 2021 19:18:35 +0000 (14:18 -0500)]
[Clang][OpenMP] Fixed an issue that clang crashed when compiling OpenMP program in device only mode without host IR
D94745 rewrites the `deviceRTLs` using OpenMP and compiles it by directly
calling the device compilation. `clang` crashes because entry in
`OffloadEntriesDeviceGlobalVar` is unintialized. Current design supposes the
device compilation can only be invoked after host compilation with the host IR
such that `clang` can initialize `OffloadEntriesDeviceGlobalVar` from host IR.
This avoids us using device compilation directly, especially when we only have
code wrapped into `declare target` which are all device code. The same issue
also exists for `OffloadEntriesInfoManager`.
In this patch, we simply initialized an entry if it is not in the maps. Not sure
we need an option to tell the device compiler that it is invoked standalone.
Reviewed By: jdoerfert
Differential Revision: https://reviews.llvm.org/D94871
Louis Dionne [Mon, 18 Jan 2021 17:18:18 +0000 (12:18 -0500)]
[libc++] Make LIBCXX_ENABLE_FILESYSTEM fully consistent
Previously, LIBCXX_ENABLE_FILESYSTEM controlled only whether the filesystem
support was compiled into libc++'s library. This commit promotes the
setting to a first-class option like LIBCXX_ENABLE_LOCALIZATION, where
the whole library is aware of the setting and features that depend on
<filesystem> won't be provided at all. The test suite is also properly
annotated such that tests that depend on <filesystem> are disabled when
the library doesn't support it.
This is an alternative to https://llvm.org/D94824, but also an improvement
along the lines of LIBCXX_ENABLE_LOCALIZATION that I had been wanting to
make for a while.
Differential Revision: https://reviews.llvm.org/D94921
Louis Dionne [Thu, 14 Jan 2021 21:27:53 +0000 (16:27 -0500)]
[libc++] Unbreak the debug mode
When the Debug mode is enabled, we disable extern declarations because we
don't want to use the functions compiled in the library, which might not
have had the debug mode enabled when built. However, some extern declarations
need to be kept, because code correctness depends on it.
31e820378b8a removed those declarations, which had the unintended
consequence of breaking the debug build. This commit fixes that by
re-introducing a separate macro for the required extern declarations,
and adds a comment so that we don't fall into that trap in the future.
Differential Revision: https://reviews.llvm.org/D94718
Reid Kleckner [Tue, 19 Jan 2021 19:03:18 +0000 (11:03 -0800)]
Add bounds checking assertions to APValue, NFC
These checks help find llvm.org/pr48582 without ASan
Reid Kleckner [Tue, 19 Jan 2021 19:00:33 +0000 (11:00 -0800)]
Consider ASan messages interesting for creduce
Helped me reduce llvm.org/pr48582
Jeroen Dobbelaere [Tue, 19 Jan 2021 19:04:52 +0000 (20:04 +0100)]
[noalias.decl] Look through llvm.experimental.noalias.scope.decl
Just like llvm.assume, there are a lot of cases where we can just ignore llvm.experimental.noalias.scope.decl.
Reviewed By: nikic
Differential Revision: https://reviews.llvm.org/D93042
Richard Smith [Tue, 19 Jan 2021 19:04:08 +0000 (11:04 -0800)]
[www] Fix background color in table cell.
Brendon Cahoon [Tue, 19 Jan 2021 18:42:29 +0000 (12:42 -0600)]
[Hexagon] Fix segment start to adjust for gaps between segments
The Hexagon Vector Combine pass genertes stores for a complete
aligned vector. The start of each section is a multiple of the
vector size, so that value is passed to normalize to compute
the offset of the stores in the section. The first store may
not occur at offset 0 when there is a gap between sections.
Utkarsh Saxena [Mon, 18 Jan 2021 20:01:46 +0000 (21:01 +0100)]
[clangd] Use ASTSignals in Heuristics CC Ranking.
Differential Revision: https://reviews.llvm.org/D94927
Jay Foad [Tue, 19 Jan 2021 16:15:23 +0000 (16:15 +0000)]
[AMDGPU] Simpler names for arch-specific ttmp registers. NFC.
Rename the *_gfx9_gfx10 ttmp registers to *_gfx9plus for simplicity,
and use the corresponding isGFX9Plus predicate to decide when to use
them instead of the old *_vi versions.
Differential Revision: https://reviews.llvm.org/D94975
Jessica Paquette [Tue, 19 Jan 2021 18:38:04 +0000 (10:38 -0800)]
Fix buildbot after
cfc60730179042a93cb9cb338982e71d20707a24
Windows buildbots were not happy with using find_if + instructionsWithoutDebug.
In
cfc60730179042a9, instructionsWithoutDebug is not technically necessary. So,
just iterate over the block directly.
http://lab.llvm.org:8011/#/builders/127/builds/4732/steps/7/logs/stdio
Jessica Paquette [Fri, 18 Dec 2020 20:56:14 +0000 (12:56 -0800)]
[GlobalISel] Combine (a[0]) | (a[1] << k1) | ...| (a[m] << kn) into a wide load
This is a restricted version of the combine in `DAGCombiner::MatchLoadCombine`.
(See D27861)
This tries to recognize patterns like below (assuming a little-endian target):
```
s8* x = ...
s32 val = a[0] | (a[1] << 8) | (a[2] << 16) | (a[3] << 24)
->
s32 val = *((i32)a)
s8* x = ...
s32 val = a[3] | (a[2] << 8) | (a[1] << 16) | (a[0] << 24)
->
s32 val = BSWAP(*((s32)a))
```
(This patch also handles the big-endian target case as well, in which the first
example above has a BSWAP, and the second example above does not.)
To recognize the pattern, this searches from the last G_OR in the expression
tree.
E.g.
```
Reg Reg
\ /
OR_1 Reg
\ /
OR_2
\ Reg
.. /
Root
```
Each non-OR register in the tree is put in a list. Each register in the list is
then checked to see if it's an appropriate load + shift logic.
If every register is a load + potentially a shift, the combine checks if those
loads + shifts, when OR'd together, are equivalent to a wide load (possibly with
a BSWAP.)
To simplify things, this patch
(1) Only handles G_ZEXTLOADs (which appear to be the common case)
(2) Only works in a single MachineBasicBlock
(3) Only handles G_SHL as the bit twiddling to stick the small load into a
specific location
An IR example of this is here: https://godbolt.org/z/4sP9Pj (lifted from
test/CodeGen/AArch64/load-combine.ll)
At -Os on AArch64, this is a 0.5% code size improvement for CTMark/sqlite3,
and a 0.4% improvement for CTMark/7zip-benchmark.
Also fix a bug in `isPredecessor` which caused it to fail whenever `DefMI` was
the first instruction in the block.
Differential Revision: https://reviews.llvm.org/D94350
Fraser Cormack [Wed, 13 Jan 2021 12:27:05 +0000 (12:27 +0000)]
[RISCV] Add ISel patterns for scalable mask exts & truncs
Original patch by @rogfer01.
This patch adds support for sign-, zero-, and any-extension from
scalable mask vector types to integer vector types, as well as
truncation in the opposite direction.
Authored-by: Roger Ferrer Ibanez <rofirrim@gmail.com>
Co-Authored-by: Fraser Cormack <fraser@codeplay.com>
Reviewed By: craig.topper
Differential Revision: https://reviews.llvm.org/D94590
Abhina Sreeskantharajan [Tue, 19 Jan 2021 18:04:27 +0000 (13:04 -0500)]
[SystemZ][z/OS] Fix Permission denied pattern matching
On z/OS, the error message "EDC5111I Permission denied." is not matched correctly in lit tests. This patch updates the check expression to match successfully.
Differential Revision: https://reviews.llvm.org/D94432
Michael Kruse [Tue, 19 Jan 2021 16:28:43 +0000 (10:28 -0600)]
[Polly] Update isl to isl-0.23-61-g24e8cd12.
This fixes llvm.org/PR48554
Some test cases had to be updated because the hash function for
union_maps have been changed which affects the output order.
Raphael Isemann [Tue, 19 Jan 2021 17:57:32 +0000 (18:57 +0100)]
[lldb][docs] Update .htaccess to redirect from old SB API documentation to new one
This is mostly SEO so that the new API can take over the old API when people
search for the different SB* classes. Sadly epydoc decided to throw in a -class
prefix behind all the class file names, so we can't just overwrite the old files
with the newly generated ones.
Reviewed By: JDevlieghere
Differential Revision: https://reviews.llvm.org/D94900
David Green [Tue, 19 Jan 2021 17:56:50 +0000 (17:56 +0000)]
[ARM] Expand vXi1 VSELECT's
We have no lowering for VSELECT vXi1, vXi1, vXi1, so mark them as
expanded to turn them into a series of logical operations.
Differential Revision: https://reviews.llvm.org/D94946
Raphael Isemann [Tue, 19 Jan 2021 17:53:52 +0000 (18:53 +0100)]
[lldb][docs] Add a doc page for enums and constants
Enums and constants are currently missing in the new LLDB Python API docs.
In theory we could just let them be autogenerated like the SB API classes, but sadly the generated documentation
suffers from a bunch of problems. Most of these problems come from the way SWIG is representing enums, which is
done by translating every single enum case into its own constant. This has a bunch of nasty effects:
* Because SWIG throws away the enum types, we can't actually reference the enum type itself in the API. Also because automodapi is impossible to script, this can't be fixed in post (at least without running like sed over the output files).
* The lack of enum types also causes that every enum *case* has its own full doc page. Having a full doc page that just shows a single enum case is pointless and it really slows down sphinx.
* There is no SWIG code for the enums, so there is also no place to write documentation strings for them. Also there is no support for copying the doxygen strings (which would be in the wrong format, but better than nothing) for enums (let alone our defines), so we can't really document all this code.
* Because the enum cases are just forwards to the native lldb module (which we mock), automodapi actually takes the `Mock` docstrings and adds it to every single enum case.
I don't see any way to solve this via automodapi or SWIG. The most reasonable way to solve this is IMHO to write a simple Clang tool
that just parses our enum/constant headers and emits an *.rst file that we check in. This way we can do all the LLDB-specific enum case and constant
grouping that we need to make a readable documentation page.
As we're without any real documentation until I get around to write that tool, I wrote a doc page for the enums/constants as a stop gap measure.
Most of this is done by just grepping our enum header and then manually cleaning up all the artifacts and copying the few doc strings we have.
Reviewed By: JDevlieghere
Differential Revision: https://reviews.llvm.org/D94959
Andrzej Warzynski [Tue, 19 Jan 2021 14:24:20 +0000 (14:24 +0000)]
[flang][driver] Move isFixedFormSuffix and isFreeFormSuffix to flangFrontend
isFixedFormSuffix and isFreeFormSuffix should be defined in
flangFrontend rather than flangFrontendTool library. That's for 2
reasons:
* these methods are used in flangFrontend rather than flangFrontendTool
* flangFrontendTool depends on flangFrontend
As mentioned in the post-commit review for D94228, without this change
shared library builds fail.
Differential Revision: https://reviews.llvm.org/D94968
Stella Laurenzo [Mon, 18 Jan 2021 19:27:19 +0000 (11:27 -0800)]
[mlir][python] Factor out standalone OpView._ods_build_default class method.
* This allows us to hoist trait level information for regions and sized-variadic to class level attributes (_ODS_REGIONS, _ODS_OPERAND_SEGMENTS, _ODS_RESULT_SEGMENTS).
* Eliminates some splicey python generated code in favor of a native helper for it.
* Makes it possible to implement custom, variadic and region based builders with one line of python, without needing to manually code access to the segment attributes.
* Needs follow-on work for region based callbacks and support for SingleBlockImplicitTerminator.
* A follow-up will actually add ODS support for generating custom Python builders that delegate to this new method.
* Also includes the start of an e2e sample for constructing linalg ops where this limitation was discovered (working progressively through this example and cleaning up as I go).
Differential Revision: https://reviews.llvm.org/D94738
Björn Schäpers [Mon, 18 Jan 2021 12:15:20 +0000 (13:15 +0100)]
[clang-format] Apply Allman style to lambdas
Differential Revision: https://reviews.llvm.org/D94906
Nikita Popov [Sat, 16 Jan 2021 14:32:40 +0000 (15:32 +0100)]
[ValueTracking] Strengthen impliesPoison reasoning
Split impliesPoison into two recursive walks, one over V, the
other over ValAssumedPoison. This allows us to reason about poison
implications in a number of additional cases that are important
in practice. This is a generalized form of D94859, which handles
the cmp to cmp implication in particular.
Differential Revision: https://reviews.llvm.org/D94866
Jay Foad [Tue, 19 Jan 2021 16:46:44 +0000 (16:46 +0000)]
[AMDGPU] Fix test case for D94010
KareemErgawy-TomTom [Tue, 19 Jan 2021 16:11:55 +0000 (17:11 +0100)]
[MLIR][SPIRV] Add `SignedOp` trait.
This commit adds a new trait that can be attached to ops that have
signed semantics.
Reviewed By: antiagainst
Differential Revision: https://reviews.llvm.org/D94896
Jay Foad [Tue, 19 Jan 2021 16:35:53 +0000 (16:35 +0000)]
[AMDGPU] Simplify test case for D94010
Hansang Bae [Fri, 15 Jan 2021 23:37:13 +0000 (17:37 -0600)]
[OpenMP] Fix atomic entries for captured logical operation
Added missing code for the captured atomic operation.
Differential Revision: https://reviews.llvm.org/D94848
Fraser Cormack [Wed, 13 Jan 2021 13:33:38 +0000 (13:33 +0000)]
[RISCV] Extend RVV VType info with the type's AVL (NFC)
This patch factors out the "VLMax" operand passed to most
scalable-vector ISel patterns into a property of each VType.
This is seen as a preparatory change to allow RVV in the future to
more easily support fixed-length vector types with constrained vector
lengths, with the AVL operand set to the length of the fixed-length
vector. It has no effect on the scalable code generation path.
Reviewed By: HsiangKai
Differential Revision: https://reviews.llvm.org/D94594
David Green [Tue, 19 Jan 2021 15:38:46 +0000 (15:38 +0000)]
[ARM] Add MVE add.sat costs
This adds some basic MVE sadd_sat/ssub_sat/uadd_sat/usub_sat costs,
based on when the instruction is legal. With smaller than legal types
that are promoted we generate shr(qadd(shl, shl)), so the cost is 4
appropriately.
Differential Revision: https://reviews.llvm.org/D94958
Valentin Clement [Tue, 19 Jan 2021 15:28:09 +0000 (10:28 -0500)]
[flang][directive] Get rid of flangClassValue in TableGen
The TableGen emitter for directives has two slots for flangClass information and this was mainly
to be able to keep up with the legacy openmp parser at the time. Now that all clauses are encapsulated in
AccClause or OmpClause, these two strings are not necessary anymore and were the the source of couple
of problem while working with the generic structure checker for OpenMP.
This patch remove the flangClassValue string from DirectiveBase.td and use the string flangClass as the
placeholder for the encapsulated class.
Reviewed By: sameeranjoshi
Differential Revision: https://reviews.llvm.org/D94821
Victor Huang [Tue, 19 Jan 2021 15:01:22 +0000 (09:01 -0600)]
[PowerPC] Fix the check for the instruction using FRSP/XSRSP output register
When performing peephole optimization to simplify the code, after removing
passed FPSP/XSRSP instruction we will set any uses of that FRSP/XSRSP to the
source of the FRSP/XSRSP.
We are finding the machine instruction using virtual register holding FRSP/XSRSP
results by searching all following instructions and encountering an issue
that the first use of the virtual register is a debug MI causing:
1. virtual register in the debug MI removed unexpectedly.
2. virtual register used in non-debug MI not replaced with the source of
FRSP/XSRSP. which stays in a undef status.
This patch fix the issue by only searching non-debug machine instruction using
virtual register holding FRSP/XSRSP results when the vr only has one non debug
usage.
Differential Revisien: https://reviews.llvm.org/D94711
Reviewed by: nemanjai
Raul Tambre [Sun, 10 Jan 2021 12:11:35 +0000 (14:11 +0200)]
[CMake] Remove dead code setting policies to NEW
cmake_minimum_required(VERSION) calls cmake_policy(VERSION),
which sets all policies up to VERSION to NEW.
LLVM started requiring CMake 3.13 last year, so we can remove
a bunch of code setting policies prior to 3.13 to NEW as it
no longer has any effect.
Reviewed By: phosek, #libunwind, #libc, #libc_abi, ldionne
Differential Revision: https://reviews.llvm.org/D94374
Utkarsh Saxena [Fri, 15 Jan 2021 16:19:53 +0000 (17:19 +0100)]
[clangd] Index local classes, virtual and overriding methods.
Previously we did not record local class declarations. Now with features like
findImplementation and typeHierarchy, we have a need to index such local
classes to accurately report subclasses and implementations of methods.
Performance testing results:
- No changes in indexing timing.
- No significant change in memory usage.
- **1%** increase in #relations.
- **0.17%** increase in #refs.
- **0.22%** increase #symbols.
**New index stats**
Time to index: **4:13 min**
memory usage **543MB**
number of symbols: **521.5K**
number of refs: **8679K**
number of relations: **49K**
**Base Index stats**
Time to index: **4:15 min**
memory usage **542MB**
number of symbols: **520K**
number of refs: **8664K**
number of relations: **48.5K**
Fixes: https://github.com/clangd/clangd/issues/644
Differential Revision: https://reviews.llvm.org/D94785
Andy Wingo [Mon, 30 Nov 2020 13:56:57 +0000 (14:56 +0100)]
[WebAssembly][lld] Fix call-indirect.s test to validate
Add missing address operand, so that we can validate the output files.
Depends on D92315.
Differential Revision: https://reviews.llvm.org/D92320
David Green [Tue, 19 Jan 2021 15:06:06 +0000 (15:06 +0000)]
[ARM] Expand add.sat/sub.sat cost checks. NFC
Alex Richardson [Tue, 19 Jan 2021 13:02:29 +0000 (13:02 +0000)]
[libc++] Sync TEST_HAS_TIMESPEC_GET and _LIBCPP_HAS_TIMESPEC_GET on FreeBSD
Commit
5e416ba943b7c737deb8eca62756f7b4fa925845 (D71522) updated the
__config header but didn't change test_macros.h.
This fixes libcxx/language.support/has_timespec_get.compile.pass.cpp on
FreeBSD12/13.
Reviewed By: #libc, dim, ldionne
Differential Revision: https://reviews.llvm.org/D94292
Florian Hahn [Tue, 19 Jan 2021 14:34:55 +0000 (14:34 +0000)]
[LoopRotate] Calls not lowered to calls should not block rotation.
83daa49758a1 made loop-rotate more conservative in the presence of
function calls in the prepare-for-lto stage. The code did not properly
account for calls that are no actual function calls, like calls to
intrinsics. This patch updates the code to ensure only calls that are
lowered to actual calls are considered inline candidates.
Praveen [Tue, 19 Jan 2021 12:58:44 +0000 (18:28 +0530)]
[Flang][OpenMP] Add semantic checks for OpenMP Workshare Construct
Add Semantic checks for OpenMP 4.5 - 2.7.4 Workshare Construct.
- The structured block in a workshare construct may consist of only
scalar or array assignments, forall or where statements,
forall, where, atomic, critical or parallel constructs.
- All array assignments, scalar assignments, and masked array
assignments must be intrinsic assignments.
- The construct must not contain any user defined function calls unless
the function is ELEMENTAL.
Test cases : omp-workshare03.f90, omp-workshare04.f90, omp-workshare05.f90
Resolve test cases (omp-workshare01.f90 and omp-workshare02.f90) marked as XFAIL
Reviewed By: kiranchandramohan
Differential Revision: https://reviews.llvm.org/D93091
Simon Pilgrim [Tue, 19 Jan 2021 14:28:30 +0000 (14:28 +0000)]
[X86] Regenerate fmin/fmax reduction tests
Add missing check-prefixes + v1f32 tests
Raphael Isemann [Tue, 19 Jan 2021 14:25:15 +0000 (15:25 +0100)]
[lldb] Fix two documentation typos
Lei Zhang [Tue, 19 Jan 2021 14:13:44 +0000 (09:13 -0500)]
[mlir][spirv] Define spv.GLSL.Fma and add lowerings
Also changes some rewriter.create + rewriter.replaceOp calls
into rewriter.replaceOpWithNewOp calls.
Reviewed By: hanchung
Differential Revision: https://reviews.llvm.org/D94965
Tim Northover [Thu, 14 Jan 2021 09:09:54 +0000 (09:09 +0000)]
AArch64: add apple-a14 as a CPU
This CPU supports all v8.5a features except BTI, and so identifies as v8.5a to
Clang. A bit weird, but the best way for things like xnu to detect the new
features it cares about.
Nicolas Vasilache [Tue, 19 Jan 2021 13:48:08 +0000 (13:48 +0000)]
[mlir][Affine] Revisit and simplify composeAffineMapAndOperands.
In prehistorical times, AffineApplyOp was allowed to produce multiple values.
This allowed the creation of intricate SSA use-def chains.
AffineApplyNormalizer was originally introduced as a means of reusing the AffineMap::compose method to write SSA use-def chains.
Unfortunately, symbols that were produced by an AffineApplyOp needed to be promoted to dims and reordered for the mathematical composition to be valid.
Since then, single result AffineApplyOp became the law of the land but the original assumptions were not revisited.
This revision revisits these assumptions and retires AffineApplyNormalizer.
Differential Revision: https://reviews.llvm.org/D94920
Hans Wennborg [Tue, 19 Jan 2021 12:41:41 +0000 (13:41 +0100)]
[ThinLTO] Also prune Thin-* files from the ThinLTO cache
Such files (Thin-%%%%%%.tmp.o) are supposed to be deleted immediately
after they're used (either by renaming or deletion). However, we've seen
instances on Windows where this doesn't happen, probably due to the
filesystem being flaky. This is effectively a resource leak which has
prevented us from using the ThinLTO cache on Windows.
Since those temporary files are in the thinlto cache directory which we
prune periodically anyway, allowing them to be pruned too seems like a
tidy way to solve the problem.
Differential revision: https://reviews.llvm.org/D94962
Med Ismail Bennani [Tue, 19 Jan 2021 13:31:25 +0000 (14:31 +0100)]
[llvm/Orc] Fix ExecutionEngine module build breakage
This patch updates the llvm module map to reflect changes made in
`
24672ddea3c97fd1eca3e905b23c0116d7759ab8` and fixes the module builds
(`-DLLVM_ENABLE_MODULES=On`).
Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
Faris Rehman [Tue, 19 Jan 2021 13:15:53 +0000 (13:15 +0000)]
[flang][driver] Add standard macro predefinitions for compiler version
Add the following standard predefinitions that f18 supports:
* `__flang__`,
* `__flang_major__`,
* `__flang_minor__`,
* `__flang_patchlevel__`
Summary of changes:
- Populate Fortran::parser::Options#predefinitions with the default
supported predefinitions
Differential Revision: https://reviews.llvm.org/D94516
AndreyChurbanov [Tue, 19 Jan 2021 13:21:22 +0000 (16:21 +0300)]
[OpenMP] libomp: cleanup parsing of OMP_ALLOCATOR env variable.
Differential Revision: https://reviews.llvm.org/D94932
OCHyams [Tue, 19 Jan 2021 12:31:55 +0000 (12:31 +0000)]
[DebugInfo][dexter] Tweak dexter test for merged values
Tweak dexter-tests/memvars/inline-escaping-function.c added in D94761
(
b7e516202eb6) by adding a 'param' use after the merge point. The test XFAILS
with and without this change, but without it the test looks very similar to
memvars/unused-merged-value.c. The test now demonstrates the problem more
clearly.
Faris Rehman [Mon, 4 Jan 2021 16:49:33 +0000 (16:49 +0000)]
[flang][driver] Add support for fixed form detection
Currently the new flang driver always runs in free form mode. This patch
adds support for fixed form mode detection based on the file extensions.
Like `f18`, `flang-new` will treat files ending with ".f", ".F" and
".ff" as fixed form. Additionally, ".for", ".FOR", ".fpp" and ".FPP"
file extensions are recognised as fixed form files. This is consistent
with gfortran [1]. In summary, files with the following extensions are
treated as fixed-form:
* ".f", ".F", ".ff", ".for", ".FOR", ".fpp", ".FPP"
For consistency with flang/test/lit.cfg.py and f18, this patch also adds
support for the following file extensions:
* ".ff", ".FOR", ".for", ".ff90", ".fpp", ".FPP"
This is added in flang/lib/Frontend/FrontendOptions.cpp. Additionally,
the following extensions are included:
* ".f03", ".F03", ".f08", ".F08"
This is for compatibility with gfortran [1] and other popular Fortran
compilers [2].
NOTE: internally Flang will only differentiate between fixed and free
form files. Currently Flang does not support switching between language
standards, so in this regard file extensions are irrelevant. More
specifically, both `file.f03` and `file.f18` are represented with
`Language::Fortran` (as opposed to e.g. `Language::Fortran03`).
Summary of changes:
- Set Fortran::parser::Options::sFixedForm according to the file type
- Add isFixedFormSuffix and isFreeFormSuffix helper functions to
FrontendTool/Utils.h
- Change FrontendOptions::GetInputKindForExtension to support the missing
file extensions that f18 supports and some additional ones
- FrontendActionTest.cpp is updated to make sure that the test input is
treated as free-form
[1] https://gcc.gnu.org/onlinedocs/gfortran/GNU-Fortran-and-GCC.html
[2] https://github.com/llvm/llvm-project/blob/master/flang/docs/OptionComparison.md#notes
Differential Revision: https://reviews.llvm.org/D94228
Adam Czachorowski [Mon, 18 Jan 2021 22:16:05 +0000 (23:16 +0100)]
[clang] Check for nullptr when instantiating late attrs
This was already done in SemaTemplateInstantiateDecl.cpp, but not in
SemaTemplateInstantiate.cpp.
Anecdotally I've seen some clangd crashes where coredumps point to this
being a problem, but I cannot reproduce this so far.
Differential Revision: https://reviews.llvm.org/D94933
Alex Zinenko [Tue, 19 Jan 2021 12:42:16 +0000 (13:42 +0100)]
[mlir] Clarify docs around LLVM dialect-compatible types
Explicitly mention that there is exactly one MLIR type that corresponds
to a given LLVM IR type.
Abhina Sreeskantharajan [Tue, 19 Jan 2021 12:25:21 +0000 (07:25 -0500)]
[SystemZ][z/OS] Fix No such file or directory expression error
On z/OS, the following error message is not matched correctly in lit tests. This patch updates the CHECK expression to match the end period successfully.
```
EDC5129I No such file or directory.
```
Differential Revision: https://reviews.llvm.org/D94239
Caroline Concatto [Mon, 21 Dec 2020 15:04:29 +0000 (15:04 +0000)]
[AArch64][SVE]Add cost model for vector reduce for scalable vector
This patch computes the cost for vector.reduce<operand> for scalable vectors.
The cost is split into two parts: the legalization cost and the horizontal
reduction.
Differential Revision: https://reviews.llvm.org/D93639
OCHyams [Tue, 19 Jan 2021 11:04:25 +0000 (11:04 +0000)]
[DebugInfo][dexter] Add dexter tests for merged values
These dexter tests illustrate PR48719, the summary of which is:
Sometimes we insert dbg.values for merged values (PHIs) when promoting
variables, sometimes we don't. Sometimes there is no PHI because the merged
value is never used. It doesn't matter because LiveDebugValues understands these
merged values (implicit or otherwise) and correctly updates the debug
info. Importantly, these merged variable values (which may or may not exist as
PHIs, and may or not be represented with dbg.values) are //always// implicitly
defined by the combination of incoming edges and the incoming variable locations
along those edges by virtue of LiveDebugValues existing. Unfortunately, it is
possible to mess with the CFG and remove / move these edges before
LiveDebugValues runs. In this case our debug info model only works when the
merged value is tracked by a dbg.value. Currently, this is only done rigorously
for variables which are A) promoted in the first round of mem2reg and B) are
used after the merge point.
As an example, compile the following source with -O3 -g and step through with a
debugger. You will see parama=5 throughout the function fun which is incorrect -
we expect to see param=20 after the conditional assignment.
__attribute__((optnone))
void esc(int* p) {}
__attribute__((optnone))
void fluff() {}
__attribute__((noinline))
int fun(int parama, int paramb) {
if (parama)
parama = paramb;
fluff(); // DexLabel('s0')
esc(¶ma);
return 0;
}
int main() {
return fun(5, 20);
}
1. parama is escaped by esc(¶ma) so it is not promoted by
SROA/mem2reg (failing condition "A" above).
2. InstCombine's LowerDbgDeclare converts the dbg.declare to a set of
dbg.values (tracking the stored SSA values).
3. InstCombine replaces the two stores to parama's alloca (the initial
parameter register store in entry and the assignment in if.then) with a
PHI+store in the common sucessor.
4. SimplifyCFG folds the blocks together and converts the PHI to a
select.
The debug info is not updated to account for the merged value in the successor
prior to SimplifyCFG when it exists as a PHI, or during when it becomes a
select.
As with D89543, which added some dexter tests for escaped locals, the idea is
to build a set of source-level tests which highlights existing issues and
might be useful in evaluating a new debug info model.
Reviewed By: rnk
Differential Revision: https://reviews.llvm.org/D94761
Faris Rehman [Tue, 19 Jan 2021 10:01:38 +0000 (10:01 +0000)]
[flang][driver] Add support for `-I` in the new driver
Add support for option -I in the new Flang driver. This will allow for
included headers and module files in other directories, as the default
search path is currently the working folder. The behaviour of this is
consistent with the current f18 driver, where the current folder (i.e.
".") has the highest priority followed by the order of '-I's taking
priority from first to last.
Summary of changes:
- Add SearchDirectoriesFromDashI to PreprocessorOptions, to be forwarded
into the parser's searchDirectories
- Add header files and non-functional module files to be used in
regression tests. The module files are just text files and are used to
demonstrated that paths specified with `-I` are taken into account when
searching for .mod files.
Differential Revision: https://reviews.llvm.org/D93453
Alexander Belyaev [Tue, 19 Jan 2021 11:03:13 +0000 (12:03 +0100)]
[mlir] Add `complex.abs`, `complex.div` and `complex.mul` to ComplexOps.
Differential Revision: https://reviews.llvm.org/D94911
Simon Pilgrim [Tue, 19 Jan 2021 11:03:45 +0000 (11:03 +0000)]
[X86][SSE] combineVectorSignBitsTruncation - fold trunc(srl(x,c)) -> packss(sra(x,c))
If a srl doesn't introduce any sign bits into the truncated result, then replace with a sra to let us use a PACKSS truncation - fixes a regression noticed in D56387 on pre-SSE41 targets that don't have PACKUSDW.
Hans Wennborg [Tue, 19 Jan 2021 10:37:50 +0000 (11:37 +0100)]
Revert
5238e7b302 "[InstCombine] Replace one-use select operand based on condition"
This caused a miscompile in Chromium, see comments on the codereview for
discussion and pointer to a reproducer.
> InstCombine already performs a fold where X == Y ? f(X) : Z is
> transformed to X == Y ? f(Y) : Z if f(Y) simplifies. However,
> if f(X) only has one use, then we can always directly replace the
> use inside the instruction. To actually be profitable, limit it to
> the case where Y is a non-expr constant.
>
> This could be further extended to replace uses further up a one-use
> instruction chain, but for now this only looks one level up.
>
> Among other things, this also subsumes D94860.
>
> Differential Revision: https://reviews.llvm.org/D94862
This also reverts the follow-up
a003f26539cf4db744655e76c41f4c4a8913f116:
> [llvm] Prevent infinite loop in InstCombine of select statements
>
> This fixes an issue where the RHS and LHS the comparison operation
> creating the predicate were swapped back and forth forever.
>
> Differential Revision: https://reviews.llvm.org/D94934