Commit Graph

369861 Commits

Author SHA1 Message Date
Victor Huang 7a74bb899a [PowerPC] Fix the Predicates for enabling pcrelative-memops and PLXVP/PSTXVP definitions
In this patch, Predicates fix added for the following:
* disable prefix-instrs will disable pcrelative-memops
* set two predicates PairedVectorMemops and PrefixInstrs for PLXVP/PSTXVP definitions

Differential Revision: https://reviews.llvm.org/D89727
Reviewed by: amyk, steven.zhang
2020-10-23 11:33:20 -05:00
LLVM GN Syncbot 24a1fe7547 [gn build] Port 00255f4192 2020-10-23 16:19:55 +00:00
vpykhtin 00255f4192 [AMDGPU] Fix access beyond the end of the basic block in execMayBeModifiedBeforeAnyUse.
I was wrong in thinking that MRI.use_instructions return unique instructions and mislead Jay in his previous patch D64393.

First loop counted more instructions than it was in reality and the second loop went beyond the basic block with that counter.

I used Jay's previous code that relied on MRI.use_operands to constrain the number of instructions to check among.
modifiesRegister is inlined to reduce the number of passes over instruction operands and added assert on BB end boundary.

Differential Revision: https://reviews.llvm.org/D89386
2020-10-23 19:17:48 +03:00
Kadir Cetinkaya 5dd39923a0
[clangd] Fix remote-server build and add it to check-clangd
Differential Revision: https://reviews.llvm.org/D90047
2020-10-23 18:08:02 +02:00
Paulo Matos 69e2797eae [WebAssembly] Implementation of (most) table instructions
Implementation of instructions table.get, table.set, table.grow,
table.size, table.fill, table.copy.

Missing instructions are table.init and elem.drop as they deal with
element sections which are not yet implemented.

Added more tests to tables.s

Differential Revision: https://reviews.llvm.org/D89797
2020-10-23 08:42:54 -07:00
Sourabh Singh Tomar e7d37742a2 [flang][OpenMP] Upstream lowering of OpenMP `Flush` construct
Note: This patch reflects the work that can be upstreamed from PR's(merged):

- https://github.com/flang-compiler/f18-llvm-project/pull/476

Reviewed By: kiranchandramohan, clementval

Differential Revision: https://reviews.llvm.org/D90048
2020-10-23 21:09:50 +05:30
Jeremy Morse b1b2c6ab66 [DebugInstrRef] Handle DBG_INSTR_REFs use-before-defs in LiveDebugValues
Deciding where to place debugging instructions when normal instructions
sink between blocks is difficult -- see PR44117. Dealing with this with
instruction-referencing variable locations is simple: we just tolerate
DBG_INSTR_REFs referring to values that haven't been computed yet. This
patch adds support into InstrRefBasedLDV to record when a variable value
appears in the middle of a block, and should have a DBG_VALUE added when it
appears (a debug use before def).

While described simply, this relies heavily on the value-propagation
algorithm in InstrRefBasedLDV. The implementation doesn't attempt to verify
the location of a value unless something non-trivial occurs to merge
variable values in vlocJoin. This means that a variable with a value that
has no location can retain it across all control flow (including loops).
It's only when another debug instruction specifies a different variable
value that we have to check, and find there's no location.

This property means that if a machine value is defined in a block dominated
by a DBG_INSTR_REF that refers to it, all the successor blocks can
automatically find a location for that value (if it's not clobbered). Thus
in a sense, InstrRefBasedLDV is already supporting and implementing
use-before-defs. This patch allows us to specify a variable location in the
block where it's defined.

When loading live-in variable locations, TransferTracker currently discards
those where it can't find a location for the variable value. However, we
can tell from the machine value number whether the value is defined in this
block. If it is, add it to a set of use-before-def records. Then, once the
relevant instruction has been processed, emit a DBG_VALUE immediately after
it.

Differential Revision: https://reviews.llvm.org/D85775
2020-10-23 16:33:23 +01:00
Jay Foad 958130dfda [AMDGPU] Add simplification/combines for llvm.amdgcn.fma.legacy
This follows on from D89558 which added the new intrinsic and D88955
which added similar combines for llvm.amdgcn.fmul.legacy.

Differential Revision: https://reviews.llvm.org/D90028
2020-10-23 16:16:13 +01:00
Denis Antrushin 4f7ee55971 Revert "[Statepoints] Allow deopt GC pointer on VReg if gc-live bundle is empty."
Downstream testing revealed some problems with this patch.
Reverting while investigating.
This reverts commit 2b96dcebfa.
2020-10-23 21:55:06 +07:00
Nicolai Hähnle a74fc48158 CfgInterface: rename interface() to getInterface()
Apparently there are some Microsoft headers which
`#define interface struct`. This method is only used
in pending changes so far.

Change-Id: Ic68fe8e1958ec9b015f817ee218431f4146b888a
2020-10-23 16:52:10 +02:00
Sourabh Singh Tomar 1d328446bf [flang][OpenMP] Upstream lowering of `ParallelOp` clauses
Note: This patch reflects the work that can be upstreamed from PR's(merged):

1. https://github.com/flang-compiler/f18-llvm-project/pull/456
2. https://github.com/flang-compiler/f18-llvm-project/pull/485

Also replaced TODO with new TODO.

Reviewed By: kiranchandramohan

Differential Revision: https://reviews.llvm.org/D89769
2020-10-23 20:21:39 +05:30
Simon Pilgrim a6ad077f5d [InstCombine] Add i8 bitreverse by multiplication test patterns
Pulled from bit twiddling hacks webpage
2020-10-23 15:39:57 +01:00
Simon Pilgrim 61d1847b12 [InstCombine] Add 8/16/32/64 bitreverse test coverage
Use typical codegen for the traditional pairwise lgN bitreverse algorithm
2020-10-23 15:39:56 +01:00
Simon Pilgrim 9e7667e2ad [InstCombine] Add initial bitreverse test coverage 2020-10-23 15:39:56 +01:00
Paul C. Anagnostopoulos 876af264c1 [TableGen] Change !getop and !setop to !getdagop and !setdagop.
Differential Revision: https://reviews.llvm.org/D89814
2020-10-23 10:36:05 -04:00
Matt Arsenault 8a59d4b654 AMDGPU: Don't query for TII in TII 2020-10-23 10:34:24 -04:00
Matt Arsenault d61996473d AMDGPU: Increase branch size estimate with offset bug
This will be relaxed to insert a nop if the offset hits the bad value,
so over estimate branch instruction sizes.
2020-10-23 10:34:24 -04:00
Valentin Clement 676ff75d60 [flang][openacc] Fix semantic check for wait and atomic directives
wait and atomic directives are represented by OpenACCWaitConstruct, OpenACCAtmicConstruct in the parser. Those contrsuct were
not taken into account in the semantic check so far.

Reviewed By: kiranchandramohan

Differential Revision: https://reviews.llvm.org/D88628
2020-10-23 10:31:50 -04:00
David Van Cleve f55eeea402 Export TemplateArgumentMatcher so clients defining custom matchers don't need to use the internal namespace
This change adds another export, `using TemplateArgumentMatcher = internal::Matcher<TemplateArgument>;`, to the collection of exports that put instantiations of the `clang::ast_matchers::internal::Matcher` into the `clang::ast_matchers` namespace. This makes it possible to define custom TemplateArgument matchers without reaching into the `internal` namespace.

Reviewed By: klimek

Differential Revision: https://reviews.llvm.org/D89920
2020-10-23 16:13:56 +02:00
Frederik Gossen 8039b3f966 [MLIR] Fix bad merge with buffer alias analysis. 2020-10-23 14:11:27 +00:00
Evgeny Leviant b651ecfb72 [llvm-mca] Extend cortex-a57 memory instructions test
Patch adds few/load store instructions which have custom sched
classes in cortex-a57 model.
2020-10-23 17:02:20 +03:00
Jeremy Morse 68f4715716 [DebugInstrRef] Convert DBG_INSTR_REFs into variable locations
Handle DBG_INSTR_REF instructions in LiveDebugValues, to determine and
propagate variable locations. The logic is fairly straight forwards:
Collect a map of debug-instruction-number to the machine value numbers
generated in the first walk through the function. When building the
variable value transfer function and we see a DBG_INSTR_REF, look up the
instruction it refers to, and pick the machine value number it generates,
That's it; the rest of LiveDebugValues continues as normal.

Awkwardly, there are two kinds of instruction numbering happening here: the
offset into the block (which is how machine value numbers are determined),
and the numbers that we label instructions with when generating
DBG_INSTR_REFs.

I've also restructured the TransferTracker redefVar code a little, to
separate some DBG_VALUE specific operations into its own method. The
changes around redefVar should be largely NFC, while allowing
DBG_INSTR_REFs to specify a value number rather than just a location.

Differential Revision: https://reviews.llvm.org/D85771
2020-10-23 14:50:02 +01:00
Nico Weber 13aff21f0d [gn build] port 48e4b0f (__config_site revert)
This reverts commit b3ca53e142.
This reverts commit 8b7dac81d3.
This reverts commit 37c030f81a.
2020-10-23 09:45:34 -04:00
Louis Dionne 48e4b0fd3a [runtimes] Revert the libc++ __config_site change
This is a massive revert of the following commits (from most revent to oldest):

	2b9b7b5775.
	529ac33197
	28270234f1
	69c2087283
	b5aa67446e
	5d796645d6

After checking-in the __config_site change, a lot of things started breaking
due to widespread reliance on various aspects of libc++'s build, notably the
fact that we can include the headers from the source tree, but also reliance
on various "internal" CMake variables used by the runtimes build and compiler-rt.

These were unintended consequences of the change, and after two days, we
still haven't restored all the bots to being green. Instead, now that I
understand what specific areas this will blow up in, I should be able to
chop up the patch into smaller ones that are easier to digest.

See https://reviews.llvm.org/D89041 for more details on this adventure.
2020-10-23 09:41:48 -04:00
Chen Zheng 1e0b6c1df0 [LSR] ignore profitable chain when reg num is not major cost.
Reviewed By: samparker

Differential Revision: https://reviews.llvm.org/D89665
2020-10-23 09:35:48 -04:00
Sam McCall ce63383e45 [clangd] Drop version from remote index proto names, fix clangd-index-server
We only need to version these messages if they actually diverge.
Unlike the service, the namespace name isn't part of the wire format.

clangd-index-server was broken by 81e5f298c4
as the namespace names weren't updated there, this fixes it (by adding
them for the service, and not requiring them elsewhere).
2020-10-23 15:28:11 +02:00
Stefan Pintilie c6561ccfd9 [PowerPC][LLD] Support for PC Relative TLS for Local Dynamic
Add support to LLD for PC Relative Thread Local Storage for Local Dynamic.
This patch adds support for two relocations: R_PPC64_GOT_TLSLD_PCREL34 and
R_PPC64_DTPREL34.

The Local Dynamic code is:
```
pla r3, x@got@tlsld@pcrel        R_PPC64_GOT_TLSLD_PCREL34
bl __tls_get_addr@notoc(x@tlsld) R_PPC64_TLSLD
                                 R_PPC64_REL24_NOTOC
...
paddi r9, r3, x@dtprel           R_PPC64_DTPREL34
```

After relaxation to Local Exec:
```
paddi r3, r13, 0x1000
nop
...
paddi r9, r3, x@dtprel          R_PPC64_DTPREL34
```

Reviewed By: NeHuang, sfertile

Differential Revision: https://reviews.llvm.org/D87504
2020-10-23 08:23:56 -05:00
Frederik Gossen 6d83e3b443 [MLIR] Extract buffer alias analysis for reuse
Extract buffer alias analysis from buffer placement.

Differential Revision: https://reviews.llvm.org/D89902
2020-10-23 13:23:32 +00:00
Sam McCall e6c1c3f97f [clang] Split remote index service definition into a separate file.
This allows it to have a separate namespace (grpc versioned service) without
putting versioning info on all of the other protos (before we need it).

clang-index-server is still broken (from 81e5f298c4).

Differential Revision: https://reviews.llvm.org/D90031
2020-10-23 15:20:51 +02:00
Sanjay Patel c72198079d [ValueTracking] add range limits for cttz
As discussed in D89952,
instcombine can sometimes find a way to reduce similar patterns,
but it is incomplete.
InstSimplify uses the computeConstantRange() ValueTracking analysis
via simplifyICmpWithConstant(), so we just need to fill in the max
value of cttz to process any "icmp pred cttz(X), C" pattern (the
min value is initialized to zero automatically).

https://alive2.llvm.org/ce/z/Z_SLWZ

Follow-up to D89976.
2020-10-23 08:43:45 -04:00
Sanjay Patel 3fb0d6b0d5 [ValueTracking] add range limits for ctlz
As discussed in D89952,
instcombine can sometimes find a way to reduce similar patterns,
but it is incomplete.
InstSimplify uses the computeConstantRange() ValueTracking analysis
via simplifyICmpWithConstant(), so we just need to fill in the max
value of ctlz to process any "icmp pred ctlz(X), C" pattern (the
min value is initialized to zero automatically).

Follow-up to D89976.
2020-10-23 08:43:45 -04:00
Sanjay Patel 0351bd959f [InstSimplify] add tests for cttz constant range; NFC
This is a search-and-replace of f6cb7f3
2020-10-23 08:43:45 -04:00
Sanjay Patel 9bcb437f46 [InstSimplify] add tests for ctlz constant range; NFC
This is a search-and-replace of f6cb7f3.
2020-10-23 08:43:45 -04:00
Kirill Bobyrev e6c4d880fa [clangd] NFC: Add using directives to avoid spelling out llvm::sys::path
`llvm::sys::path` is used a lot in the remote index marshalling code. We can save space by avoiding spelling it out explicitly for most functions and times.

Reviewed By: kadircet

Differential Revision: https://reviews.llvm.org/D90016
2020-10-23 14:38:31 +02:00
Sam McCall 2d25004a13 [CMake] Fix hardcoding of protobuf output basename. NFC
Differential Revision: https://reviews.llvm.org/D90030
2020-10-23 14:29:57 +02:00
Sam McCall 81f7b2ac0f [CMake] generate_grpc_protos -> generate_protos(... GRPC). NFC
Differential Revision: https://reviews.llvm.org/D90027
2020-10-23 14:28:07 +02:00
Kirill Bobyrev 421a2a0dbb [clangd] Migrate to proto2 syntax
This allows us to check whether enum field is actually sent over the wire or missing.

Reviewed By: sammccall

Differential Revision: https://reviews.llvm.org/D89882
2020-10-23 14:27:15 +02:00
Dmitry Polukhin 55a2deed07 [clang-tidy] Fix redefinition of module in the same module.modulemap file
In memory VFS cannot handle aceesssing the same file with different paths.
This diff just stops using VFS for modulemap files.

Fixes PR47839

Differential Revision: https://reviews.llvm.org/D89886
2020-10-23 13:20:18 +01:00
Sanjay Patel 748ecc6b32 [ValueTracking] add range limits for ctpop
As discussed in D89952,
instcombine can sometimes find a way to reduce similar patterns,
but it is incomplete.
InstSimplify uses the computeConstantRange() ValueTracking analysis
via simplifyICmpWithConstant(), so we just need to fill in the max
value of ctpop to process any "icmp pred ctpop(X), C" pattern (the
min value is initialized to zero automatically).

Differential Revision: https://reviews.llvm.org/D89976
2020-10-23 08:17:54 -04:00
zhanghb97 448f25c86b [mlir] Expose affine expression to C API
This patch provides C API for MLIR affine expression.
- Implement C API for methods of AffineExpr class.
- Implement C API for methods of derived classes (AffineBinaryOpExpr, AffineDimExpr, AffineSymbolExpr, and AffineConstantExpr).

Differential Revision: https://reviews.llvm.org/D89856
2020-10-23 20:06:32 +08:00
Simon Pilgrim 1cab3bf004 [InstCombine] matchBSwapOrBitReverse - expose bswap/bitreverse matching flags.
matchBSwapOrBitReverse was hardcoded to just match bswaps - we're going to need to expose the ability to match bitreverse as well, so make this part of the function call.
2020-10-23 12:35:28 +01:00
Simon Pilgrim 19a13bf538 [InstCombine] Rename InstCombinerImpl::matchBSwap to matchBSwapOrBitReverse. NFCI.
This matches bswap and bitreverse intrinsics, so we should make that clear in the function name.
2020-10-23 12:35:27 +01:00
Simon Pilgrim 936ef89ebe [X86] lowerShuffleWithPERMV - use MVT::changeTypeToInteger helper. NFCI. 2020-10-23 12:35:27 +01:00
Evgeny Leviant cb86522c94 [ARM][SchedModels] Convert IsR1P0AndLaterPred to MCSchedPredicate. NFC
Differential revision: https://reviews.llvm.org/D90017
2020-10-23 14:27:49 +03:00
Florian Hahn 0fcc6f7a76 [AArch64] Implement getIntrinsicInstrCost, handle min/max intrinsics.
This patch adds a specialized implementation of getIntrinsicInstrCost
and add initial cost-modeling for min/max vector intrinsics.

AArch64 NEON support umin/smin/umax/smax for vectors
<8 x i8>, <16 x i8>, <4 x i16>, <8 x i16>, <2 x i32> and <4 x i32>.
Notably, it does not support vectors with i64 elements.

This change by itself should have very little impact on codegen, but in
follow-up patches I plan to teach the vectorizers to consider using
those intrinsics on platforms where it is profitable, e.g. because there
is no general 'select'-like instruction.

The current cost returned should be better for throughput, latency and size.

Reviewed By: dmgreen

Differential Revision: https://reviews.llvm.org/D89953
2020-10-23 11:32:42 +01:00
Michał Górny dae7b10034 [lldb] Split out NetBSD/x86 watchpoint impl for unification
Split the current NetBSD watchpoint implementation for x86 into Utility,
and revamp it to improve readability.  This code is meant to be used
as a common class for all x86 watchpoint implementation, particularly
these on FreeBSD and Linux.

The code uses global watchpoint enable bits, as required by the NetBSD
kernel.  If it ever becomes necessary for any platform to use local
enable bits instead, this can be trivially abstracted out.

The code also postpones clearing DR6 until a new different watchpoint
is being set in place of the old one.  This is necessary since LLDB
repeatedly reenables watchpoints on all threads, by clearing
and restoring them.  When DR6 is cleared as a part of that, then pending
events on other threads can no longer be associated with watchpoints
correctly.

Differential Revision: https://reviews.llvm.org/D89874
2020-10-23 12:20:15 +02:00
Jeremy Morse ab93e71065 [DebugInstrRef] NFC: Separate collection of machine/variable values
This patch adjusts _when_ something happens in LiveDebugValues /
InstrRefBasedLDV, to make it more amenable to dealing with DBG_INSTR_REF
instructions. There's no functional change.

In the current InstrRefBasedLDV implementation, we collect the machine
value-number transfer function for blocks at the same time as the
variable-value transfer function. After solving machine value numbers, the
variable-value transfer function is updated so that DBG_VALUEs of live-in
registers have the correct value. The same would need to be done for
DBG_INSTR_REFs, to connect instruction-references with machine value
numbers.

Rather than writing more code for that, this patch separates the two: we
collect the (machine-value-number) transfer function and solve for
machine value numbers, then step through the MachineInstrs again collecting
the variable value transfer function. This simplifies things for the new
few patches.

Differential Revision: https://reviews.llvm.org/D85760
2020-10-23 11:13:20 +01:00
Julian Gross 0d1d363c51 [MLIR] Added PromoteBuffersToStackPass to convert heap- to stack-based allocations.
Added optimization pass to convert heap-based allocs to stack-based allocas in
buffer placement. Added the corresponding test file.

Differential Revision: https://reviews.llvm.org/D89688
2020-10-23 12:02:25 +02:00
Christian Sigg ff87c4d3e7 [mlir] Fix exiting OpPatternRewriteDriver::simplifyLocally after first iteration that didn't change the op.
Before this change, we would run `maxIterations` if the first iteration changed the op.
After this change, we exit the loop as soon as an iteration hasn't changed the op.
Assuming that we have reached a fixed point when an iteration doesn't change the op, this doesn't affect correctness.

Reviewed By: rriddle

Differential Revision: https://reviews.llvm.org/D89981
2020-10-23 11:10:31 +02:00
OCHyams fea067bdfd [mem2reg] Remove dbg.values describing contents of dead allocas
This patch copies @vsk's fix to instcombine from D85555 over to mem2reg. The
motivation and rationale are exactly the same: When mem2reg removes an alloca,
it erases the dbg.{addr,declare} instructions which refer to the alloca. It
would be better to instead remove all debug intrinsics which describe the
contents of the dead alloca, namely all dbg.value(<dead alloca>, ...,
DW_OP_deref)'s.

As far as I can tell, prior to D80264 these `dbg.value+deref`s would have been
silently dropped instead of being made `undef`, so we're just returning to
previous behaviour with these patches.

Testing:
`llvm-lit llvm/test` and `ninja check-clang` gave no unexpected failures. Added
3 tests, each of which covers a dbg.value deletion path in mem2reg:
  mem2reg-promote-alloca-1.ll
  mem2reg-promote-alloca-2.ll
  mem2reg-promote-alloca-3.ll
The first is based on the dexter test inlining.c from D89543. This patch also
improves the debugging experience for loop.c from D89543, which suffers
similarly after arg promotion instead of inlining.
2020-10-23 04:46:56 +00:00