251982 Commits

Author SHA1 Message Date
Craig Topper
86821b54eb [RISCV] Add copyright header to IntrinsicsRISCVXTHead.td and IntrinsicsRISCVXsf.td. NFC 2023-05-30 10:07:14 -07:00
David Green
5e98dbff72 [AArch64] Add i1 insert/extract cost tests. NFC
See D151189. The existing files check lines have also been adjusted whilst
here.
2023-05-30 17:45:16 +01:00
Simon Pilgrim
0ec79f413e [X86] Regenerate sqrt-fastmath-mir.ll 2023-05-30 17:21:53 +01:00
Igor Kirillov
40a81d3100 [CodeGen] Refactor IR generation functions to use IRBuilder in ComplexDeinterleaving pass
This patch updates several functions in LLVM's IR generation code to accept
an IRBuilder object as an argument, rather than an Instruction that indicates
the insertion point for new instructions.
This change is necessary to handle sophisticated -Ofast optimization cases
from D148558 where it's unclear which instructions should be used as the
insertion point for new operations.

Differential Revision: https://reviews.llvm.org/D148703
2023-05-30 16:18:28 +00:00
Florian Hahn
8098f2577e
[LV] Use Legal::isUniform to detect uniform pointers.
Update collectLoopUniforms to identify uniform pointers using
Legal::isUniform. This is more powerful and  brings pointer
classification here in sync with setCostBasedWideningDecision
which uses isUniformMemOp. The existing mis-match in reasoning
can causes crashes due to D134460, which is fixed by this patch.

Fixes https://github.com/llvm/llvm-project/issues/60831.

Reviewed By: Ayal

Differential Revision: https://reviews.llvm.org/D150991
2023-05-30 16:42:55 +01:00
Florian Hahn
1a28b9bce7
[VPlan] Handle invariant GEPs in isUniformAfterVectorization.
This fixes a crash caused by legal treating a scalable GEP as invariant,
but isUniformAfterVectorization does not handle GEPs.

Partially fixes https://github.com/llvm/llvm-project/issues/60831.

Reviewed By: Ayal

Differential Revision: https://reviews.llvm.org/D144434
2023-05-30 15:53:26 +01:00
Philip Reames
544a240ff7 [RISCV] Use v(f)slide1up for shuffle+insert idiom
This is pretty straight forward in the basic form. I did need to move the slideup matching earlier, but that looks generally profitable on it's own.

As follow ups, I plan to explore the v(f)slide1down variants, and see what I can do to canonicalize the shuffle then insert pattern (see _inverse tests at the end of the vslide1up.ll test).

Differential Revision: https://reviews.llvm.org/D151468
2023-05-30 07:37:41 -07:00
Michael Maitland
d70573b18e [RISCV][NFC] Make Reduction scheduler resources SEW aware
Create SchedWrites, WriteRes for reduction instructions that
are SEW specific. Future patches can use these resources
to customize the behavior of these resources depending on SEW.

Differential Revision: https://reviews.llvm.org/D151470
2023-05-30 07:27:25 -07:00
Nikita Popov
8378f1f4cd [InstCombine] Remove adjustMinMax() fold (PR62088)
This fold is buggy if the constant adjustment overflows.
Additionally, since we now canonicalize to min/max intrinsics,
the constants picked here don't actually matter, as long as SPF
still recognizes the pattern.

Fixes https://github.com/llvm/llvm-project/issues/62088.
2023-05-30 16:06:38 +02:00
Simon Pilgrim
9d6f2b1907 [X86] Fix SunnyCove ROB/MicroOpBufferSize
As raised on Issue #62602 - the IceLake scheduler model is still mainly a copy of the SkylakeServer model. This initial commit just fixes the ROB/MicroOpBufferSize to match the size reported on WikiChip/Agner, further fixes to follow in later commits.
2023-05-30 15:01:30 +01:00
LLVM GN Syncbot
c8319cf958 [gn build] Port 96a14f388b1a 2023-05-30 12:49:12 +00:00
Nikita Popov
96a14f388b Revert "[FuncSpec] Replace LoopInfo with BlockFrequencyInfo"
As reported on https://reviews.llvm.org/D150375#4367861 and
following, this change causes PDT invalidation issues. Revert
it and dependent commits.

This reverts commit 0524534d5220da5ecb2cd424a46520184d2be366.
This reverts commit ced90d1ff64a89a13479a37a3b17a411a3259f9f.
This reverts commit 9f992cc9350a7f7072a6dbf018ea07142ea7a7ed.
This reverts commit 1b1232047e83b69561fd64b9547cb0a0d374473a.
2023-05-30 14:49:03 +02:00
Simon Pilgrim
f81f32adc9 [X86] lowerBuildVectorAsBroadcast - remove repeated hasAVX() check. NFC.
We already early-out at the top of the function.
2023-05-30 13:21:28 +01:00
Simon Pilgrim
ab4b924832 [X86] X86FixupVectorConstantsPass - attempt to replace full width integer vector constant loads with broadcasts on AVX2+ targets
lowerBuildVectorAsBroadcast will not broadcast splat constants in all cases, resulting in a lot of situations where a full width vector load that has failed to fold but is loading splat constant values could use a broadcast load instruction just as cheaply, and save constant pool space.
2023-05-30 13:17:26 +01:00
Igor Kirillov
48339d0fbb [CodeGen] Add pre-commit tests for D148558
This patch adds four new tests for upcoming functionality in LLVM:
* complex-deinterleaving-add-mull-fixed-contract.ll
* complex-deinterleaving-add-mull-scalable-contract.ll
* complex-deinterleaving-add-mull-fixed-fast.ll
* complex-deinterleaving-add-mull-scalable-fast.ll.

These tests were generated from the IR of vectorizable loops, which were
compiled from C++ code using different optimization flags in Clang. Each pair
of tests corresponds to Neon and SVE architectures, respectively, and
each pair contains tests compiled with -Ofast and -O3 -ffp-contract=fast
-ffinite-math-only optimization flags.
The tests were stripped of nnan and ninf flags as they have no impact on the
output.
The primary objective of these tests is to show the various sequences of
complex computations that may be encountered and to demonstrate the ability
of ComplexDeinterleaving to support any ordering.

Depends on D147451

Differential Revision: https://reviews.llvm.org/D148550
2023-05-30 11:49:59 +00:00
Florian Hahn
b750862107
[LV] Use early exit for stores storing the ptr operand. (NFC)
Cleanup suggested in D150991.
2023-05-30 12:14:12 +01:00
Simon Pilgrim
95661b9c75 [X86] getTargetConstantBitsFromNode - support extracting fp data from ConstantDataSequential
Fixes issue introduced by 0f8e0f4228805cbecce13dcfadef4c48a4f0f4cd where SimplifyDemandedBits could crash when trying to extract fp data from broadcasted constants
2023-05-30 11:38:31 +01:00
Jie Fu
d0a4dcf52f [InstCombine] Remove unused function 'isMustTailCall' (NFC)
/data/llvm-project/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp:2467:13: error: unused function 'isMustTailCall' [-Werror,-Wunused-function]
static bool isMustTailCall(Value *V) {
            ^
1 error generated.
2023-05-30 18:30:44 +08:00
Nikita Popov
f1106ef6c9 [InstCombine] Remove computeKnownBits() fold for returns
We try to fold constant computeKnownBits() with context for return
instructions only. Otherwise, we rely on SimplifyDemandedBits() to
fold instructions with constant known bits.

The presence of this special fold for returns is dangerous, because
it makes our tests lie about what works and what doesn't. Tests are
usually written by returning the result we're interested in, but
will go through this separate code path that is not used for anything
else. This patch removes the special fold.

This primarily regresses patterns of the style "assume(x); return x".
The responsibility of handling such patterns lies with passes like
EarlyCSE/GVN anyway, which will do this reliably, and not just for
returns.

Differential Revision: https://reviews.llvm.org/D151099
2023-05-30 12:16:51 +02:00
Alex Bradbury
c4efcd6970 [RISCV] Generalise shouldExtendTypeInLibcall logic to apply to all <XLEN floats on soft ABIs
This results in improved codegen for half/bf16 libcalls on soft ABIs

Adds a RISCVSubtarget helper method for determining if a soft FP ABI is
being targeted (future bf16 related patches make use of this).

Differential Revision: https://reviews.llvm.org/D151434
2023-05-30 11:04:03 +01:00
Marco Elver
c551c9c311 [compiler-rt] Refactor memintrinsic interceptors
This moves memintrinsic interceptors (memcpy/memmove/memset) into a new
file sanitizer_common_interceptors_memintrinsics.inc.

This is in preparation of redefining builtins, however, we must be
careful to not redefine builtins in TUs that define interceptors of the
same name.

In all cases except for MSan, memintrinsic interceptors were moved to a
new TU $tool_interceptors_memintrinsics.cpp. In the case of MSan, it
turns out this is not yet necessary (as shown by the later patch
introducing memcpy tests).

NFC.

Reviewed By: vitalybuka

Differential Revision: https://reviews.llvm.org/D151552
2023-05-30 11:59:16 +02:00
Shao-Ce SUN
216e2820f9 [RISCV] Add more tests in zdinx-boundary-check.ll
Reviewed By: craig.topper

Differential Revision: https://reviews.llvm.org/D151534
2023-05-30 14:49:33 +08:00
Jianjian GUAN
944773436a [RISCV][NFC] Fix unmasked test for vp_cttz and vp_ctlz.
Reviewed By: craig.topper

Differential Revision: https://reviews.llvm.org/D151673
2023-05-30 12:38:24 +08:00
Phoebe Wang
8f386ff69a [ms-inline asm] Add error check for getAsInteger
.Imm can get lexed as a real, but a real doesn't equal to .Imm, e.g.,
2.5 or .123e+8. We should report error for it rather than silently ignore.

Reviewed By: skan

Differential Revision: https://reviews.llvm.org/D151652
2023-05-30 11:20:57 +08:00
Craig Topper
9239d3a3ea [RISCV] Teach performCombineVMergeAndVOps to handle instructions FMA instructions.
Previously we only handled instructions with merge ops that were
also masked. This patch supports instructions with merge ops that
aren't masked, like FMA.

I'm only folding into a TU vmerge for now. Supporting TA vmerge
shouldn't be much more work, but we need to make sure we get the
policy operand for the result correct. And of course we need more
tests.

Reviewed By: fakepaper56, frasercrmck

Differential Revision: https://reviews.llvm.org/D151596
2023-05-29 19:44:43 -07:00
Jianjian GUAN
071e9d7bac [RISCV] Fix unmasked vp_abs select.
Make unmasked vp_abs select to umasked instructions.

Reviewed By: fakepaper56

Differential Revision: https://reviews.llvm.org/D151646
2023-05-30 09:57:40 +08:00
Nico Weber
f55bac933f [gn] Port 9f6250f more
Follow-up to da54bd230a.
* Add dep to _cg and _sema targets only to CodeGen and Sema,
  like with the other Basic clang_tablegen()s
* Make tablegen_headers depend on arm_sme_draft_spec_subject_to_change
  so that the header gets installed
2023-05-29 20:24:25 -04:00
Alex Bradbury
9bb34ca652 [RISCV][test] Expand bfloat.ll tests to include i16 bitcasts and load/store
Pre-commit new tests used in D151663.
2023-05-29 21:38:26 +01:00
Florian Hahn
0332f2c551
[ConstraintElim] Add extra tests for and operand implying other op.
Extend test coverage for and conditions where the first operand implies
the second. The update includes the select form of AND and a few cases
where one of the AND operands gets simplified before solving.
2023-05-29 21:05:00 +01:00
Kazu Hirata
638112737e [Analysis] Remove unused function stripIntegerCast
The last use was removed by:

  commit d5b840131223f2ffef4e48ca769ad1eb7bb1869a
  Author: Philip Reames <preames@rivosinc.com>
  Date:   Thu May 11 08:10:49 2023 -0700
2023-05-29 12:19:14 -07:00
Kazu Hirata
dc61666042 [Analysis] Remove unused declarations visitEHBeginCatch and visitEHEndCatch
The corresponding function definitions were removed by:

  commit 14e773500e036de57ed0ca4af6fddc1f8b6767d8
  Author: Reid Kleckner <rnk@google.com>
  Date:   Fri Oct 9 23:34:53 2015 +0000
2023-05-29 12:19:13 -07:00
Kazu Hirata
5f2e98051d [Coroutines] Remove unused variable AsyncFuncTy
The last use was removed by:

  commit e760ec2a01fba0d90e2fea33cf99b75baa2c2a1c
  Author: Arnold Schwaighofer <aschwaighofer@apple.com>
  Date:   Thu Feb 11 08:25:31 2021 -0800
2023-05-29 11:56:54 -07:00
Kazu Hirata
e9f14d4945 [bugpoint] Remove unused declaration debugPassMiscompilation
The declaration seems to have been unused for at least 15 years.
2023-05-29 11:56:52 -07:00
Kazu Hirata
75c75215e3 [Vectorize] Remove unused declaration requiresTooManyRuntimeChecks
The corresponding function definition was removed by:

  commit 644a965c1efef68f22d9495e4cefbb599c214788
  Author: Florian Hahn <flo@fhahn.com>
  Date:   Mon Jul 4 15:10:48 2022 +0100
2023-05-29 11:56:50 -07:00
Zequan Wu
da54bd230a [gn build] (manually) port 9f6250f 2023-05-29 14:51:15 -04:00
Florian Hahn
fcc135a8d6
[LV] Remove dead CHECK lines after 280656eae95a9cbf.
Those check lines were left over after adding new run lines in
280656eae95a9cbf.
2023-05-29 19:23:52 +01:00
Kazu Hirata
23b9faddea [ExecutionEngine] Remove unused declaration recordRuntimeRegistrationFunctions
The declaration was added without a corresponding function definition
by:

  commit 217fd59cc5849f1afdbb8a74807a80b23f2da227
  Author: Lang Hames <lhames@gmail.com>
  Date:   Thu Jan 12 23:17:46 2023 -0800
2023-05-29 11:01:56 -07:00
Kazu Hirata
446efd29b6 [ExecutionEngine] Remove unused declaration defineNonExistent
The declaration was added without a corresponding function definition
by:

  commit cb84e4827e43921659e75509dfb42ebf56c50502
  Author: Lang Hames <lhames@gmail.com>
  Date:   Wed Mar 25 13:07:00 2020 -0700
2023-05-29 11:01:54 -07:00
Kazu Hirata
5f6c571b6f [DebugInfo] Remove unused declaration getFirstFunctionInfoAddress
The declaration was added without a corresponding function definition
by:

  commit d8e077e2caebc1415fb7af1714dd436adf99b6bf
  Author: Greg Clayton <gclayton@fb.com>
  Date:   Mon Mar 6 15:57:17 2023 -0800
2023-05-29 11:01:53 -07:00
Kazu Hirata
d035489297 [AArch64] Remove unused declaration tryParseMRSSystemRegister
The corresponding definition was removed by:

  commit e8b4166accfa03b9693bea34e53eb384f4b99198
  Author: Bradley Smith <bradley.smith@arm.com>
  Date:   Wed Apr 9 14:43:06 2014 +0000
2023-05-29 10:53:46 -07:00
Kazu Hirata
c65fd1cef9 [AArch64] Remove unused declaration legalizeShuffleVector
The declaration was added without a corresponding function definition
by:

  commit 4c52fb1a5ee20846627d16e38f5dec08c08f8884
  Author: Vladislav Dzhidzhoev <vdzhidzhoev@accesssoftek.com>
  Date:   Mon Aug 15 21:51:13 2022 +0300
2023-05-29 10:53:45 -07:00
Kazu Hirata
72c17a0d66 [AArch64] Remove unused declaration LowerSCALAR_TO_VECTOR
The corresponding function definition was removed by:

  commit 85d6a16c46616336c52792e7a490e70ea8b6461e
  Author: Tim Northover <tnorthover@apple.com>
  Date:   Fri Apr 4 09:03:09 2014 +0000
2023-05-29 10:53:43 -07:00
Alex Brachet
728a7de88a Revert "[llvm-debuginfod][NFC] Switch to OptTable"
This reverts commit 1610627d2b42c0daf8cc20649c50ddad222f001b.
2023-05-29 16:31:04 +00:00
Ivan Kosarev
a3a8cbffcf [AMDGPU][AsmParser][NFC] Refine parsing of NamedOperandU32 operands.
Eliminates the need for the custom code in parseCustomOperand().

Part of <https://github.com/llvm/llvm-project/issues/62629>.

Reviewed By: dp

Differential Revision: https://reviews.llvm.org/D150980
2023-05-29 17:01:44 +01:00
Justin Lebar
420cf6927c
[LSV] Return same bitwidth from getConstantOffset.
Previously, getConstantOffset could return an APInt with a different
bitwidth than the input pointers.  For example, we might be loading an
opaque 64-bit pointer, but stripAndAccumulateInBoundsConstantOffsets
might give a 32-bit offset.

This was OK in most cases because in gatherChains, we casted the APInt
back to the original ASPtrBits.

But it was not OK when considering selects.  We'd call getConstantOffset
twice and compare the resulting APInt's, which might not have the same
bit width.

This fixes that.  Now getConstantOffset always returns offsets with the
correct width, so we don't need the hack of casting it in gatherChains,
and it works correctly when we're handling selects.

Differential Revision: https://reviews.llvm.org/D151640
2023-05-29 08:43:47 -07:00
Simon Pilgrim
98061013e0 [X86] X86FixupVectorConstantsPass - attempt to replace full width fp vector constant loads with broadcasts on AVX+ targets
lowerBuildVectorAsBroadcast will not broadcast splat constants in all cases, resulting in a lot of situations where a full width vector load that has failed to fold but is loading splat constant values could use a broadcast load instruction just as cheaply, and save constant pool space.

NOTE: SSE3 targets can use MOVDDUP but not all SSE era CPUs can perform this as cheaply as a vector load, we will need to add scheduler model checks if we want to pursue this.
2023-05-29 16:10:52 +01:00
Florian Hahn
cd2fc73b49
Revert "[ValueTracking][InstCombine] Add a new API to allow to ignore poison generating flags or metadatas when implying poison"
This reverts commit 754f3ae65518331b7175d7a9b4a124523ebe6eac.

Unfortunately the change can cause regressions due to dropping flags
from instructions (like nuw,nsw,inbounds), prevent further optimizations
depending on those flags.

A simple example is the IR below, where `inbounds` is dropped with the
patch and the phase-ordering test added in 7c91d82ab912fae8b.

    define i1 @test(ptr %base, i64 noundef %len, ptr %p2) {
    bb:
      %gep = getelementptr inbounds i32, ptr %base, i64 %len
      %c.1 = icmp uge ptr %p2, %base
      %c.2 = icmp ult ptr %p2, %gep
      %select = select i1 %c.1, i1 %c.2, i1 false
      ret i1 %select
    }

For more discussion, see D149404.
2023-05-29 15:44:37 +01:00
Alex Bradbury
061e368fe2 [SelectionDAG] Implement soft FP legalisation for bf16 FP_EXTEND and BF16_TO_FP
As discussed in D151436, it's safe to do this as a simple shift (as is
done in LegalizeDAG.cpp) rather than needing a libcall. The added test
cases for RISC-V previously just triggered an assertion.

Codegen for bfloat_to_double will be slightly improved by D151434.

Differential Revision: https://reviews.llvm.org/D151563
2023-05-29 10:32:28 +01:00
Luo, Yuanke
752f9d02cc [NFC][TableGen] Remove dead code.
Differential Revision: https://reviews.llvm.org/D151635
2023-05-29 15:59:33 +08:00
khei4
0ad88c156e [MemCpyOpt] remove byval from memcpy size crtical test(NFC)
Differential Revision: https://reviews.llvm.org/D151626
Reviewed By: nikic
2023-05-29 16:56:07 +09:00