Commit Graph

53 Commits

Author SHA1 Message Date
Krzysztof Parzyszek e5d9ab08c3 [Hexagon] Fix insertion point for pointer difference calculation
HVC::calculatePointerDifference inserts temporary instructions for
simplification, and calulation of known bits. These instructions were
inserted at the end of a basic block (after the terminator), which
caused BB->getTerminator() to return nullptr. This, in turn, caused
a crash when a PHI instruction was examined in computeKnownBits.
2022-10-19 14:23:39 -07:00
Krzysztof Parzyszek fb063ea2ea [Hexagon] Clean up leftover instructions in HvxIdioms
Quick and dirty fix, because this is causing one builder to fail.
2022-10-14 16:45:03 -07:00
Krzysztof Parzyszek 6cb2a02a38 [Hexagon] Report if changes were made in HvxIdioms pass
This should fix
```
Pass modifies its input and doesn't report it: Hexagon Vector Combine
Pass modifies its input and doesn't report it UNREACHABLE executed at
[...hecks-debian/llvm-project/llvm/lib/IR/LegacyPassManager.cpp:1436!
```
2022-10-14 15:46:33 -07:00
Krzysztof Parzyszek 361a27c155 [Hexagon] Recognize idioms for fixed-point vector multiplication
Recognize Q.15*Q.15 and Q.31*Q.31, with and without rounding.
2022-10-14 15:22:25 -07:00
Krzysztof Parzyszek e8375e3042 [Hexagon] Use IRBuilderBase in function parameters
This will allow using builders with different folders.
2022-10-14 12:10:59 -07:00
Krzysztof Parzyszek cb6804104f [Hexagon] Remove unused function, NFC 2022-10-11 08:05:22 -07:00
Krzysztof Parzyszek 09d84e0ad8 [Hexagon] Implement helper to get intrinsic for instruction opcode
There are intrinsics for most scalar instructions and almost all HVX
instructions. What's somewhat painful is that there are two intrinsics
for each HVX instruction: one for 64- and one for 128-byte mode.
Instead of checking the current codegen settings every time, this
function would simply return the right intrinsic.
2022-10-07 15:56:06 -07:00
Krzysztof Parzyszek d184045d36 [Hexagon] Formatting changes, NFC 2022-10-07 09:13:51 -07:00
Krzysztof Parzyszek e492cdc358 [Hexagon] Add couple of helper functions in HexagonVectorCombine
1. `length(value/type)`: return the number of elements in the vector
   input,
2. `getHvxTy(elem_type)`: return the HVX vector type with the element
   type provided.

These will help write things more succintly.
2022-10-07 09:10:08 -07:00
Krzysztof Parzyszek 06019b8e55 [Hexagon] Add default parameter to HexagonVectorCombine::getIntTy, NFC 2022-10-07 08:52:19 -07:00
Krzysztof Parzyszek 2216d8f6b8 [Hexagon] Replace llvm::Optional with std::optional, NFC 2022-10-07 08:23:39 -07:00
Krzysztof Parzyszek 473210ae90 [Hexagon] Constify member refererence, NFC 2022-10-07 08:23:39 -07:00
Simon Pilgrim 759bedade5 Fix MSVC "not all control paths return a value" warning. NFCI. 2022-09-28 10:56:37 +01:00
Krzysztof Parzyszek 7da2b91887 [Hexagon] Unify getSizeOfs in HexagonVectorCombine, NFC 2022-09-27 10:51:52 -07:00
Krzysztof Parzyszek 9c9e877b7e [Hexagon] Move function to a different class, NFC
"Sector" is a concept from AlignVectors, so the check for it
should be there.
2022-09-27 10:32:52 -07:00
Krzysztof Parzyszek 252cea037b [Hexagon] Add defaulted operator= to classes with defaulted copy ctor
This avoids deprecation warning:
```
warning: definition of implicit copy assignment operator for 'AddrInfo'
is deprecated because it has a user-declared copy constructor
[-Wdeprecated-copy]
```

This fixes https://github.com/llvm/llvm-project/issues/57229
2022-08-18 14:00:41 -07:00
Kazu Hirata 068d5066b3 [Hexagon] Remove unused declaration getByteVectorTy (NFC)
The declaration was introduced without a corresponding definition on
Sep 7, 2020 in commit f5d07a05bb.
2022-07-23 19:40:44 -07:00
Simon Moll b8c2781ff6 [NFC] format InstructionSimplify & lowerCaseFunctionNames
Clang-format InstructionSimplify and convert all "FunctionName"s to
"functionName".  This patch does touch a lot of files but gets done with
the cleanup of InstructionSimplify in one commit.

This is the alternative to the less invasive clang-format only patch: D126783

Reviewed By: spatel, rengolin

Differential Revision: https://reviews.llvm.org/D126889
2022-06-09 16:10:08 +02:00
Philip Reames ee7324b898 Rename mayBeMemoryDependent to mayHaveNonDefUseDependency [nfc] 2022-03-21 10:01:40 -07:00
Nikita Popov aa97bc116d [NFC] Remove uses of PointerType::getElementType()
Instead use either Type::getPointerElementType() or
Type::getNonOpaquePointerElementType().

This is part of D117885, in preparation for deprecating the API.
2022-01-25 09:44:52 +01:00
Brendon Cahoon db5b791595 [Hexagon] Fix an instruction move in HexagonVectorCombine
The HexagonVectorCombine pass was moving an instruction
incorrectly, which caused a use in a GEP that was not yet
defined.

HexagonVectorCombine removes a load from a group due to its
dependences, but in realignGroup, the load is processed anyways.
In realignGroup, when determining the maximum alignment, only
those instructions still in the group should be considered.
2022-01-04 11:41:42 -08:00
Krzysztof Parzyszek e107374e40 [Hexagon] Explicitly use integer types when rescaling a mask 2021-12-30 10:14:00 -08:00
Kazu Hirata 26bd534a79 [llvm] Use none_of instead of \!any_of (NFC) 2021-12-17 13:48:57 -08:00
Zarko Todorovski dc9b5550b2 [NFC][llvm][Hexagon] Inclusive Terms remove uses of sanity in Hexagon taget
Most changes are rewording comments but there are some assertions that I rephrased.

Reviewed By: kparzysz

Differential Revision: https://reviews.llvm.org/D114132
2021-11-22 10:08:01 -05:00
Jay Foad a9bceb2b05 [APInt] Stop using soft-deprecated constructors and methods in llvm. NFC.
Stop using APInt constructors and methods that were soft-deprecated in
D109483. This fixes all the uses I found in llvm, except for the APInt
unit tests which should still test the deprecated methods.

Differential Revision: https://reviews.llvm.org/D110807
2021-10-04 08:57:44 +01:00
Brendon Cahoon 42dace9c5b [Hexagon] Use getTypeAllocSize to compute difference between objects
The code was using getTypeStoreSize to calculate the difference
between consecutive objects. The calculation was incorrect due
to padding that is added between consecutive objects. The
getTypeAllocSize includes the padding amount. For example,
if the type is [19 x i8], the difference between consecutive
objects is 32 bytes, not 19 bytes.

A second case for getTypeAllocSize is needed when computing
the pointer values for the vector accesses. The calculation needs
to account for the padding as well.

Differential Revision: https://reviews.llvm.org/D109403
2021-09-13 19:04:59 -05:00
Nikita Popov fabc17192e [IRBuilder] Add type argument to CreateMaskedLoad/Gather
Same as other CreateLoad-style APIs, these need an explicit type
argument to support opaque pointers.

Differential Revision: https://reviews.llvm.org/D105395
2021-07-04 12:17:59 +02:00
Krzysztof Parzyszek 81b42ca951 [Hexagon] Handle opaque pointers in vector combine 2021-07-02 13:07:40 -05:00
Arthur Eubanks 2983053d23 [NFC][OpaquePtr] Explicitly pass GEP source type to IRBuilder in more places 2021-06-01 13:13:37 -07:00
Arthur Eubanks 2c3afa3237 [OpaquePtr] Clean up some uses of Type::getPointerElementType()
These depend on pointee types.
2021-05-31 09:54:57 -07:00
Neal (nealsid) e89b60fcfc Update MSVC version number in preprocessor check
Passing template parameter packs to std::map doesn't work in VS 2017/2019, so this updates the preprocessor version check to use an alternate version in VS2019, as well.

Reviewed By: DavidSpickett

Differential Revision: https://reviews.llvm.org/D102260
2021-05-18 10:04:39 +01:00
Simon Pilgrim ea64200b61 HexagonVectorCombine.cpp - don't negate a bool value. NFCI.
Silences MSVC warning.
2021-05-10 10:50:37 +01:00
Krzysztof Parzyszek 561026936b [Hexagon] Propagate metadata in Hexagon Vector Combine 2021-05-08 14:35:55 -05:00
Krzysztof Parzyszek 899352c7b4 [Hexagon] Skip function in Hexagon vector combine if requested
Add a call to skipFunction().
2021-04-28 09:24:08 -05:00
Coplin, Jared f3451162e8 [Hexagon] Unmasked and masked load pair to dame bae -? one load and selects 2021-04-22 10:15:46 -05:00
Krzysztof Parzyszek e8d0475472 Revert "[Hexagon] Masked and unmasked load to same base -> load and two selects"
This reverts commit 96dc8d7e7d.

It breaks a few builds.
2021-04-22 09:06:18 -05:00
Coplin, Jared 96dc8d7e7d [Hexagon] Masked and unmasked load to same base -> load and two selects 2021-04-22 08:44:01 -05:00
Brendon Cahoon 57443bfb4a [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.
2021-01-19 12:49:39 -06:00
Krzysztof Parzyszek 46975b5b29 [Hexagon] Wrap functions only used in asserts in ifndef NDEBUG 2021-01-06 09:40:38 -06:00
Krzysztof Parzyszek ee11bf316f [Hexagon] Silence unused function warning with gcc10, NFC 2021-01-05 14:11:45 -06:00
Kazu Hirata 985f899bf2 [Target] Use llvm::append_range (NFC) 2021-01-03 09:57:43 -08:00
Juneyoung Lee 9b29610228 Use unary CreateShuffleVector if possible
As mentioned in D93793, there are quite a few places where unary `IRBuilder::CreateShuffleVector(X, Mask)` can be used
instead of `IRBuilder::CreateShuffleVector(X, Undef, Mask)`.
Let's update them.

Actually, it would have been more natural if the patches were made in this order:
(1) let them use unary CreateShuffleVector first
(2) update IRBuilder::CreateShuffleVector to use poison as a placeholder value (D93793)

The order is swapped, but in terms of correctness it is still fine.

Reviewed By: spatel

Differential Revision: https://reviews.llvm.org/D93923
2020-12-30 22:36:08 +09:00
Krzysztof Parzyszek fe0527e1c7 [Hexagon] Temporarily disable vector realignment for non-HVX vectors 2020-12-15 19:03:07 -06:00
Krzysztof Parzyszek 16385643bb [Hexagon] Emit enough stores when aligning vector addresses 2020-12-15 18:59:53 -06:00
Reid Kleckner 55fc64bce0 [Hexagon] Tweak _MSC_VER workaround version
My bot runs VS 2019, but it could not compile this code.

Message:
[55/2465] Building CXX object lib\Target\Hexagon\CMakeFiles\LLVMHexagonCodeGen.dir\HexagonVectorCombine.cpp.obj
FAILED: lib/Target/Hexagon/CMakeFiles/LLVMHexagonCodeGen.dir/HexagonVectorCombine.cpp.obj
...
C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Tools\MSVC\14.23.28105\include\map(71): error C2976: 'std::map': too few template arguments
C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Tools\MSVC\14.23.28105\include\map(71): note: see declaration of 'std::map'

The version in the path, 14.23, corresponds to _MSC_VER 1923, so raise
the version floor to 1924.

I have not tested with versions between 1924 and 1928 (latest), but the
latest works with the variadic version.
2020-12-14 11:26:36 -08:00
Krzysztof Parzyszek baf931a842 [Hexagon] Reconsider getMask fix, return original mask, convert later
The getPayload/getMask/getPassThrough functions should return values
that could be composed into a masked load/store without any additional
type casts. The previous fix violated that.
Instead, convert scalar mask to a vector right before rescaling.
2020-12-12 13:27:22 -06:00
Krzysztof Parzyszek 2cf5310471 [Hexagon] Create vector masks for scalar loads/stores
AlignVectors treats all loaded/stored values as vectors of bytes,
and masks as corresponding vectors of booleans, so make getMask
produce a 1-element vector for scalars from the start.
2020-12-12 11:12:17 -06:00
Krzysztof Parzyszek 2d8cc5479b [Hexagon] Workaround for compilation error with VS2017 2020-12-11 15:11:44 -06:00
Krzysztof Parzyszek 7c9afe9183 [Hexagon] Fix gcc6 compilation issue 2020-12-10 08:17:07 -06:00
Benjamin Kramer eeb713bbe2 [Hexagon] Fold single-use variables into assert. NFCI.
Silences unused variable warnings in Release builds.
2020-12-10 10:53:56 +01:00