Commit Graph

486 Commits

Author SHA1 Message Date
Krzysztof Parzyszek 145740999d Preserve existing regs when adding pristines to LivePhysRegs/LiveRegUnits
Differential Revision: https://reviews.llvm.org/D37600


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@312797 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-08 16:29:50 +00:00
Matthias Braun 109c6e02f7 Insert IMPLICIT_DEFS for undef uses in tail merging
Tail merging can convert an undef use into a normal one when creating a
common tail. Doing so can make the register live out from a block which
previously contained the undef use. To keep the liveness up-to-date,
insert IMPLICIT_DEFs in such blocks when necessary.

To enable this patch the computeLiveIns() function which used to
compute live-ins for a block and set them immediately is split into new
functions:
- computeLiveIns() just computes the live-ins in a LivePhysRegs set.
- addLiveIns() applies the live-ins to a block live-in list.
- computeAndAddLiveIns() is a convenience function combining the other
  two functions and behaving like computeLiveIns() before this patch.

Based on a patch by Krzysztof Parzyszek <kparzysz@codeaurora.org>

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@312668 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-06 20:45:24 +00:00
Krzysztof Parzyszek 7e5553d4f2 [IfConversion] Remove kill flags from common instructions as well
When if-converting a diamond, two separate blocks will be placed back
to back to form a straight line code. To ensure correctness of the
liveness information, any registers that are live in the second block
should not be killed in the first block, even if they were in the
original code.
Additionally, when the two blocks share common instructions at the
beginning, these instructions will not be duplicated, but only placed
once, before both of the blocks. Since the function "isIdenticalTo"
(as used here) ignores kill flags, the common initial code in one
block may have a kill flag for a register that is live in the other
block.
Because the code that removes kill flags only runs for the non-common
parts of the predicated blocks, a kill flag mismatch in the common
code could still lead to a live register being killed prematurely.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@312654 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-06 17:57:13 +00:00
Krzysztof Parzyszek 0c3d5af968 [Hexagon] Add option to generate calls to "abort" for "unreachable"
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@312644 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-06 16:22:55 +00:00
Krzysztof Parzyszek a0dd08a806 [Hexagon] Check for potential bank conflicts in post-RA scheduling
Insert artificial edges between loads that could cause a cache bank
conflict.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@311901 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-28 18:36:21 +00:00
Krzysztof Parzyszek 3dfcd099f5 [Hexagon] Generate correct runtime check when recognizing memmove
The check (assuming positive stride) for validity of memmove should be
(a) the destination is at a lower address than the source, or
(b) the distance between the source and destination is greater than or
    equal the number of bytes copied.

For the second part it is sufficient to assume that the destination
is at a higher address, since the opposite case is covered by (a).
The distance calculation was previously done by subtracting the
pointers in the wrong order.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@311650 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-24 11:59:53 +00:00
Krzysztof Parzyszek 5c985bdbe2 [Hexagon] Ignore DBG_VALUEs when counting instructions in hexagon-early-if
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@310524 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-09 21:22:05 +00:00
Jonas Paulsson b7123745ed [LSR / TTI / SystemZ] Eliminate TargetTransformInfo::isFoldableMemAccess()
isLegalAddressingMode() has recently gained the extra optional Instruction*
parameter, and therefore it can now do the job that previously only
isFoldableMemAccess() could do.

The SystemZ implementation of isLegalAddressingMode() has gained the
functionality of checking for offsets, which used to be done with
isFoldableMemAccess().

The isFoldableMemAccess() hook has been removed everywhere.

Review: Quentin Colombet, Ulrich Weigand
https://reviews.llvm.org/D35933

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@310463 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-09 11:28:01 +00:00
Krzysztof Parzyszek c6a42e96ed [Hexagon] Convert HVX vector constants of i1 to i8
Certain operations require vector of i1 values. However, for Hexagon
architecture compatibility, they need to be represented as vector of i8.

Patch by Suyog Sarda.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@309677 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-01 13:12:53 +00:00
Krzysztof Parzyszek 1aa3f8dfbc [Hexagon] Recognize C4_cmpneqi, C4_cmpltei and C4_cmplteui in NewValueJump
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@308914 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-24 19:35:48 +00:00
Krzysztof Parzyszek bcf10065bb [Hexagon] Add inline-asm constraint 'a' for modifier register class
For example
  asm ("memw(%0++%1) = %2" : : "r"(addr),"a"(mod),"r"(val) : "memory")


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@308761 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-21 17:51:27 +00:00
Krzysztof Parzyszek b8ae3835b5 [Hexagon] Fix a bug in r308502: post-inc offset is always 0
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@308510 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-19 19:17:32 +00:00
Sumanth Gundapaneni 993d5f2bc8 [Hexagon] Emit lookup tables in text section based on a flag
The flag "-hexagon-emit-lut-text" (defaulted to false) is added to decide
on where to keep the switch generated lookup table.
Differential Revision: https://reviews.llvm.org/D34818


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@308316 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-18 15:31:37 +00:00
Mandeep Singh Grang 02972a4b38 [llvm] Remove redundant check-prefix=CHECK from tests. NFC.
Reviewers: t.p.northover, oren_ben_simhon, niravd, mcrosier

Reviewed By: oren_ben_simhon, mcrosier

Subscribers: nhaehnle, javed.absar, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@308193 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-17 17:32:45 +00:00
Krzysztof Parzyszek 7a0ca1142c [Hexagon] Remove custom lowering of loads of v4i16
The target-independent lowering works fine, except concatenating 32-bit
words. Add a pattern to generate A2_combinew instead of 64-bit asl/or.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@308186 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-17 15:45:45 +00:00
Krzysztof Parzyszek 9d612bd4f5 [Hexagon] Add intrinsics for data cache operations
This is the LLVM part, adding definitions for
  void @llvm.hexagon.Y2.dccleana(i8*)
  void @llvm.hexagon.Y2.dccleaninva(i8*)
  void @llvm.hexagon.Y2.dcinva(i8*)
  void @llvm.hexagon.Y2.dczeroa(i8*)
  void @llvm.hexagon.Y4.l2fetch(i8*, i32)
  void @llvm.hexagon.Y5.l2fetch(i8*, i64)
The clang part will follow.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@308032 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-14 15:58:48 +00:00
Krzysztof Parzyszek c3676c8ea9 [Hexagon] Do not rely on callee-saved info in hasFP
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307675 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-11 17:11:54 +00:00
Krzysztof Parzyszek 609a5df225 [Hexagon] Add support for nontemporal loads and stores on HVX
Patch by Michael Wu.

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307671 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-11 16:39:33 +00:00
Krzysztof Parzyszek 33287d8a69 [Hexagon] Fix check for HMOTF_ConstExtend operand flag
This fixes https://llvm.org/PR33718.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307566 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-10 18:38:52 +00:00
Nirav Dave bef33d7af3 [Hexagon] Preclude non-memory test from being optimized away. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307153 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-05 13:08:03 +00:00
Krzysztof Parzyszek 515de5651c [Hexagon] Implement frame pointer elimination with -fomit-frame-pointer
It applies to leaf functions that are otherwise not required to have
a frame pointer.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@306888 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-30 21:21:40 +00:00
Sumanth Gundapaneni 7005a5a047 [Hexagon] Emit jump tables in text section based on a flag
This patch adds a new LLVM flag -hexagon-emit-jt-text which is defaulted to 
"false". The value "true" emits the switch generated jump tables in text section.
Differential Revision: https://reviews.llvm.org/D34820


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@306872 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-30 20:21:48 +00:00
Sumanth Gundapaneni 409c609253 Revert "[Hexagon] Guard the generation of lookup table"
This reverts commit ae521f4192.
Wrong commit message



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@306871 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-30 20:20:00 +00:00
Sumanth Gundapaneni ae521f4192 [Hexagon] Guard the generation of lookup table
The llvm flag "-hexagon-emit-lookup-tables" guards the generation
of lookup table from a switch statement.

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@306869 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-30 20:10:28 +00:00
Krzysztof Parzyszek aeca92c575 [Hexagon] Keep all phi nodes when building DFG in addr-mode-opt
The dead phis are needed for finding correct would-be reaching defs
in register propagation.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@306690 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-29 15:55:59 +00:00
Krzysztof Parzyszek d37294a1a2 Missed a check for UndefVI in r306466
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@306553 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-28 15:46:16 +00:00
Krzysztof Parzyszek a432d58a0f Create a PHI value when merging with a known undef live-in
Differential Revision: https://reviews.llvm.org/D34640


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@306466 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-27 21:30:46 +00:00
Krzysztof Parzyszek f4a2d1d749 [Hexagon] Use proper predicate register state when expanding PS_vselect
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@306458 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-27 19:59:46 +00:00
Krzysztof Parzyszek ecf693d535 [Hexagon] Update kills in hexagon-nvj even more properly than before
Account for the fact that both, the feeder and the compare can be moved
over instructions that kill registers.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@306443 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-27 18:37:16 +00:00
Krzysztof Parzyszek ca59b915b5 [Hexagon] Handle cases when the aligned stack pointer is missing
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@306288 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-26 14:17:58 +00:00
Krzysztof Parzyszek 0804de030c Revert "[Hexagon] Handle decreasing of stack alignment in frame lowering"
This breaks passing of aligned function arguments.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@306145 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-23 19:47:04 +00:00
Krzysztof Parzyszek 1e5c31d7ad [Hexagon] Handle decreasing of stack alignment in frame lowering
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@306124 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-23 16:53:59 +00:00
Krzysztof Parzyszek b03a7e10d5 [Hexagon] Properly update kill flags in HexagonNewValueJump
The feeder instruction will be moved to right before the compare, so
the updating code should not be looking for kills past the compare.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@306059 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-22 21:11:44 +00:00
Krzysztof Parzyszek cc350332fc [Hexagon] Use LivePhysRegs to fix up kills in HexagonGenMux
Remove the previous, manual shuffling of the kill flags. 


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@306054 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-22 20:43:02 +00:00
Krzysztof Parzyszek 5715184cc4 [Hexagon] Fix typo in a testcase
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@306030 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-22 16:25:46 +00:00
Krzysztof Parzyszek 52e734792d [Hexagon] Handle a global operand to A2_addi when creating duplexes
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@306012 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-22 15:53:31 +00:00
Krzysztof Parzyszek 7e5eff00e0 [Hexagon] Recognize potential offset overflow for store-imm to stack
Reserve an extra scavenging stack slot if the offset field in store-
-immediate instructions may overflow.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@306004 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-22 14:11:23 +00:00
Krzysztof Parzyszek 0773a82c47 [Hexagon] Handle more types of immediate operands in expand-condsets
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@305943 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-21 19:21:30 +00:00
Krzysztof Parzyszek c86dcc6411 [Hexagon] Don't kill live registers when creating mux out of tfr
The second part of r305300: when placing the mux at the later location,
make sure that it won't use any register that was killed between the
two original instructions. Remove any such kills and transfer them to
the mux.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@305553 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-16 12:24:03 +00:00
Krzysztof Parzyszek 329af08382 [Hexagon] Generate store-immediate instructions for stack objects
Store-immediate instructions have a non-extendable offset. Since the
actual offset for a stack object is not known until much later, only
generate these stores when the stack size (at the time of instruction
selection) is small.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@305305 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-13 17:10:16 +00:00
Krzysztof Parzyszek 7cc2615d1b [Hexagon] Generate multiply-high instruction in isel
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@305302 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-13 16:21:57 +00:00
Krzysztof Parzyszek f65ef609fe [Hexagon] Don't kill live registers when creating mux out of tfr
When a mux instruction is created from a pair of complementary conditional
transfers, it can be placed at the location of either the earlier or the
later of the transfers. Since it will use the operands of the original
transfers, putting it in the earlier location may hoist a kill of a source
register that was originally further down. Make sure the kill flag is
removed if the register is still used afterwards.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@305300 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-13 16:07:36 +00:00
Krzysztof Parzyszek 2ba2a31ad4 [Hexagon] Stop pmpy recognition when shift conversion fails
The conversion of shifts from right shifts to left shifts may fail.
In such case, the pmpy recognition cannot proceed.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@305289 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-13 13:51:49 +00:00
Krzysztof Parzyszek 4a3c57b63a [Hexagon] Skip mux generation when predicate register is undefined
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@305014 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-08 20:56:36 +00:00
Krzysztof Parzyszek e38350cec4 [Hexagon] Generate 'inbounds' GEPs in HexagonCommonGEP
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@304937 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-07 20:04:33 +00:00
Krzysztof Parzyszek c4071bcc5b [Hexagon] Return 0 from getDotNewPredOp when .new opcode does not exist
This allows using this function to test if an instruction can be converted
to a .new form.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@304549 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-02 14:07:06 +00:00
Krzysztof Parzyszek 7dc680c89a [Hexagon] Fix dependence check in the packetizer
An incorrect check in the packetizer lead to an attempt to convert
an unconditional branch to a .new (conditional) form.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@304442 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-01 18:02:40 +00:00
Krzysztof Parzyszek 2a5fa5ca14 [Hexagon] Handle long-running simplification loop in idiom recognition
The initial assumption was that the simplification would converge to a
fixed point relatvely quickly. Turns out that there are legitimate situa-
tions where the complexity of the code causes it to take a large number
of iterations.

Two main changes:
- Instead of aborting upon hitting the limit, simply return nullptr.
- Reduce the limit to 10,000 from 100,000.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@304441 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-01 18:00:47 +00:00
Krzysztof Parzyszek 79654737d7 [Hexagon] Improve code generation for 32x32-bit multiplication
For multiplications of 64-bit values (giving 64-bit result), detect
cases where the arguments are sign-extended 32-bit values, on a per-
operand basis. This will allow few patterns to match a wider variety
of combinations in which extensions can occur.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@304223 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-30 17:47:51 +00:00
Matthias Braun 0248ff99fa ScheduleDAGInstrs: Fix fixupKills()
Rewrite fixupKills() to use the LivePhysRegs class. Simplifies the code
and fixes a bug where the CSR registers in return blocks where missed
leading to invalid kill flags. Also remove the unnecessary rule that we
wouldn't set kill flags on tied operands.

No tests as I have an upcoming commit improving MachineVerifier checks
to catch these cases in multiple existing lit tests.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@304055 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-27 02:50:50 +00:00