Vlad Tsyrklevich [Tue, 26 Jun 2018 20:21:33 +0000 (20:21 +0000)]
Fix test broken by r335644
llvm-svn: 335657
Tatyana Krasnukha [Tue, 26 Jun 2018 20:08:05 +0000 (20:08 +0000)]
Amend "Change AddressClass type from 'enum' to 'enum class'".
r335599 changes usages of AddressClass, but doesn't change the type itself.
llvm-svn: 335656
Brian Gesiak [Tue, 26 Jun 2018 20:05:18 +0000 (20:05 +0000)]
[AST] Fix typo in LazyOffsetPtr::get docs (NFC)
llvm-svn: 335655
Stanislav Mekhanoshin [Tue, 26 Jun 2018 20:04:19 +0000 (20:04 +0000)]
[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
llvm-svn: 335654
John Baldwin [Tue, 26 Jun 2018 19:48:05 +0000 (19:48 +0000)]
[mips] Use more conservative default CPUs for MIPS on FreeBSD.
FreeBSD defaults to mips3 for all MIPS ABIs with GCC as that is the
minimum MIPS architecture FreeBSD supports. Use mips3 for MIPS64 and
mips2 for MIPS32 to match.
Reviewed By: atanasyan
Differential Revision: https://reviews.llvm.org/D48499
llvm-svn: 335653
Sanjay Patel [Tue, 26 Jun 2018 19:46:56 +0000 (19:46 +0000)]
[DAGCombiner] use isBitwiseNot to simplify code; NFC
llvm-svn: 335652
Sean Fertile [Tue, 26 Jun 2018 19:38:18 +0000 (19:38 +0000)]
[PPC64] Thread-local storage general-dynamic to initial-exec relaxation.
Patch adds support for relaxing the general-dynamic tls sequence to
initial-exec.
the relaxation performs the following transformation:
addis r3, r2, x@got@tlsgd@ha --> addis r3, r2, x@got@tprel@ha
addi r3, r3, x@got@tlsgd@l --> ld r3, x@got@tprel@l(r3)
bl __tls_get_addr(x@tlsgd) --> nop
nop --> add r3, r3, r13
and instead of emitting a DTPMOD64/DTPREL64 pair for x, we emit a single
R_PPC64_TPREL64.
Differential Revision: https://reviews.llvm.org/D48090
llvm-svn: 335651
Matt Arsenault [Tue, 26 Jun 2018 19:10:00 +0000 (19:10 +0000)]
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.
llvm-svn: 335650
Matt Arsenault [Tue, 26 Jun 2018 18:55:43 +0000 (18:55 +0000)]
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)
llvm-svn: 335649
Vedant Kumar [Tue, 26 Jun 2018 18:55:26 +0000 (18:55 +0000)]
Use a variable to appease a no-asserts bot, NFC
Failure URL:
http://lab.llvm.org:8011/builders/lld-x86_64-darwin13/builds/22836
llvm-svn: 335648
Vedant Kumar [Tue, 26 Jun 2018 18:54:10 +0000 (18:54 +0000)]
[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>.
llvm-svn: 335647
Tim Shen [Tue, 26 Jun 2018 18:54:10 +0000 (18:54 +0000)]
[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
llvm-svn: 335646
Matt Arsenault [Tue, 26 Jun 2018 18:51:17 +0000 (18:51 +0000)]
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.
llvm-svn: 335645
Vlad Tsyrklevich [Tue, 26 Jun 2018 18:51:04 +0000 (18:51 +0000)]
CFI: Print DSO names for failed cross-DSO icalls
Reviewers: pcc
Reviewed By: pcc
Subscribers: kubamracek, delcypher, llvm-commits, kcc, #sanitizers
Differential Revision: https://reviews.llvm.org/D48583
llvm-svn: 335644
Vedant Kumar [Tue, 26 Jun 2018 18:44:53 +0000 (18:44 +0000)]
[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.
llvm-svn: 335643
Vedant Kumar [Tue, 26 Jun 2018 18:44:52 +0000 (18:44 +0000)]
[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.
llvm-svn: 335642
Brendon Cahoon [Tue, 26 Jun 2018 18:44:05 +0000 (18:44 +0000)]
[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
llvm-svn: 335641
Matt Morehouse [Tue, 26 Jun 2018 18:37:37 +0000 (18:37 +0000)]
[libFuzzer] Do not turn unittest warnings into errors.
Some warnings originating from googletest were causing bots to fail
while bulding unit tests. The sanitizers address this issue by not
using -Werror. We adopt this approach for libFuzzer.
llvm-svn: 335640
Matt Morehouse [Tue, 26 Jun 2018 18:37:09 +0000 (18:37 +0000)]
[libFuzzer] Mark several tests UNSUPPORTED for aarch64.
Now that check-fuzzer runs as part of check-all, some aarch64 bots had
tests failing.
llvm-svn: 335639
Volodymyr Sapsai [Tue, 26 Jun 2018 17:56:48 +0000 (17:56 +0000)]
[Sema] Fix infinite typo correction loop.
NumTypos guard value ~0U doesn't prevent from creating new delayed typos. When
you create new delayed typos during typo correction, value ~0U wraps around to
0. When NumTypos is 0 we can miss some typos and treat an expression as it can
be typo-corrected. But if the expression is still invalid after correction, we
can get stuck in infinite loop trying to correct it.
Fix by not using value ~0U so that NumTypos correctly reflects the number of
typos.
rdar://problem/
38642201
Reviewers: arphaman, majnemer, rsmith
Reviewed By: rsmith
Subscribers: rsmith, nicholas, cfe-commits
Differential Revision: https://reviews.llvm.org/D47341
llvm-svn: 335638
Simon Pilgrim [Tue, 26 Jun 2018 17:46:51 +0000 (17:46 +0000)]
[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.
llvm-svn: 335637
Peter Collingbourne [Tue, 26 Jun 2018 17:45:26 +0000 (17:45 +0000)]
Compile CodeGenModule.cpp with /bigobj.
Apparently we're now hitting an object file section limit on this
file with expensive checks enabled.
llvm-svn: 335636
Fangrui Song [Tue, 26 Jun 2018 17:44:23 +0000 (17:44 +0000)]
Move `REQUIRES:` line to the top
llvm-svn: 335635
Aaron Enye Shi [Tue, 26 Jun 2018 17:40:36 +0000 (17:40 +0000)]
[HIP] Remove hip/hc.amdgcn.bc from HIP Toolchains
Summary:
The hc.amdgcn.bc and hip.amdgcn.bc are removed in VDI build and no longer needed.
Reviewers: yaxunl
Reviewed By: yaxunl
Subscribers: cfe-commits
Differential Revision: https://reviews.llvm.org/D48455
llvm-svn: 335634
Sanjay Patel [Tue, 26 Jun 2018 17:31:38 +0000 (17:31 +0000)]
[InstSimplify] fold shifts by sext bool
https://rise4fun.com/Alive/c3Y
llvm-svn: 335633
Alexey Bataev [Tue, 26 Jun 2018 17:24:03 +0000 (17:24 +0000)]
[OPENMP, NVPTX] Reduce the number of the globalized variables.
Patch tries to make better analysis of the variables that should be
globalized. From now, instead of all parallel directives it will check
only distribute parallel .. directives and check only for
firstprivte/lastprivate variables if they must be globalized.
llvm-svn: 335632
Sanjay Patel [Tue, 26 Jun 2018 17:15:07 +0000 (17:15 +0000)]
[InstSimplify] add tests for shifts by sext bool; NFC
llvm-svn: 335631
Aaron Enye Shi [Tue, 26 Jun 2018 17:12:29 +0000 (17:12 +0000)]
[Test] Initial test commit access
llvm-svn: 335630
Simon Pilgrim [Tue, 26 Jun 2018 17:06:05 +0000 (17:06 +0000)]
[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)
llvm-svn: 335629
Francis Visoiu Mistrih [Tue, 26 Jun 2018 17:05:01 +0000 (17:05 +0000)]
Revert "[CMake][Darwin] Match cxx-headers -> cxx_headers libcxx target rename."
This reverts commit r334550. Try to fix the stage2 build failing on
Green Dragon for a while.
http://green.lab.llvm.org/green/job/clang-stage2-Rthinlto/11124/console
llvm-svn: 335628
Fangrui Song [Tue, 26 Jun 2018 17:04:47 +0000 (17:04 +0000)]
[ELF] Assign RF_EXEC rank even if --no-rosegment or SECTIONS command is used
Summary:
Currently when --no-rosegment is specified or a linker script with SECTIONS command is used,
.rodata (A) .text (AX) are assigned the same rank and .rodata may be placed after .text .
This increases the gap between .text and .bss and can cause pc-relative relocation overflow (e.g. gcc crtbegin.o crtbegin.S have R_X86_64_PC32 relocation from .text to .bss).
This patch makes SingleRoRx affect only segment layout, not section layout. As a consequence, .rodata will be placed before .text regardless of SingleRoRx.
Reviewers: espindola, ruiu, grimar, echristo, javed.absar
Subscribers: emaste, arichardson, llvm-commits
Differential Revision: https://reviews.llvm.org/D48405
llvm-svn: 335627
Simon Pilgrim [Tue, 26 Jun 2018 17:00:43 +0000 (17:00 +0000)]
Fix -Wdocumentation warning. NFCI.
llvm-svn: 335626
Fangrui Song [Tue, 26 Jun 2018 16:58:19 +0000 (16:58 +0000)]
[ELF] Move `# REQUIRES:` line to the top
llvm-svn: 335625
Marc-Andre Laperle [Tue, 26 Jun 2018 16:57:44 +0000 (16:57 +0000)]
[clangd] Simplify matches in FindSymbols tests
Summary:
Instead of checking symbol name and container (scope) separately, check the
qualified name instead. This is much shorter and similar to how it is done
in the SymbolCollector tests.
Signed-off-by: Marc-Andre Laperle <marc-andre.laperle@ericsson.com>
Reviewers: simark
Subscribers: ilya-biryukov, ioeric, MaskRay, jkorous, cfe-commits
Differential Revision: https://reviews.llvm.org/D47847
llvm-svn: 335624
Sanjay Patel [Tue, 26 Jun 2018 16:39:29 +0000 (16:39 +0000)]
[InstCombine] simplify code for urem fold; NFCI
llvm-svn: 335623
Sanjay Patel [Tue, 26 Jun 2018 16:30:00 +0000 (16:30 +0000)]
[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
llvm-svn: 335622
Simon Pilgrim [Tue, 26 Jun 2018 16:20:16 +0000 (16:20 +0000)]
[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
llvm-svn: 335621
Kostya Kortchinsky [Tue, 26 Jun 2018 16:14:35 +0000 (16:14 +0000)]
[Driver] Do not add -lpthread & -lrt with -static-libsan on Android
Summary:
I am not sure anyone has tried to compile an application with sanitizers on
Android with `-static-libsan`, and a recent NDK, but it fails with:
```
.../i686-linux-android/bin/ld.gold: error: cannot find -lpthread
.../i686-linux-android/bin/ld.gold: error: cannot find -lrt
```
My understanding is that both are included in Bionic and as such are not needed,
and actually error out.
So remove the addition of those two in `linkSanitizerRuntimeDeps` when dealing
with Android, and update the tests.
I am unfamiliar with the evolution of the NDK and I am not sure if this has
always been the case or if this is somewhat of a recent evolution. I'll let
Android people chime in.
Reviewers: eugenis, pirama, srhines
Reviewed By: eugenis, srhines
Subscribers: cfe-commits
Differential Revision: https://reviews.llvm.org/D48570
llvm-svn: 335620
Sanjay Patel [Tue, 26 Jun 2018 16:01:24 +0000 (16:01 +0000)]
[InstCombine] add tests for urem with sext bool divisor; NFC
llvm-svn: 335619
Teresa Johnson [Tue, 26 Jun 2018 15:50:34 +0000 (15:50 +0000)]
[ThinLTO] Add testing of summary index parsing to a couple CFI tests
Summary:
Changes to some clang side tests to go with the summary parsing patch.
Depends on D47905.
Reviewers: pcc, dexonsmith, mehdi_amini
Subscribers: inglorion, eraman, cfe-commits, steven_wu
Differential Revision: https://reviews.llvm.org/D47906
llvm-svn: 335618
Simon Pilgrim [Tue, 26 Jun 2018 15:39:16 +0000 (15:39 +0000)]
[DAGCombiner] Pull out VT bitwidth in visitSDIV. NFCI.
llvm-svn: 335617
Sanjay Patel [Tue, 26 Jun 2018 15:32:54 +0000 (15:32 +0000)]
[InstSimplify] fold srem with sext bool divisor
llvm-svn: 335616
James Henderson [Tue, 26 Jun 2018 15:29:09 +0000 (15:29 +0000)]
Fix doc title underlining.
llvm-svn: 335615
Simon Pilgrim [Tue, 26 Jun 2018 15:20:20 +0000 (15:20 +0000)]
Avoid spurious 'comma operator within array index expression' MSVC warning. NFCI.
Split the braces list initialization from the [] map operator to keep MSVC happy.
llvm-svn: 335614
James Henderson [Tue, 26 Jun 2018 15:15:45 +0000 (15:15 +0000)]
[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
llvm-svn: 335613
Pavel Labath [Tue, 26 Jun 2018 15:12:20 +0000 (15:12 +0000)]
Represent invalid UUIDs as UUIDs with length zero
Summary:
During the previous attempt to generalize the UUID class, it was
suggested that we represent invalid UUIDs as length zero (previously, we
used an all-zero UUID for that). This meant that some valid build-ids
could not be represented (it's possible however unlikely that a checksum of
some file would be zero) and complicated adding support for variable
length build-ids (should a 16-byte empty UUID compare equal to a 20-byte
empty UUID?).
This patch resolves these issues by introducing a canonical
representation for an invalid UUID. The slight complication here is that
some clients (MachO) actually use the all-zero notation to mean "no UUID
has been set". To keep this use case working (while making it very
explicit about which construction semantices are wanted), replaced the
UUID constructors and the SetBytes functions with named factory methods.
- "fromData" creates a UUID from the given data, and it treats all bytes
equally.
- "fromOptionalData" first checks the data contents - if all bytes are
zero, it treats this as an invalid/empty UUID.
Reviewers: clayborg, sas, lemo, davide, espindola
Subscribers: emaste, lldb-commits, arichardson
Differential Revision: https://reviews.llvm.org/D48479
llvm-svn: 335612
Krzysztof Parzyszek [Tue, 26 Jun 2018 14:55:04 +0000 (14:55 +0000)]
Silence "unused variable" warning in LiveIntervals.cpp after r335607
llvm-svn: 335610
Sanjay Patel [Tue, 26 Jun 2018 14:47:31 +0000 (14:47 +0000)]
[InstSimplify] add tests for srem with sext bool divisor; NFC
llvm-svn: 335609
Nico Weber [Tue, 26 Jun 2018 14:42:48 +0000 (14:42 +0000)]
Fix LLVM_ENABLE_THREADS=0 builds after r335440.
llvm-svn: 335608
Krzysztof Parzyszek [Tue, 26 Jun 2018 14:37:16 +0000 (14:37 +0000)]
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.
llvm-svn: 335607
Michael Kruse [Tue, 26 Jun 2018 14:29:09 +0000 (14:29 +0000)]
[ZoneAlgo] Use getDefToTarget in makeValInst. NFC.
Move the optimized getDefToTarget() from ForwardOpTree to ZoneAlgo such
that it can be used by makeValInst.
This reduces the compile time of GrTestUtils of the aosp buildbot from
2m46s to 21s, which should fix the timeout issue.
Differential Revision: https://reviews.llvm.org/D48579
llvm-svn: 335606
Simon Pilgrim [Tue, 26 Jun 2018 14:15:31 +0000 (14:15 +0000)]
[TargetLowering] isVectorClearMaskLegal - use ArrayRef<int> instead of const SmallVectorImpl<int>&
This is more generic and matches isShuffleMaskLegal.
Differential Revision: https://reviews.llvm.org/D48591
llvm-svn: 335605
Than McIntosh [Tue, 26 Jun 2018 14:11:30 +0000 (14:11 +0000)]
[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
llvm-svn: 335604
Simon Pilgrim [Tue, 26 Jun 2018 14:06:23 +0000 (14:06 +0000)]
Fix spelling mistakes in comments. NFCI.
llvm-svn: 335603
Teresa Johnson [Tue, 26 Jun 2018 13:56:49 +0000 (13:56 +0000)]
[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
llvm-svn: 335602
Gabor Marton [Tue, 26 Jun 2018 13:44:24 +0000 (13:44 +0000)]
[ASTImporter] Use InjectedClassNameType at import of templated record.
Summary:
At import of a record describing a template set its type to
InjectedClassNameType (instead of RecordType).
Reviewers: a.sidorin, martong, r.stahl
Reviewed By: a.sidorin, martong, r.stahl
Subscribers: a_sidorin, rnkovacs, martong, cfe-commits
Differential Revision: https://reviews.llvm.org/D47450
Patch by Balazs Keri!
llvm-svn: 335600
Tatyana Krasnukha [Tue, 26 Jun 2018 13:06:54 +0000 (13:06 +0000)]
Change AddressClass type from 'enum' to 'enum class'.
If we have a function with signature f(addr_t, AddressClass), it is easy to muddle up the order of arguments without any warnings from compiler. 'enum class' prevents passing integer in place of AddressClass and vice versa.
llvm-svn: 335599
Eric Liu [Tue, 26 Jun 2018 12:49:09 +0000 (12:49 +0000)]
[clangd] Use default clang-format styles.
llvm-svn: 335598
Sanjay Patel [Tue, 26 Jun 2018 12:41:15 +0000 (12:41 +0000)]
[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.
llvm-svn: 335597
Tim Northover [Tue, 26 Jun 2018 12:28:47 +0000 (12:28 +0000)]
ARM: add binary file git swallowed.
Should fix bots.
llvm-svn: 335596
Krasimir Georgiev [Tue, 26 Jun 2018 12:00:14 +0000 (12:00 +0000)]
[clang-format] Enable text proto formatting in common functions
Subscribers: cfe-commits
Differential Revision: https://reviews.llvm.org/D48363
llvm-svn: 335595
Tim Northover [Tue, 26 Jun 2018 11:39:20 +0000 (11:39 +0000)]
ARM: correctly decode VFP instructions following unpredictable t2IT
When the condition code for an IT instruction is "AL" we get strange "15"
predicates on subsequent instructions. These are dealt with for most
instructions by treating them as "ARMCC::AL", but VFP takes a different path
which didn't have this code.
llvm-svn: 335594
Tim Northover [Tue, 26 Jun 2018 11:38:41 +0000 (11:38 +0000)]
ARM: diagnose unpredictable IT instructions
IT instructions are allowed to have the 'AL' predicate, but it must never
result in an 'NV' predicated instruction. Essentially this means that all
branches must be 't' rather than 'e' if the predicate is 'AL'.
This patch adds a diagnostic for this during assembly (error because parsing
hits an assertion if allowed to continue) and an annotation during disassembly.
llvm-svn: 335593
Andrea Di Biagio [Tue, 26 Jun 2018 11:00:21 +0000 (11:00 +0000)]
[llvm-mca] Removed wrong NDEBUG guards introduced by my last commit.
This partially reverts r335589.
llvm-svn: 335592
Clement Courbet [Tue, 26 Jun 2018 10:52:41 +0000 (10:52 +0000)]
[llvm-exegesis][NFC] Fix windows warning in rL335465.
llvm-svn: 335591
Simon Pilgrim [Tue, 26 Jun 2018 10:45:41 +0000 (10:45 +0000)]
[X86] Just use ArrayRef instead of SmallVectorImpl in a few static method arguments. NFCI.
llvm-svn: 335590
Andrea Di Biagio [Tue, 26 Jun 2018 10:44:12 +0000 (10:44 +0000)]
[llvm-mca] Remove unused header files and correctly guard some include headers under NDEBUG. NFC
llvm-svn: 335589
Florian Hahn [Tue, 26 Jun 2018 10:15:02 +0000 (10:15 +0000)]
[IPSCCP] Change dead blocks to unreachable after visiting all executable blocks.
changeToUnreachable may remove PHI nodes from executable blocks we found values
for and we would fail to replace them. By changing dead blocks to unreachable after
we replaced constants in all executable blocks, we ensure such PHI nodes are replaced
by their known value before.
Fixes PR37780.
Reviewers: efriedma, davide
Reviewed By: efriedma
Differential Revision: https://reviews.llvm.org/D48421
llvm-svn: 335588
Simon Pilgrim [Tue, 26 Jun 2018 10:02:12 +0000 (10:02 +0000)]
Fix MSVC "signed/unsigned mismatch" warning. NFCI.
llvm-svn: 335587
Bernard Ogden [Tue, 26 Jun 2018 09:49:31 +0000 (09:49 +0000)]
[AArch64] Tighten up directives tests
Move expected-fail cases from directive-cpu.s to
directive-cpu-err.s. This allows us to remove the 'not' from the
llvm-mc invocation in directive-cpu.s so that this test will fail
in unexpected error cases. It also means that we are not relying
on all stderr coming before any stdout, which seems fragile.
Also make use of CHECK-NEXT to ensure that multiline error messages
really are occuring together.
And add a test to verify that .cpu with an arch version as extension
is rejected.
Differential Revision: https://reviews.llvm.org/D47873
llvm-svn: 335586
Bernard Ogden [Tue, 26 Jun 2018 09:36:13 +0000 (09:36 +0000)]
[AArch64] Clean up LSE directive tests
These were specifying an architecture version with .cpu directive,
which is invalid. As the error for this case outputs the problem
instruction we were still matching the expectations of FileCheck.
This patch fixes up the LSE tests to do what they seem to intend. A
follow-up patch will tighten up the directive tests.
Differential Revision: https://reviews.llvm.org/D47872
llvm-svn: 335585
Simon Pilgrim [Tue, 26 Jun 2018 09:31:18 +0000 (09:31 +0000)]
Fix MSVC "not all control paths return a value" warnings. NFCI.
llvm-svn: 335584
George Rimar [Tue, 26 Jun 2018 08:50:09 +0000 (08:50 +0000)]
[ELF] - Change the way of sorting local symbols.
rLLD329787 added the stable sorting to SymbolTableBaseSection::postThunkContents.
I profiled the Mozilla (response-O0.txt) from lld-speed-test package and found
std::stable_sort is showing up in profile results and consuming the 3.1% of the total
CPU time in the RelWithDebug build. Total time of postThunkContents is 3.54%, 238ms.
This change reduces postTimeContents time to 50ms, making it to take 0.73% of Total CPU time.
So, instead of sorting the local part I suggest to just rebuild it.
That is what this patch does.
Differential revision: https://reviews.llvm.org/D45519
llvm-svn: 335583
Clement Courbet [Tue, 26 Jun 2018 08:49:30 +0000 (08:49 +0000)]
[llvm-exegesis] Get the BenchmarkRunner from the ExegesisTarget.
Summary:
This allows targets to override code generation for some instructions.
As an example of override, this also moves ad-hoc instruction filtering
for X86 into the X86 ExegesisTarget.
Reviewers: gchatelet
Subscribers: mgorny, tschuett, llvm-commits
Differential Revision: https://reviews.llvm.org/D48587
llvm-svn: 335582
Andrei Elovikov [Tue, 26 Jun 2018 07:05:08 +0000 (07:05 +0000)]
[NFC] Prefer (void) to LLVM_ATTRIBUTE_UNUSED for unused var in GlobalISElemitter.cpp.
Reviewers: dsanders, craig.topper
Reviewed By: dsanders
Subscribers: rovka, kristof.beyls, llvm-commits
Differential Revision: https://reviews.llvm.org/D48534
llvm-svn: 335581
Bjorn Pettersson [Tue, 26 Jun 2018 06:17:00 +0000 (06:17 +0000)]
Improve ConvertDebugDeclareToDebugValue
Summary:
This is a follow-up to r334830 and r335031.
In the valueCoversEntireFragment check we now also handle
the situation when there is a variable length array (VLA)
involved, and the length of the array has been reduced to
a constant.
The ConvertDebugDeclareToDebugValue functions that are related
to PHI nodes and load instructions now avoid inserting dbg.value
intrinsics when the value does not, for certain, cover the
variable/fragment that should be described.
In r334830 we assumed that the value always covered the entire
var/fragment and we had assertions in the code to show that
assumption. However, those asserts failed when compiling code
with VLAs, so we removed the asserts in r335031. Now when we
know that the valueCoversEntireFragment check can fail also for
PHI/Load instructions we avoid to insert the faulty dbg.value
intrinsic in such situations. Compared to the Store instruction
scenario we simply drop the dbg.value here (as the variable does
not change its value due to PHI/Load, so an earlier dbg.value
describing the variable should still be valid).
Reviewers: aprantl, vsk, efriedma
Reviewed By: aprantl
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D48547
llvm-svn: 335580
Gil Rapaport [Tue, 26 Jun 2018 05:31:18 +0000 (05:31 +0000)]
[InstCombine] (A + 1) + (B ^ -1) --> A - B
Turn canonicalized subtraction back into (-1 - B) and combine it with (A + 1) into (A - B).
This is similar to the folding already done for (B ^ -1) + Const into (-1 + Const) - B.
Differential Revision: https://reviews.llvm.org/D48535
llvm-svn: 335579
Craig Topper [Tue, 26 Jun 2018 04:53:42 +0000 (04:53 +0000)]
[X86] Don't use getScalarShiftAmountTy to get the immediate type for target specific VSHLDQ/VSRLDQ nodes.
These opcodes have a fixed type of i8 for their immediate and shouldn't have anything to do with the scalar shift amount used by target independent shift nodes.
llvm-svn: 335578
Vedant Kumar [Tue, 26 Jun 2018 03:53:06 +0000 (03:53 +0000)]
Fix an ambiguous overload issue pointed out by MSVC
Log:
http://lab.llvm.org:8011/builders/clang-x64-ninja-win7/builds/11390
llvm-svn: 335577
Dan Gohman [Tue, 26 Jun 2018 03:18:38 +0000 (03:18 +0000)]
[WebAssembly] Fix lowering of varargs functions with non-legal fixed arguments.
CallLoweringInfo's NumFixedArgs field gives the number of fixed arguments
before legalization. The ISD::OutputArg "Outs" array holds legalized
arguments, so when indexing into it to find the non-fixed arguemn, we need
to use the number of arguments after legalization.
Fixes PR37934.
llvm-svn: 335576
Craig Topper [Tue, 26 Jun 2018 03:11:15 +0000 (03:11 +0000)]
[X86] Use XOR for SUB (C, X) during isel if will help fold an immediate
Summary:
Same idea as D48529, but restricted to X86 and done very late to avoid any surprises where subtract might be better for DAG combining.
This seems like the safest way to do this trick. And we consider doing it as a DAG combine later.
Reviewers: spatel, RKSimon
Reviewed By: spatel
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D48557
llvm-svn: 335575
Dan Gohman [Tue, 26 Jun 2018 03:03:41 +0000 (03:03 +0000)]
[WebAssembly] Fix a typo in a comment.
llvm-svn: 335574
Peter Collingbourne [Tue, 26 Jun 2018 02:59:22 +0000 (02:59 +0000)]
Mark mfcall.cpp as UNSUPPORTED: win32.
llvm-svn: 335573
Vedant Kumar [Tue, 26 Jun 2018 02:50:04 +0000 (02:50 +0000)]
[ubsan] Relax nullability-return for blocks with deduced types
When the return type of an ObjC-style block literals is deduced, pick
the candidate type with the strictest nullability annotation applicable
to every other candidate.
This suppresses a UBSan false-positive in situations where a too-strict
nullability would be deduced, despite the fact that the returned value
would be implicitly cast to _Nullable.
rdar://
41317163
llvm-svn: 335572
Vedant Kumar [Tue, 26 Jun 2018 02:50:01 +0000 (02:50 +0000)]
Modernize a function, NFC.
llvm-svn: 335571
Teresa Johnson [Tue, 26 Jun 2018 02:29:08 +0000 (02:29 +0000)]
[ThinLTO] Add string saver onto index for value names
Summary:
Adds a string saver to the ModuleSummaryIndex so it can store value
names in the case of adding a ValueInfo for a GUID when we don't
have the name stored in a Module string table. This is motivated
by the upcoming summary parser patch, where we will read value names
from the summary entry and want to store them, even when a Module
is not available.
Currently this allows us to store the name in the legacy bitcode case,
and I have added a test to show that.
Reviewers: pcc, dexonsmith
Subscribers: mehdi_amini, inglorion, eraman, steven_wu, llvm-commits
Differential Revision: https://reviews.llvm.org/D47842
llvm-svn: 335570
Peter Collingbourne [Tue, 26 Jun 2018 02:15:47 +0000 (02:15 +0000)]
Implement CFI for indirect calls via a member function pointer.
Similarly to CFI on virtual and indirect calls, this implementation
tries to use program type information to make the checks as precise
as possible. The basic way that it works is as follows, where `C`
is the name of the class being defined or the target of a call and
the function type is assumed to be `void()`.
For virtual calls:
- Attach type metadata to the addresses of function pointers in vtables
(not the functions themselves) of type `void (B::*)()` for each `B`
that is a recursive dynamic base class of `C`, including `C` itself.
This type metadata has an annotation that the type is for virtual
calls (to distinguish it from the non-virtual case).
- At the call site, check that the computed address of the function
pointer in the vtable has type `void (C::*)()`.
For non-virtual calls:
- Attach type metadata to each non-virtual member function whose address
can be taken with a member function pointer. The type of a function
in class `C` of type `void()` is each of the types `void (B::*)()`
where `B` is a most-base class of `C`. A most-base class of `C`
is defined as a recursive base class of `C`, including `C` itself,
that does not have any bases.
- At the call site, check that the function pointer has one of the types
`void (B::*)()` where `B` is a most-base class of `C`.
Differential Revision: https://reviews.llvm.org/D47567
llvm-svn: 335569
Craig Topper [Tue, 26 Jun 2018 01:37:02 +0000 (01:37 +0000)]
[X86] Redefine avx512 packed fpclass intrinsics to return a vXi1 mask and implement the mask input argument using an 'and' IR instruction.
This recommits r335562 and 335563 as a single commit.
The frontend will surround the intrinsic with the appropriate marshalling to/from a scalar type to match the sigature of the builtin that software expects.
By exposing the vXi1 type directly in the llvm intrinsic we make it available to optimizers much earlier. This can enable the scalar marshalling code to be optimized away.
llvm-svn: 335568
Teresa Johnson [Tue, 26 Jun 2018 01:32:58 +0000 (01:32 +0000)]
[ThinLTO] Add per-module indexes to combined index consistently
Summary:
Without this change we only add module paths to the combined index when
there is a module hash or at least one global value. Make this more
consistent by adding the module to the index whenever there is a summary
section, and it is a per-module summary (had a MODULE_CODE_SOURCE_FILENAME
record).
Since we will no longer add module paths lazily, add a new interface to get
the module info from the index that asserts it is already added.
Fixes PR37899.
Reviewers: Vlad, pcc
Subscribers: mehdi_amini, inglorion, steven_wu, llvm-commits
Differential Revision: https://reviews.llvm.org/D48511
llvm-svn: 335567
Craig Topper [Tue, 26 Jun 2018 01:31:53 +0000 (01:31 +0000)]
Revert r335562 and 335563 "[X86] Redefine avx512 packed fpclass intrinsics to return a vXi1 mask and implement the mask input argument using an 'and' IR instruction."
These were supposed to have been squashed to a single commit.
llvm-svn: 335566
Lang Hames [Tue, 26 Jun 2018 01:22:29 +0000 (01:22 +0000)]
[ORC] Add a symbolAliases function to the Core APIs.
symbolAliases can be used to define symbol aliases within a VSO.
llvm-svn: 335565
Craig Topper [Tue, 26 Jun 2018 00:44:02 +0000 (00:44 +0000)]
[X86] Redefine avx512 packed fpclass intrinsics to return a vXi1 mask and implement the mask input argument using an 'and' IR instruction.
Additional IR is emitted to convert between scalar and vXi1 type to match the expected software inferface for the builtin that clang exposes.
llvm-svn: 335564
Craig Topper [Tue, 26 Jun 2018 00:43:46 +0000 (00:43 +0000)]
[X86] Redefine avx512 packed fpclass intrinsics to return a vXi1 mask and implement the mask input argument using an 'and' IR instruction.
The frontend will surround the intrinsic with the appropriate marshalling to/from a scalar type to match the sigature of the builtin that software expects.
By exposing the vXi1 type directly in the llvm intrinsic we make it available to optimizers much earlier. This can enable the scalar marshalling code to be optimized away.
llvm-svn: 335563
Craig Topper [Tue, 26 Jun 2018 00:43:34 +0000 (00:43 +0000)]
foo
llvm-svn: 335562
Fangrui Song [Tue, 26 Jun 2018 00:41:49 +0000 (00:41 +0000)]
[gdb] Escape unprintable bytes in SmallString and StringRef
llvm-svn: 335561
Teresa Johnson [Tue, 26 Jun 2018 00:20:49 +0000 (00:20 +0000)]
[ThinLTO] Compute GUID directly from GV when building per-module index
Summary:
I discovered when writing the summary parsing support that the
per-module index builder and writer are computing the GUID from the
value name alone (ignoring the linkage type). This was ok since those
GUID were not emitted in the bitcode, and there are never multiple
conflicting names in a single module.
However, I don't see a reason for making the GUID computation different
for the per-module case. It also makes things simpler on the parsing
side to have the GUID computation consistent. So this patch changes the
summary analysis phase and the per-module summary writer to compute the
GUID using the facility on the GlobalValue.
Reviewers: pcc, dexonsmith
Subscribers: llvm-commits, inglorion
Differential Revision: https://reviews.llvm.org/D47844
llvm-svn: 335560
Artem Dergachev [Mon, 25 Jun 2018 23:55:07 +0000 (23:55 +0000)]
[analyzer] Track null and undef values through expressions with cleanups.
ExprWithCleanups wraps full-expressions that require temporary destructors
and highlights the moment of time in which these destructors need to be called
(i.e., "at the end of the full-expression...").
Such expressions don't necessarily return an object; they may return anything,
including a null or undefined value.
When the analyzer tries to understand where the null or undefined value came
from in order to present better diagnostics to the user, it will now skip
any ExprWithCleanups it encounters and look into the expression itself.
Differential Revision: https://reviews.llvm.org/D48204
llvm-svn: 335559
Eric Christopher [Mon, 25 Jun 2018 23:53:54 +0000 (23:53 +0000)]
Add a warning if someone attempts to add extra section flags to sections
with well defined semantics like .rodata.
llvm-svn: 335558
Tim Shen [Mon, 25 Jun 2018 23:49:20 +0000 (23:49 +0000)]
[APInt] Add helpers for rounding u/sdivs.
Reviewers: sanjoy, craig.topper
Subscribers: jlebar, hiraditya, bixia, llvm-commits
Differential Revision: https://reviews.llvm.org/D48498
llvm-svn: 335557
Jason Molenda [Mon, 25 Jun 2018 23:45:39 +0000 (23:45 +0000)]
A little cleanup in ObjectFileMachO::GetSDKVersion.
This method does one of two things:
1. finds a minimum os deployment version # in a Mach-O load
command and saves the three parts in the m_sdk_version, or
2. finds no valid min os version # load command, pushes a
sentinel value on the m_sdk_version vector so we don't search
the same load commands multiple times.
There was a little bug when we found a load command with
a version of 0.0.0 - the method would not add anything to
the m_sdk_version vector but would declare that a success.
It would not push the sentinel value to the vector.
There was code later in the method which assumed that
the vector always had a sentinel value, at least, and that
code could crash when this method was called back when
evaluating a Swift expression. (these version #'s are
fetched lazily so it wouldn't happen when the object file
was parsed, only when doing an expression that needed
the version #).
<rdar://problem/
41372699>
llvm-svn: 335556