166092 Commits

Author SHA1 Message Date
Lang Hames
1b30e51a07 [ORC] Don't call isa<> on a null value.
This should fix the recent builder failures in the test-global-ctors.ll testcase.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@335680 91177308-0d34-0410-b5e6-96231b3b80d8
2018-06-26 22:43:01 +00:00
Lang Hames
1d0cbe2918 [ORC] Fix a missing return value.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@335677 91177308-0d34-0410-b5e6-96231b3b80d8
2018-06-26 22:30:42 +00:00
Michael Zolotukhin
d3c8f20a14 [JumpThreading] Don't try to rewrite a use if it's already valid.
Summary:
When recording uses we need to rewrite after cloning a loop we need to
check if the use is not dominated by the original def. The initial
assumption was that the cloned basic block will introduce a new path and
thus the original def will only dominate the use if they are in the same
BB, but as the reproducer from PR37745 shows it's not always the case.

This fixes PR37745.

Reviewers: haicheng, Ka-Ka

Subscribers: hiraditya, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@335675 91177308-0d34-0410-b5e6-96231b3b80d8
2018-06-26 22:19:48 +00:00
Lang Hames
ab8689e932 [ORC] Add a dependence on MC to LLVMBuild.txt
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@335673 91177308-0d34-0410-b5e6-96231b3b80d8
2018-06-26 22:12:02 +00:00
Simon Pilgrim
0e00ed71fa [X86] Add test for SDIV by sign bit (minsigned) value
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@335671 91177308-0d34-0410-b5e6-96231b3b80d8
2018-06-26 22:03:00 +00:00
Lang Hames
9f1c2395ce [ORC] Add LLJIT and LLLazyJIT, and replace OrcLazyJIT in LLI with LLLazyJIT.
LLJIT is a prefabricated ORC based JIT class that is meant to be the go-to
replacement for MCJIT. Unlike OrcMCJITReplacement (which will continue to be
supported) it is not API or bug-for-bug compatible, but targets the same
use cases: Simple, non-lazy compilation and execution of LLVM IR.

LLLazyJIT extends LLJIT with support for function-at-a-time lazy compilation,
similar to what was provided by LLVM's original (now long deprecated) JIT APIs.

This commit also contains some simple utility classes (CtorDtorRunner2,
LocalCXXRuntimeOverrides2, JITTargetMachineBuilder) to support LLJIT and
LLLazyJIT.

Both of these classes are works in progress. Feedback from JIT clients is very
welcome!

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@335670 91177308-0d34-0410-b5e6-96231b3b80d8
2018-06-26 21:35:48 +00:00
Konstantin Zhuravlyov
784d2a8499 AMDGPU: Silence unused warnings in waitcnt insertion pass in release build
Differential Revision: https://reviews.llvm.org/D48607


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@335669 91177308-0d34-0410-b5e6-96231b3b80d8
2018-06-26 21:33:38 +00:00
Jessica Paquette
9e1483fe74 [X86][AsmParser] Recommit r335658
Recommit of r335658 so that it does not change the behaviour of any
existing error output.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@335668 91177308-0d34-0410-b5e6-96231b3b80d8
2018-06-26 21:30:34 +00:00
Vedant Kumar
ab0a33b6a7 Rename skipDebugInfo -> skipDebugIntrinsics, NFC
This addresses post-commit feedback about the name 'skipDebugInfo' being
misleading. This name could be interpreted as meaning 'a function that
skips instructions with debug locations'.

The new name, 'skipDebugIntrinsics', makes it clear that this function
only skips debug info intrinsics.

Thanks to Adrian Prantl for pointing this out!

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@335667 91177308-0d34-0410-b5e6-96231b3b80d8
2018-06-26 21:16:59 +00:00
Lang Hames
89e0af6b10 [ORC] Allow IRTransformLayer2's transform to be modified after initialization.
Also give the constructor's transform parameter a default no-op transform value.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@335665 91177308-0d34-0410-b5e6-96231b3b80d8
2018-06-26 20:59:51 +00:00
Lang Hames
b525a3a639 [ORC] Reset AsynchronousSymbolQuery's NotifySymbolsResolved callback on error.
AsynchronousSymbolQuery::canStillFail checks the value of the callback to
prevent sending it redundant error notifications, so we need to reset it after
running it.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@335664 91177308-0d34-0410-b5e6-96231b3b80d8
2018-06-26 20:59:50 +00:00
Lang Hames
6ccd1b1e5b [ORC] Move the VSOList typedef out of VSO.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@335663 91177308-0d34-0410-b5e6-96231b3b80d8
2018-06-26 20:59:49 +00:00
Lang Hames
2338ba3e11 [ORC] Add a FIXME.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@335662 91177308-0d34-0410-b5e6-96231b3b80d8
2018-06-26 20:59:49 +00:00
Lang Hames
fdc08234d7 [ORC] Fix a FIXME by moving MangleAndInterner to Core.h.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@335661 91177308-0d34-0410-b5e6-96231b3b80d8
2018-06-26 20:59:46 +00:00
Jessica Paquette
daa6db3e25 Revert "[X86][AsmParser] Emit an error when RIP-relative instructions are used in 32-bit mode"
This reverts commit 4850a9aae8b38c7deadc103d634ec7397e6c323b.

It caused MC/X86/x86_errors.s to fail. Will fix and recommit shortly.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@335660 91177308-0d34-0410-b5e6-96231b3b80d8
2018-06-26 20:57:19 +00:00
Jessica Paquette
34ffe04f30 [X86][AsmParser] Emit an error when RIP-relative instructions are used in 32-bit mode
Right now, when we use RIP-relative instructions in 32-bit mode, we'll just
assert and crash.

This adds an error message which tells the user that they can't do that in
32-bit mode, so that we don't crash (and also can see the issue outside of
assert builds).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@335658 91177308-0d34-0410-b5e6-96231b3b80d8
2018-06-26 20:33:46 +00:00
Stanislav Mekhanoshin
aac117a9ba [AMDGPU] Add llvm.amdgcn.fmad.ftz intrinsic
This intrinsic selects v_mad_f32 regardless of fp32 denorm support.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@335654 91177308-0d34-0410-b5e6-96231b3b80d8
2018-06-26 20:04:19 +00:00
Sanjay Patel
95b187a7dd [DAGCombiner] use isBitwiseNot to simplify code; NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@335652 91177308-0d34-0410-b5e6-96231b3b80d8
2018-06-26 19:46:56 +00:00
Matt Arsenault
a2ba13d731 AMDGPU: Add pass to lower kernel arguments to loads
This replaces most argument uses with loads, but for
now not all.

The code in SelectionDAG for calling convention lowering
is actively harmful for amdgpu_kernel. It attempts to
split the argument types into register legal types, which
results in low quality code for arbitary types. Since
all kernel arguments are passed in memory, we just want the
raw types.

I've tried a couple of methods of mitigating this in SelectionDAG,
but it's easier to just bypass this problem alltogether. It's
possible to hack around the problem in the initial lowering,
but the real problem is the DAG then expects to be able to use
CopyToReg/CopyFromReg for uses of the arguments outside the block.

Exposing the argument loads in the IR also has the advantage
that the LoadStoreVectorizer can merge them.

I'm not sure the best approach to dealing with the IR
argument list is. The patch as-is just leaves the IR arguments
in place, so all the existing code will still compute the same
kernarg size and pointlessly lowers the arguments.

Arguably the frontend should emit kernels with an empty argument
list in the first place. Alternatively a dummy array could be
inserted as a single argument just to reserve space.

This does have some disadvantages. Local pointer kernel arguments can
no longer have AssertZext placed  on them as the equivalent !range
metadata is not valid on pointer  typed loads. This is mostly bad
for SI which needs to know about the known bits in order to use the
DS instruction offset, so in this case this is not done.

More importantly, this skips noalias arguments since this pass
does not yet convert this to the equivalent !alias.scope and !noalias
metadata. Producing this metadata correctly seems to be tricky,
although this logically is the same as inlining into a function which
doesn't exist. Additionally, exposing these loads to the vectorizer
may result in degraded aliasing information if a pointer load is
merged with another argument load.

I'm also not entirely sure this is preserving the current clover
ABI, although I would greatly prefer if it would stop widening
arguments and match the HSA ABI. As-is I think it is extending
< 4-byte arguments to 4-bytes but doesn't align them to 4-bytes.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@335650 91177308-0d34-0410-b5e6-96231b3b80d8
2018-06-26 19:10:00 +00:00
Matt Arsenault
737191dd29 ConstantFold: Don't fold global address vs. null for addrspace != 0
Not sure why this logic seems to be repeated in 2 different places,
one called by the other.

On AMDGPU addrspace(3) globals start allocating at 0, so these
checks will be incorrect (not that real code actually tries
to compare these addresses)

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@335649 91177308-0d34-0410-b5e6-96231b3b80d8
2018-06-26 18:55:43 +00:00
Vedant Kumar
8d224a36c1 Use a variable to appease a no-asserts bot, NFC
Failure URL:
http://lab.llvm.org:8011/builders/lld-x86_64-darwin13/builds/22836

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@335648 91177308-0d34-0410-b5e6-96231b3b80d8
2018-06-26 18:55:26 +00:00
Vedant Kumar
9253369f66 [Debugify] Don't treat missing dbg.values as an error (PR37942)
When checking the debug info in a module, don't treat a missing
dbg.value as an error. The dbg.value may simply have been DCE'd, in
which case the debugger has enough information to display the variable
as <optimized out>.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@335647 91177308-0d34-0410-b5e6-96231b3b80d8
2018-06-26 18:54:10 +00:00
Tim Shen
e64a8288ae [ConstantRange] Add support of mul in makeGuaranteedNoWrapRegion.
Summary: This is trying to add support for r334428.

Reviewers: sanjoy

Subscribers: jlebar, hiraditya, bixia, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@335646 91177308-0d34-0410-b5e6-96231b3b80d8
2018-06-26 18:54:10 +00:00
Matt Arsenault
93ae5a35af LoopUnroll: Allow analyzing intrinsic call costs
I'm not sure why the code here is skipping calls since
TTI does try to do something for general calls, but it
at least should allow intrinsics.

Skip intrinsics that should not be omitted as calls, which
is by far the most common case on AMDGPU.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@335645 91177308-0d34-0410-b5e6-96231b3b80d8
2018-06-26 18:51:17 +00:00
Vedant Kumar
99917384c8 [Local] Add a convenient insertReplacementDbgValues overload, NFC
Add an overload for the common case where the replacement dbg.values
have the same DIExpressions as the originals.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@335643 91177308-0d34-0410-b5e6-96231b3b80d8
2018-06-26 18:44:53 +00:00
Vedant Kumar
6a78ba2a8c [Local] Sink salvageDI's early exit into helper functions, NFC
salvageDebugInfo() performs a check that allows it to exit early without
doing a DenseMap lookup. It's a bit neater and marginally more useful to
sink this early exit into the findDbg{Addr,Users,Values} helpers.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@335642 91177308-0d34-0410-b5e6-96231b3b80d8
2018-06-26 18:44:52 +00:00
Brendon Cahoon
6b3e4d2fb7 [Hexagon] Add a "generic" cpu
Add the generic processor for Hexagon so that it can be used
with 3rd party programs that create a back-end with the
"generic" CPU. This patch also enables the JIT for Hexagon.

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



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@335641 91177308-0d34-0410-b5e6-96231b3b80d8
2018-06-26 18:44:05 +00:00
Simon Pilgrim
67cc73d7b2 [DAGCombiner] Don't accept -1 sdiv divisors in sdiv-by-pow2 vector expansion (PR37119)
Temporary fix until I've managed to get D45806 updated - both +1 and -1 special cases need to be properly supported.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@335637 91177308-0d34-0410-b5e6-96231b3b80d8
2018-06-26 17:46:51 +00:00
Fangrui Song
0fde67787a Move REQUIRES: line to the top
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@335635 91177308-0d34-0410-b5e6-96231b3b80d8
2018-06-26 17:44:23 +00:00
Sanjay Patel
5f8dac1929 [InstSimplify] fold shifts by sext bool
https://rise4fun.com/Alive/c3Y


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@335633 91177308-0d34-0410-b5e6-96231b3b80d8
2018-06-26 17:31:38 +00:00
Sanjay Patel
84f6f2281a [InstSimplify] add tests for shifts by sext bool; NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@335631 91177308-0d34-0410-b5e6-96231b3b80d8
2018-06-26 17:15:07 +00:00
Simon Pilgrim
5399eba9f5 [X86][SSE] Add another sdiv by (nonuniform) minus one test (PR37119)
Include a test that divides by -1 but not by 1 (another special case)

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@335629 91177308-0d34-0410-b5e6-96231b3b80d8
2018-06-26 17:06:05 +00:00
Sanjay Patel
41f2034b16 [InstCombine] simplify code for urem fold; NFCI
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@335623 91177308-0d34-0410-b5e6-96231b3b80d8
2018-06-26 16:39:29 +00:00
Sanjay Patel
e9e5731866 [InstCombine] fold urem with sext bool divisor
Similar to other patches in this series:
https://reviews.llvm.org/rL335512
https://reviews.llvm.org/rL335527
https://reviews.llvm.org/rL335597
https://reviews.llvm.org/rL335616

...this is filling a gap in analysis that is exposed by an unrelated select-of-constants transform.
I didn't see a way to unify the sext cases because each div/rem opcode results in a different fold.

Note that in this case, the backend might want to convert the select into math:
Name: sext urem
%e = sext i1 %x to i32
%r = urem i32 %y, %e
=>
%c = icmp eq i32 %y, -1
%z = zext i1 %c to i32
%r = add i32 %z, %y


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@335622 91177308-0d34-0410-b5e6-96231b3b80d8
2018-06-26 16:30:00 +00:00
Simon Pilgrim
40be0055ae [SLPVectorizer] Recognise non uniform power of 2 constants
Since D46637 we are better at handling uniform/non-uniform constant Pow2 detection; this patch tweaks the SLP argument handling to support them.

As SLP works with arrays of values I don't think we can easily use the pattern match helpers here.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@335621 91177308-0d34-0410-b5e6-96231b3b80d8
2018-06-26 16:20:16 +00:00
Sanjay Patel
0c1dedd8ed [InstCombine] add tests for urem with sext bool divisor; NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@335619 91177308-0d34-0410-b5e6-96231b3b80d8
2018-06-26 16:01:24 +00:00
Simon Pilgrim
007404388e [DAGCombiner] Pull out VT bitwidth in visitSDIV. NFCI.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@335617 91177308-0d34-0410-b5e6-96231b3b80d8
2018-06-26 15:39:16 +00:00
Sanjay Patel
7706083ace [InstSimplify] fold srem with sext bool divisor
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@335616 91177308-0d34-0410-b5e6-96231b3b80d8
2018-06-26 15:32:54 +00:00
James Henderson
3e90a9b8c8 Fix doc title underlining.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@335615 91177308-0d34-0410-b5e6-96231b3b80d8
2018-06-26 15:29:09 +00:00
James Henderson
583ccd4384 [FileCheck] Add CHECK-EMPTY directive for checking for blank lines
Prior to this change, there was no clean way of getting FileCheck to
check that a line is completely empty. The expected way of using
"CHECK: {{^$}}" does not work because the '^' matches the end of the
previous match (this behaviour may be desirable in certain instances).
For the same reason, "CHECK-NEXT: {{^$}}" will fail when the previous
match was at the end of the line, as the pattern will match there.
Using the recommended [[:space:]] to match an explicit new line could
also match a space, and thus is not always desired. Literal '\n'
matches also do not work. A workaround was suggested in the review, but
it is a little clunky.

This change adds a new directive that behaves the same as CHECK-NEXT,
except that it only matches against empty lines (nothing, not even
whitespace, is allowed). As with CHECK-NEXT, it will fail if more than
one newline occurs before the next blank line. Example usage:
; test.txt
foo

bar
; CHECK: foo
; CHECK-EMPTY:
; CHECK-NEXT: bar

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

Reviewed by: probinson


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@335613 91177308-0d34-0410-b5e6-96231b3b80d8
2018-06-26 15:15:45 +00:00
Krzysztof Parzyszek
e873939bd3 Silence "unused variable" warning in LiveIntervals.cpp after r335607
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@335610 91177308-0d34-0410-b5e6-96231b3b80d8
2018-06-26 14:55:04 +00:00
Sanjay Patel
a301ecd20b [InstSimplify] add tests for srem with sext bool divisor; NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@335609 91177308-0d34-0410-b5e6-96231b3b80d8
2018-06-26 14:47:31 +00:00
Nico Weber
7b36ec6b5e Fix LLVM_ENABLE_THREADS=0 builds after r335440.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@335608 91177308-0d34-0410-b5e6-96231b3b80d8
2018-06-26 14:42:48 +00:00
Krzysztof Parzyszek
2c45bcb399 Account for undef values from predecessors in extendSegmentsToUses
It is legal for a PHI node not to have a live value in a predecessor
as long as the end of the predecessor is jointly dominated by an undef
value.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@335607 91177308-0d34-0410-b5e6-96231b3b80d8
2018-06-26 14:37:16 +00:00
Simon Pilgrim
f2d90857da [TargetLowering] isVectorClearMaskLegal - use ArrayRef<int> instead of const SmallVectorImpl<int>&
This is more generic and matches isShuffleMaskLegal.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@335605 91177308-0d34-0410-b5e6-96231b3b80d8
2018-06-26 14:15:31 +00:00
Than McIntosh
61f67f4637 [X86,ARM] Retain split-stack prolog check for sibling calls
Summary:
If a routine with no stack frame makes a sibling call, we need to
preserve the stack space check even if the local stack frame is empty,
since the call target could be a "no-split" function (in which case
the linker needs to be able to fix up the prolog sequence in order to
switch to a larger stack).

This fixes PR37807.

Reviewers: cherry, javed.absar

Subscribers: srhines, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@335604 91177308-0d34-0410-b5e6-96231b3b80d8
2018-06-26 14:11:30 +00:00
Simon Pilgrim
799df9565b Fix spelling mistakes in comments. NFCI.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@335603 91177308-0d34-0410-b5e6-96231b3b80d8
2018-06-26 14:06:23 +00:00
Teresa Johnson
c6dda905a6 [ThinLTO] Parse module summary index from assembly
Summary:
Adds assembly parsing support for the module summary index (follow on
to r333335 which added the assembly writing support).

I added support to llvm-as to invoke the index parsing, so that it can
create either a bitcode file with a Module and a per-module index, or
a combined index without a Module.

I will send follow on patches soon to do the following:
- add support to tools such as llvm-lto2 to parse the per-module indexes
from assembly instead of bitcode when testing the thin link.
- verification support.

Depends on D47844 and D47842.

Reviewers: pcc, dexonsmith, mehdi_amini

Subscribers: inglorion, eraman, steven_wu, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@335602 91177308-0d34-0410-b5e6-96231b3b80d8
2018-06-26 13:56:49 +00:00
Sanjay Patel
86366d2a15 [InstCombine] fold udiv with sext bool divisor
Note: I didn't add a hasOneUse() check because the existing,
related fold doesn't have that check. I suspect that the
improved analysis and codegen make these some of the rare
canonicalization cases where we allow an increase in
instructions.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@335597 91177308-0d34-0410-b5e6-96231b3b80d8
2018-06-26 12:41:15 +00:00
Tim Northover
67ad29ab38 ARM: add binary file git swallowed.
Should fix bots.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@335596 91177308-0d34-0410-b5e6-96231b3b80d8
2018-06-26 12:28:47 +00:00