Commit Graph

67 Commits

Author SHA1 Message Date
Kazu Hirata 20cde15415 [Target] Use std::nullopt instead of None (NFC)
This patch mechanically replaces None with std::nullopt where the
compiler would warn if None were deprecated.  The intent is to reduce
the amount of manual work required in migrating from Optional to
std::optional.

This is part of an effort to migrate from llvm::Optional to
std::optional:

https://discourse.llvm.org/t/deprecating-llvm-optional-x-hasvalue-getvalue-getvalueor/63716
2022-12-02 20:36:06 -08:00
Krzysztof Parzyszek 467432899b MemoryLocation: convert Optional to std::optional 2022-12-01 15:36:20 -08:00
Krzysztof Parzyszek 2191137dff [Hexagon] Check if vector is empty before calling back() 2022-12-01 11:41:47 -08:00
Krzysztof Parzyszek 9b83935672 [Hexagon] Punt on GEPs with different base types in vector alignment 2022-12-01 10:33:48 -08:00
Krzysztof Parzyszek f8cb97a0f1 [Hexagon] Fix deinterleaving after vmpyh 2022-11-23 13:31:54 -08:00
Krzysztof Parzyszek ae9356e8c4 [Hexagon] Fix order of operands in V6_vmpyhus
The unsigned operand is second: Vdd32.w = vmpy(Vu32.h,Vv32.uh)
2022-11-23 13:31:54 -08:00
Krzysztof Parzyszek e27e8e0541 [Hexagon] Use V6_vmpyuhvs for 16-bit mulhu on HVX v69+ 2022-11-22 11:31:22 -08:00
Krzysztof Parzyszek a03e16a16e [Hexagon] Improve idioms for fixed-point vector multiplication
Make the code more general, restore the ability to generate V6_vmpyhvsrs.
2022-11-12 08:46:27 -08:00
Krzysztof Parzyszek 017186294d [Hexagon] Place aligned loads closer to users
Vector alignment code was grouping all aligned loads together. In some
cases the groups could become quite large causing a lot of spill to be
generated. This will place the loads closer to where they are used,
reducing the register pressure.
2022-11-11 12:04:33 -08:00
Kazu Hirata 17503be455 [Hexagon] Remove HexagonVectorCombine::simplify
This patch fixes:

  llvm/lib/Target/Hexagon/HexagonVectorCombine.cpp:1554:6: warning:
  ‘llvm::Value*
  {anonymous}::HexagonVectorCombine::simplify(llvm::Value*) const’
  defined but not used [-Wunused-function]
2022-10-30 12:56:59 -07:00
Krzysztof Parzyszek 323fb627a5 [Hexagon] Report changes in HvxIdioms pass
It can produce some dead code, which is harmless in the end, but breaks
expensive checks when unreported. This should be fixed eventually, but
it's a low priority.
2022-10-29 11:32:28 -07:00
Krzysztof Parzyszek 9422a8d94c [Hexagon] Break up vectors into HVX-sized chunks in HvxIdioms
This will allow recognizing Q.31 multiplications on vectors that are
multiplies of HVX vectors. At the moment this comes at the expense of
Q.15 multiplications, which now are handled as 32-bit multiplications
with shifts.
In the longer term this will likely be replaced by a different scheme
of "legalizing" vectors, which is necessary for idiom recognition, at
least where using direct HVX instrinsics is desired.
2022-10-29 11:13:28 -07:00
Krzysztof Parzyszek c4a8f9abac [Hexagon] Fix vector concatenation 2022-10-29 10:46:24 -07:00
Krzysztof Parzyszek deb197ffa3 [Hexagon] Use helper function introduced in prior commit, NFC 2022-10-22 15:05:38 -07:00
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