]> granicus.if.org Git - llvm/log
llvm
5 years ago[llvm-objdump] - Cleanup the error reporting.
George Rimar [Wed, 21 Aug 2019 11:07:31 +0000 (11:07 +0000)]
[llvm-objdump] - Cleanup the error reporting.

The error reporting function are not consistent.

Before this change:

* They had inconsistent naming (e.g. 'error' vs 'report_error').
* Some of them reported the object name, others - dont.
* Some of them accepted the case when there was no error. (i.e. error code or Error had a success value).

This patch tries to cleanup it a bit.

It also renames report_error -> reportError, report_warning -> reportWarning
and removes a full stop from messages.

Differential revision: https://reviews.llvm.org/D66418

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369515 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[MIPS GlobalISel] NarrowScalar G_ZEXTLOAD and G_SEXTLOAD
Petar Avramovic [Wed, 21 Aug 2019 09:43:20 +0000 (09:43 +0000)]
[MIPS GlobalISel] NarrowScalar G_ZEXTLOAD and G_SEXTLOAD

NarrowScalar G_ZEXTLOAD and G_SEXTLOAD to s32 for MIPS32.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369512 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[MIPS GlobalISel] NarrowScalar G_ZEXT and G_SEXT
Petar Avramovic [Wed, 21 Aug 2019 09:35:02 +0000 (09:35 +0000)]
[MIPS GlobalISel] NarrowScalar G_ZEXT and G_SEXT

NarrowScalar G_ZEXT and G_SEXT to s32 for MIPS32.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369511 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[MIPS GlobalISel] Consider type1 when legalizing shifts after r351882
Petar Avramovic [Wed, 21 Aug 2019 09:31:29 +0000 (09:31 +0000)]
[MIPS GlobalISel] Consider type1 when legalizing shifts after r351882

r351882 allows different type for shift amount then result and value
being shifted. Fix MIPS Legalizer rules to take r351882 into account.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369510 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[MIPS GlobalISel] NarrowScalar G_TRUNC
Petar Avramovic [Wed, 21 Aug 2019 09:26:39 +0000 (09:26 +0000)]
[MIPS GlobalISel] NarrowScalar G_TRUNC

Add NarrowScalar for G_TRUNC when NarrowTy is half the size of source.
NarrowScalar G_TRUNC to s32 for MIPS32.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369509 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[DebugInfo] Avoid dropping location info across block boundaries
Jeremy Morse [Wed, 21 Aug 2019 09:22:31 +0000 (09:22 +0000)]
[DebugInfo] Avoid dropping location info across block boundaries

LiveDebugValues propagates variable locations between blocks by creating
new DBG_VALUE insts in the successors, then interpreting them when it
passes back through the block at a later time. However, this flushes out
any extra information about the location that LiveDebugValues holds: for
example, connections between variable locations such as discussed in
D65368. And as reported in PR42772 this causes us to lose track of the
fact that a spill-location is actually a spill, not a register location.

This patch fixes that by deferring the creation of propagated DBG_VALUEs
until after propagation has completed: instead location propagation occurs
only by sharing location ID numbers between blocks.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369508 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[AArch64] Update MTE system register encodings
Luke Cheeseman [Wed, 21 Aug 2019 09:09:56 +0000 (09:09 +0000)]
[AArch64] Update MTE system register encodings

The encodings for the system registers TFSRE0_EL1, TFSR_EL1 TFSR_EL2, TFSR_EL3
and TFSR_EL12 have been changed so that they consistently have CRn=5 and CRm=6
as per https://developer.arm.com/docs/ddi0487/latest.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369505 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoBe explicit about Windows coff name trailing character policy
Serge Guelton [Wed, 21 Aug 2019 07:54:42 +0000 (07:54 +0000)]
Be explicit about Windows coff name trailing character policy

It's okay to *not* copy the trailing zero of a windows section/symbol name.
This is compatible with strncpy behavior but gcc doesn't know that and
throws an invalid warning. Encode this behavior in a proper function.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369501 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[NFC] Mark CallTargetComparator() as const to fix libc++ warnings
Raphael Isemann [Wed, 21 Aug 2019 07:39:17 +0000 (07:39 +0000)]
[NFC] Mark CallTargetComparator() as const to fix libc++ warnings

We currently get this warning when compiling with libc++:

/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/set:454:26: warning: the specified comparator type does not provide a const call operator [-Wuser-defined-warnings]
    static_assert(sizeof(__diagnose_non_const_comparator<_Key, _Compare>()), "");
                         ^
llvm-project/llvm/include/llvm/ProfileData/SampleProf.h:193:29: note: in instantiation of template class 'std::__1::set<std::__1::pair<llvm::StringRef, unsigned long long>, llvm::sampleprof::SampleRecord::CallTargetComparator, std::__1::allocator<std::__1::pair<llvm::StringRef, unsigned long long> > >' requested here
  const SortedCallTargetSet getSortedCallTargets() const {
                            ^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/__tree:967:5: note: from 'diagnose_if' attribute on '__diagnose_non_const_comparator<std::__1::pair<llvm::StringRef, unsigned long long>, llvm::sampleprof::SampleRecord::CallTargetComparator>':
    _LIBCPP_DIAGNOSE_WARNING(!std::__invokable<_Compare const&, _Tp const&, _Tp const&>::value,
    ^                        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/__config:1320:21: note: expanded from macro '_LIBCPP_DIAGNOSE_WARNING'
     __attribute__((diagnose_if(__VA_ARGS__, "warning")))
                    ^           ~~~~~~~~~~~
1 warning generated.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369500 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoFix 'fall through' annotation
Vitaly Buka [Wed, 21 Aug 2019 04:05:34 +0000 (04:05 +0000)]
Fix 'fall through' annotation

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369490 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoAutogenerate the shebang lines for tools/opt-viewer
Chris Bieneman [Wed, 21 Aug 2019 01:48:28 +0000 (01:48 +0000)]
Autogenerate the shebang lines for tools/opt-viewer

Summary:
Since these files depend on the built python modules, they need to use
the right python binary to run them. So use configure_file
to set the right shebang line.

Patch By: cbiesinger (Christian Biesinger)

Reviewers: chandlerc, beanz, anemet

Reviewed By: anemet

Subscribers: compnerd, JDevlieghere, mgorny, llvm-commits

Tags: #llvm

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369486 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[AArch64][GlobalISel] Add support for narrowScalar of G_ZEXT
Amara Emerson [Wed, 21 Aug 2019 00:12:37 +0000 (00:12 +0000)]
[AArch64][GlobalISel] Add support for narrowScalar of G_ZEXT

We do this by merging the source with the high bits set to 0.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369480 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoRemove llvm/utils/git/find-rev
Nico Weber [Tue, 20 Aug 2019 23:59:07 +0000 (23:59 +0000)]
Remove llvm/utils/git/find-rev

It assumes git-svn, hasn't been touched in ages, and it's replaced
by llvm-git in llvm/utils/git-svn.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369478 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agogn build: Merge r369467
Nico Weber [Tue, 20 Aug 2019 23:49:12 +0000 (23:49 +0000)]
gn build: Merge r369467

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369476 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[X86] Automatically generate shift tests. NFC
Amaury Sechet [Tue, 20 Aug 2019 23:47:19 +0000 (23:47 +0000)]
[X86] Automatically generate shift tests. NFC

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369475 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoAdd TinyPtrVector support for general pointer-like things.
Andrew Trick [Tue, 20 Aug 2019 23:29:28 +0000 (23:29 +0000)]
Add TinyPtrVector support for general pointer-like things.

In particular, make TinyPtrVector<PtrIntPair<T *, 1>> work. Remove all
unnecessary assumptions that the element type has a formal "null"
representation. The important property to maintain is that
default-constructed element type has the same internal representation
as the default-constructed PointerUnion (all zero bits).

Remove the incorrect recursive behavior from
PointerUnion::isNull. This was never generally correct because it only
recursed over the first type parameter. With variadic templates it's
completely unnecessary.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369473 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoFix assert in XCOFFObjectWriter related to program code csects.
Sean Fertile [Tue, 20 Aug 2019 23:24:47 +0000 (23:24 +0000)]
Fix assert in XCOFFObjectWriter related to program code csects.

Removed code that added program code csects to a collection as part
of addressing review comments, but I failed to update an assert affected
by the change before commiting.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369471 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[Attributor] Liveness for internal functions.
Stefan Stipanovic [Tue, 20 Aug 2019 23:16:57 +0000 (23:16 +0000)]
[Attributor] Liveness for internal functions.

For an internal function, if all its call sites are dead, the body of the function is considered dead.

Reviewers: jdoerfert, uenoku

Subscribers: hiraditya, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369470 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[X86] Autogenerate vec_* tests. NFC
Amaury Sechet [Tue, 20 Aug 2019 23:11:29 +0000 (23:11 +0000)]
[X86] Autogenerate vec_* tests. NFC

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369469 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[Sanitizer] Remove unused functions
Alexandre Ganea [Tue, 20 Aug 2019 22:56:40 +0000 (22:56 +0000)]
[Sanitizer] Remove unused functions

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369468 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[RISCV GlobalISel] Adding initial GlobalISel infrastructure
Daniel Sanders [Tue, 20 Aug 2019 22:53:24 +0000 (22:53 +0000)]
[RISCV GlobalISel] Adding initial GlobalISel infrastructure

Summary:
Add an initial GlobalISel skeleton for RISCV. It can only run ir translator for `ret void`.

Patch by Andrew Wei

Reviewers: asb, sabuasal, apazos, lenary, simoncook, lewis-revill, edward-jones, rogfer01, xiangzhai, rovka, Petar.Avramovic, mgorny, dsanders

Reviewed By: dsanders

Subscribers: pzheng, s.egerton, dsanders, hiraditya, rbar, johnrusso, niosHD, kito-cheng, shiva0217, jrtc27, MaskRay, zzheng, MartinMosbeck, brucehoult, the_o, PkmX, jocewei, psnobl, benna, Jim, llvm-commits

Tags: #llvm

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369467 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[MemorySSA] Make Phi cleanups consistent.
Alina Sbirlea [Tue, 20 Aug 2019 22:47:58 +0000 (22:47 +0000)]
[MemorySSA] Make Phi cleanups consistent.

Summary:
Make Phi cleanups consistent: remove self as a trivial Phi and
recurse to potentially remove other trivial phis.

Reviewers: george.burgess.iv

Subscribers: Prazek, sanjoy.google, llvm-commits

Tags: #llvm

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369466 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[AArch64][GlobalISel] Select logical_imm32 and logical_imm64 patterns
Jessica Paquette [Tue, 20 Aug 2019 22:31:25 +0000 (22:31 +0000)]
[AArch64][GlobalISel] Select logical_imm32 and logical_imm64 patterns

Add a GlobalISel equivalent for the logical_imm32_XFORM and logical_imm64_XFORM
SDNodeXForms in AArch64InstrFormats.td.

- Add select-logical-imm.mir, which contains tests for each imported pattern.

- Update select-pr32733.mir and select-scalar-shift-imm.mir, since they now
select instructions of this form.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369465 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[MemorySSA] Fix existing phis when inserting defs.
Alina Sbirlea [Tue, 20 Aug 2019 22:29:06 +0000 (22:29 +0000)]
[MemorySSA] Fix existing phis when inserting defs.

Summary:
When inserting a new Def, and inserting Phis in the IDF when needed,
also mark the already existing Phis in the IDF as non-optimized, since
these may need fixing as well.
In the test attached, there is a Phi in the IDF that happens to be
trivial, and is wrongfully removed by the call to getLastDef that
follows. This is a valid situation and the existing IDF Phis need to
marked as "may need fixing" as well.
Resolves PR43044.

Reviewers: george.burgess.iv

Subscribers: Prazek, sanjoy.google, llvm-commits

Tags: #llvm

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369464 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoRemove assert with tautological compare from XCOFFObjectWriter.
Sean Fertile [Tue, 20 Aug 2019 22:23:34 +0000 (22:23 +0000)]
Remove assert with tautological compare from XCOFFObjectWriter.

Remove assert of 'Sec->getCSectType() <= 0x07u' added in r369454, since its
always true.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369462 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[AArch64][GlobalISel] Select patterns which use shifted register operands
Jessica Paquette [Tue, 20 Aug 2019 22:18:06 +0000 (22:18 +0000)]
[AArch64][GlobalISel] Select patterns which use shifted register operands

This adds GlobalISel equivalents for the following from AArch64InstrFormats:

- arith_shifted_reg32
- arith_shifted_reg64

And partial support for

- logical_shifted_reg32
- logical_shifted_reg32

The only thing missing for the logical cases is support for rotates. Other than
the missing support, the transformation is identical for the arithmetic shifted
register and the logical shifted register.

Lots of tests here:

- Add select-arith-shifted-reg.mir to show that we correctly select add and
sub instructions which use this pattern.

- Add select-logical-shifted-reg.mir to cover patterns which are not shared
between the arithmetic and logical cases.

- Update addsub-shifted.ll to show that we correctly fold shifts into
adds/subs.

- Update eon.ll to show that we can select the eon instruction by folding xors.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369460 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[DAGCombiner][X86] Teach visitCONCAT_VECTORS to combine (concat_vectors (concat_vecto...
Craig Topper [Tue, 20 Aug 2019 22:12:50 +0000 (22:12 +0000)]
[DAGCombiner][X86] Teach visitCONCAT_VECTORS to combine (concat_vectors (concat_vectors X, Y), undef)) -> (concat_vectors X, Y, undef, undef)

I also had to add a new combine to X86's combineExtractSubvector to prevent a regression.

This helps our vXi1 code see the full concat operation and allow it optimize undef to a zero if there is already a zero in the concat. This helped us use a movzx instead of an AND in some of the tests. In those tests, one concat comes from SelectionDAGBuilder and the second comes from type legalization of v4i1->i4 bitcasts which uses an additional concat. Though these changes weren't my original motivation.

I'm looking at making X86ISelLowering's narrowShuffle emit a concat_vectors instead of an insert_subvector since concat_vectors is more canonical during early DAG combine. This patch helps prevent a regression from my experiments with that.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369459 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoRevert [WinEH] Allocate space in funclets stack to save XMM CSRs
Reid Kleckner [Tue, 20 Aug 2019 22:08:57 +0000 (22:08 +0000)]
Revert [WinEH] Allocate space in funclets stack to save XMM CSRs

This reverts r367088 (git commit 9ad565f70ec5fd3531056d7c939302d4ea970c83)

And the follow up fix r368631 / e9865b9b31bb2e6bc742dc6fca8f9f9517c3c43e

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369457 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoTeach GlobalISelEmitter to treat used iPTRAny operands as pointer operands
Jessica Paquette [Tue, 20 Aug 2019 22:04:10 +0000 (22:04 +0000)]
Teach GlobalISelEmitter to treat used iPTRAny operands as pointer operands

Overloaded intrinsics can use iPTRAny in used/input operands.

The GlobalISelEmitter doesn't know that these are pointers, so it treats them
as scalars. As a result, these intrinsics can't be imported.

This teaches the GlobalISelEmitter to recognize these as pointers rather than
scalars.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369455 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoAdds support for writing the .bss section for XCOFF object files.
Sean Fertile [Tue, 20 Aug 2019 22:03:18 +0000 (22:03 +0000)]
Adds support for writing the .bss section for XCOFF object files.

Adds Wrapper classes for MCSymbol and MCSection into the XCOFF target
object writer. Also adds a class to represent the top-level sections, which we
materialize in the ObjectWriter.

executePostLayoutBinding will map all csects into the appropriate
container depending on its storage mapping class, and map all symbols
into their containing csect. Once all symbols have been processed we
- Assign addresses and symbol table indices.
- Calaculte section sizes.
- Build the section header table.
- Assign the sections raw-pointer value for non-virtual sections.

Since the .bss section is virtual, writing the header table is enough to
add support. Writing of a sections raw data, or of any relocations is
not included in this patch.

Testing is done by dumping the section header table, but it needs to be
extended to include dumping the symbol table once readobj support for
dumping auxiallary entries lands.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369454 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[InstCombine] add more extra use tests for icmp with extends; NFC
Sanjay Patel [Tue, 20 Aug 2019 21:23:28 +0000 (21:23 +0000)]
[InstCombine] add more extra use tests for icmp with extends; NFC

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369447 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[Attributor] Remove unused variable. NFC.
Michael Liao [Tue, 20 Aug 2019 21:02:31 +0000 (21:02 +0000)]
[Attributor] Remove unused variable. NFC.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369444 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[test] Fix tests when run on windows after SVN r369426. NFC.
Martin Storsjo [Tue, 20 Aug 2019 20:58:02 +0000 (20:58 +0000)]
[test] Fix tests when run on windows after SVN r369426. NFC.

When running tests on windows, invoking "llc -march=<arch>" will
implicitly use windows as the target os, making these tests misbehave
after this change.

Fix the issue by using more specific -mtriple values instead of plain
-march in these tests.

This should hopefully fix buildbot failures like
http://lab.llvm.org:8011/builders/clang-x64-windows-msvc/builds/9816.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369443 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[AutoFDO] Make call targets order deterministic for sample profile
Wenlei He [Tue, 20 Aug 2019 20:52:00 +0000 (20:52 +0000)]
[AutoFDO] Make call targets order deterministic for sample profile

Summary:
StringMap is used for storing call target to frequency map for AutoFDO. However the iterating order of StringMap is non-deterministic, which leads to non-determinism in AutoFDO profile output. Now new API getSortedCallTargets and SortCallTargets are added for deterministic ordering and output.

Roundtrip test for text profile and binary profile is added.

Reviewers: wmi, davidxl, danielcdh

Subscribers: hiraditya, mgrang, llvm-commits, twoh

Tags: #llvm

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369440 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[InstCombine] add tests for mismatched cast ops for icmp; NFC
Sanjay Patel [Tue, 20 Aug 2019 20:51:50 +0000 (20:51 +0000)]
[InstCombine] add tests for mismatched cast ops for icmp; NFC

Motivating case is shown in PR42700:
https://bugs.llvm.org/show_bug.cgi?id=42700

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369439 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[llvm-extract] Update the help message for group extraction feature
Jinsong Ji [Tue, 20 Aug 2019 20:45:16 +0000 (20:45 +0000)]
[llvm-extract] Update the help message for group extraction feature

Summary:
https://reviews.llvm.org/D60973 exposed the group extraction feature of
the BlockExtractor to llvm-extract.
However, the help message was not updated, so users might not be able to
know how to use this feature without looking into history/commits.

This patch just update the help message to show how to use this group
extraction feature.

Reviewers: qcolombet, volkan

Reviewed By: qcolombet

Subscribers: llvm-commits

Tags: #llvm

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369438 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[X86] Add a DAG combine to transform (i8 (bitcast (v8i1 (extract_subvector (v16i1...
Craig Topper [Tue, 20 Aug 2019 20:20:04 +0000 (20:20 +0000)]
[X86] Add a DAG combine to transform (i8 (bitcast (v8i1 (extract_subvector (v16i1 X), 0)))) -> (i8 (trunc (i16 (bitcast (v16i1 X))))) on KNL target

Without AVX512DQ we don't have KMOVB so we can't really copy 8-bits of a k-register to a GPR. We have to copy 16 bits instead. We do this even if the DAG copy is from v8i1->v16i1. If we detect the (i8 (bitcast (v8i1 (extract_subvector (v16i1 X), 0)))) we should rewrite the types to match the copy we do support. By doing this, we can help known bits to propagate without losing the upper 8 bits of the input to the extract_subvector. This allows some zero extends to be removed since we have an isel pattern to use kmovw for (zero_extend (i16 (bitcast (v16i1 X))).

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369434 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[X86] Add isel patterns for (i64 (zext (i8 (bitcast (v16i1 X))))) to use a KMOVW...
Craig Topper [Tue, 20 Aug 2019 19:43:48 +0000 (19:43 +0000)]
[X86] Add isel patterns for (i64 (zext (i8 (bitcast (v16i1 X))))) to use a KMOVW and a SUBREG_TO_REG. Similar for i8 and anyextend.

We already had patterns for extending to i32 to take advantage of
the impliciting zeroing of the upper bits of a 32-bit GPR that is
done by KMOVW/KMOVB. But the extend might be all the way to i64,
in which case the existing patterns would fail and we'd get a
KMOVW/B followed by a MOVZX. By adding patterns for i64 we can
use the fact that KMOVW/B zero the upper bits of the 32-bit GPR
and the normal property that 32-bit GPR writes implicitly zero the
upper 32-bits of the full 64-bit GPR.

The anyextend patterns are slightly different since we don't care
about the upper zeros. For the i8->i64 I think this avoids selecting
the anyextend as a MOVZX to prevent a partial register issue that
doesn't exist. For i16->i64 I think we would have just emitted an
insert_subreg on top of the extract_subreg that the vXi16->i16
bitcast pattern emits. The register coalescer or peephole pass
should combine those, but this saves that work and makes i8/16
consistent.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369431 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[TargetMachine] Don't try to create COFFSTUB references on windows on non-COFF
Martin Storsjo [Tue, 20 Aug 2019 18:58:05 +0000 (18:58 +0000)]
[TargetMachine] Don't try to create COFFSTUB references on windows on non-COFF

This avoids spurious relocation types for windows/elf targets.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369426 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[WebAssembly][lld] Fix crash when applying relocations to debug sections
Sam Clegg [Tue, 20 Aug 2019 18:39:24 +0000 (18:39 +0000)]
[WebAssembly][lld] Fix crash when applying relocations to debug sections

Debug sections are special in that they can contain relocations against
symbols that are not present in the final output (i.e. not live).
However it is also possible to have R_WASM_TABLE_INDEX relocations
against symbols that don't have a table index assigned (since they are
not address taken by actual code.

Fixes: https://github.com/emscripten-core/emscripten/issues/9023
Differential Revision: https://reviews.llvm.org/D66435

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369423 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[InstCombine] add helper function for icmp+zext/sext; NFC
Sanjay Patel [Tue, 20 Aug 2019 18:15:17 +0000 (18:15 +0000)]
[InstCombine] add helper function for icmp+zext/sext; NFC

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369421 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoFix typo in comment. NFCI.
Simon Pilgrim [Tue, 20 Aug 2019 17:54:37 +0000 (17:54 +0000)]
Fix typo in comment. NFCI.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369419 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoRevert "AMDGPU: Fix iterator error when lowering SI_END_CF"
Matt Arsenault [Tue, 20 Aug 2019 17:45:25 +0000 (17:45 +0000)]
Revert "AMDGPU: Fix iterator error when lowering SI_END_CF"

This reverts r367500 and r369203. This is causing various test
failures.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369417 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[X86][BtVer2] Use ReadAfterLd entries for the register operands of CMPXCHG.
Andrea Di Biagio [Tue, 20 Aug 2019 17:05:56 +0000 (17:05 +0000)]
[X86][BtVer2] Use ReadAfterLd entries for the register operands of CMPXCHG.

This is a follow-up of r369365.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369412 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[InstCombine] make fold for icmp with sext more efficient; NFC
Sanjay Patel [Tue, 20 Aug 2019 17:03:22 +0000 (17:03 +0000)]
[InstCombine] make fold for icmp with sext more efficient; NFC

We were creating 2 instructions and relying on a subsequent fold
to invert a not(icmp). Create the final icmp directly instead.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369411 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[X86] Use isNullConstant instead of getConstantOperandVal == 0. NFC
Craig Topper [Tue, 20 Aug 2019 16:55:12 +0000 (16:55 +0000)]
[X86] Use isNullConstant instead of getConstantOperandVal == 0. NFC

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369410 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[CodeGen] Add EarlyIfConvert test missed in previous commit
Thomas Raoux [Tue, 20 Aug 2019 16:34:47 +0000 (16:34 +0000)]
[CodeGen] Add EarlyIfConvert test missed in previous commit

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369405 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[ARM] Select vaddva
Sam Tebbs [Tue, 20 Aug 2019 16:33:34 +0000 (16:33 +0000)]
[ARM] Select vaddva

This patch adds vaddva selection.

Differential revision: https://reviews.llvm.org/D66410

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369404 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[GlobalISel] Handle multiple registers in dbg.value intrinsic
Aditya Nandakumar [Tue, 20 Aug 2019 16:28:37 +0000 (16:28 +0000)]
[GlobalISel] Handle multiple registers in dbg.value intrinsic

https://reviews.llvm.org/D66077

The value passed into dbg.value may relate to multiple registers,
each of which need a DBG_VALUE.

This fix calls MIRBuilder.buildDirectDbgValue for each register.

Without this, IR passed in from flang-compiler/flang may fail an
assertion in getOrCreateVReg.

Patch by : peterwaller-arm.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369403 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agogn build: Merge r369298
Nico Weber [Tue, 20 Aug 2019 16:19:50 +0000 (16:19 +0000)]
gn build: Merge r369298

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369401 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoRegex: Add isValid() with no parameter
Jan Kratochvil [Tue, 20 Aug 2019 16:05:23 +0000 (16:05 +0000)]
Regex: Add isValid() with no parameter

There will be some performance (only a little) improvement for LLDB's
RegularExpression::Execute.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369396 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago [CodeGen] Add a pass to do block predication on SSA machine IR.
Thomas Raoux [Tue, 20 Aug 2019 15:54:59 +0000 (15:54 +0000)]
[CodeGen] Add a pass to do block predication on SSA machine IR.

    For targets requiring aggressive scheduling and/or software pipeline we need to
    apply predication before preRA scheduling. This adds a pass re-using the early
    if-cvt infrastructure but generating predicated instructions instead of
    speculatively executing instructions. It allows doing if conversion on blocks
    containing instructions with side-effects. The pass re-use the target hook from
    postRA if-conversion to let the target decide on the heuristic to apply.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369395 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[llvm-objcopy][test] Add a test to show that argv[0] is included in error/warning...
Fangrui Song [Tue, 20 Aug 2019 15:34:07 +0000 (15:34 +0000)]
[llvm-objcopy][test] Add a test to show that argv[0] is included in error/warning messages

test/llvm-objcopy/ELF/error-format.test is similar to test/llvm-readobj/error-format.test added in D66425.

Reviewed By: grimar, jhenderson

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369392 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[llvm-objcopy] Append '\n' to warning messages
Fangrui Song [Tue, 20 Aug 2019 15:00:07 +0000 (15:00 +0000)]
[llvm-objcopy] Append '\n' to warning messages

Currently the warning message of `llvm-strip %t.o %t.o` does not include
the trailing newline. Fix this by appending a '\n'.

This is the only warning llvm-objcopy and llvm-strip can issue.

Reviewed By: jhenderson

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369391 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[InstCombine] improve readability for icmp with cast folds; NFC
Sanjay Patel [Tue, 20 Aug 2019 14:56:44 +0000 (14:56 +0000)]
[InstCombine] improve readability for icmp with cast folds; NFC

1. Update function name and stale code comments.
2. Use variable names that are less ambiguous.
3. Move operand checks into the function as early exits.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369390 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[BlockExtractor] Avoid assert with wrong line format
Jinsong Ji [Tue, 20 Aug 2019 14:46:02 +0000 (14:46 +0000)]
[BlockExtractor] Avoid assert with wrong line format

Summary:
When the line format is wrong, we may end up accessing out of bound
memory. eg: the test with invalide line will cause assert.
Assertion `idx < size()' failed

The fix is to report fatal when we found mismatched line format.

Reviewers: qcolombet, volkan

Reviewed By: qcolombet

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369389 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[X86][BtVer2] Fix latency and throughput of atomic INC/DEC/NEG/NOT.
Andrea Di Biagio [Tue, 20 Aug 2019 14:31:27 +0000 (14:31 +0000)]
[X86][BtVer2] Fix latency and throughput of atomic INC/DEC/NEG/NOT.

Latency and throughput of LOCK INC/DEC/NEG/NOT is always 19cy.
Number of uOPs is still 1.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369388 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[InstCombine] simplify min/max of min/max with same operands (PR35607)
Sanjay Patel [Tue, 20 Aug 2019 13:39:17 +0000 (13:39 +0000)]
[InstCombine] simplify min/max of min/max with same operands (PR35607)

This is the original integer variant requested in:
https://bugs.llvm.org/show_bug.cgi?id=35607

As noted in the TODO and several similar TODOs around this block,
we could do this in instsimplify, but then it would cost more
because we would be trying to match min/max via ValueTracking
in 2 different places.

There are 4 commuted variants for each of smin/smax/umin/umax
that are not matched here. There are also icmp predicate variants
that are not included in the affected test file because they are
already handled by instsimplify by folding the final icmp to
true/false.

https://rise4fun.com/Alive/3KVc

  Name: smax(smax, smin)
  %c1 = icmp slt i32 %x, %y
  %c2 = icmp slt i32 %y, %x
  %min = select i1 %c1, i32 %x, i32 %y
  %max = select i1 %c2, i32 %x, i32 %y
  %c3 = icmp sgt i32 %max, %min
  %r = select i1 %c3, i32 %max, i32 %min
  =>
  %r = %max

  Name: smin(smax, smin)
  %c1 = icmp slt i32 %x, %y
  %c2 = icmp slt i32 %y, %x
  %min = select i1 %c1, i32 %x, i32 %y
  %max = select i1 %c2, i32 %x, i32 %y
  %c3 = icmp sgt i32 %max, %min
  %r = select i1 %c3, i32 %min, i32 %max
  =>
  %r = %min

  Name: umax(umax, umin)
  %c1 = icmp ult i32 %x, %y
  %c2 = icmp ult i32 %y, %x
  %min = select i1 %c1, i32 %x, i32 %y
  %max = select i1 %c2, i32 %x, i32 %y
  %c3 = icmp ult i32 %min, %max
  %r = select i1 %c3, i32 %max, i32 %min
  =>
  %r = %max

  Name: umin(umax, umin)
  %c1 = icmp ult i32 %x, %y
  %c2 = icmp ult i32 %y, %x
  %min = select i1 %c1, i32 %x, i32 %y
  %max = select i1 %c2, i32 %x, i32 %y
  %c3 = icmp ult i32 %min, %max
  %r = select i1 %c3, i32 %min, i32 %max
  =>
  %r = %min

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369386 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[X86][FMA] Add FMA 'negated expression' combine tests for D63141
Simon Pilgrim [Tue, 20 Aug 2019 13:25:55 +0000 (13:25 +0000)]
[X86][FMA] Add FMA 'negated expression' combine tests for D63141

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369384 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoRegex: +regex string lifetime comment
Jan Kratochvil [Tue, 20 Aug 2019 13:25:19 +0000 (13:25 +0000)]
Regex: +regex string lifetime comment

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369383 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[llvm-objdump] - Remove one of `report_error` functions and improve the error reporting.
George Rimar [Tue, 20 Aug 2019 13:19:16 +0000 (13:19 +0000)]
[llvm-objdump] - Remove one of `report_error` functions and improve the error reporting.

One of the report_error functions was taking object::Archive::Child as an
argument. It feels excessive, this patch removes it and introduce a helper
function instead. Also I fixed a "TODO" in this patch what improved the message printed.

Differential revision: https://reviews.llvm.org/D66468

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369382 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[DWARF] Fix reading 64-bit DWARF type units.
Igor Kudrin [Tue, 20 Aug 2019 12:52:32 +0000 (12:52 +0000)]
[DWARF] Fix reading 64-bit DWARF type units.

The type_offset field is 8 bytes long in DWARF64. The patch extends
TypeOffset to uint64_t and fixes its reading. The patch also fixes
checking of TypeOffset bounds as it was inaccurate in DWARF64 case.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369378 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[llvm-readobj] Prepend argv[0] to error/warning messages
Fangrui Song [Tue, 20 Aug 2019 12:49:15 +0000 (12:49 +0000)]
[llvm-readobj] Prepend argv[0] to error/warning messages

Summary:
Currently, we report:

    error: ...

Prepend argv[0] (tool name):

    llvm-readobj: error: ...

This is consistent with most GNU binutils/clang/lld, and gives a bit
more context in a long build log.

Reviewed By: grimar, jhenderson, rupprecht

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369377 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[InstCombine] add tests for min/max with min/max of same operands; NFC
Sanjay Patel [Tue, 20 Aug 2019 12:49:03 +0000 (12:49 +0000)]
[InstCombine] add tests for min/max with min/max of same operands; NFC

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369376 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[RISCV] Implement getExprForFDESymbol to ensure RISCV_32_PCREL is used for the FDE...
Alex Bradbury [Tue, 20 Aug 2019 12:32:31 +0000 (12:32 +0000)]
[RISCV] Implement getExprForFDESymbol to ensure RISCV_32_PCREL is used for the FDE location

Follow binutils in using RISCV_32_PCREL for the FDE initial location. As
explained in the relevant binutils commit
<https://github.com/riscv/riscv-binutils-gdb/commit/a6cbf936e3dce68114d28cdf60d510a3f78a6d40>,
the ADD/SUB pair of relocations is problematic in the presence of linker
relaxation.

This patch has the same end goal as D64715 but includes test changes and
avoids adding a new global VariantKind to MCExpr.h (preferring
RISCVMCExpr VKs like the rest of the RISC-V backend).

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369375 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoRecommit "MemoryBuffer: Add a missing error-check to getOpenFileImpl"
Pavel Labath [Tue, 20 Aug 2019 12:08:52 +0000 (12:08 +0000)]
Recommit "MemoryBuffer: Add a missing error-check to getOpenFileImpl"

This recommits r368977, which was reverted in r369027 due to test
failures in lldb. The cause of this was different behavior of
readNativeFileSlice on windows and unix. These have been addressed in
r369269.

The original commit message was:
In case the function was called with a desired read size *and* the file
was not an "mmap()" candidate, the function was falling back to a
"pread()", but it was failing to check the result of that system call.
This meant that the function would return "success" even though the read
operation failed, and it returned a buffer full of uninitialized memory.

Reviewers: rnk, dblaikie

Subscribers: kristina, llvm-commits

Tags: #llvm

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369370 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[CMake] Update C4324 MSVC warning comment to explain its still broken at VS2019
Simon Pilgrim [Tue, 20 Aug 2019 11:20:05 +0000 (11:20 +0000)]
[CMake] Update C4324 MSVC warning comment to explain its still broken at VS2019

As promised, I've updated the comment for the C4324 MSVC warning that was re-disabled at rL367409 / rG8f823e63e3edf87ab029ba32b68f3eb5d2f392b5 to put it in terms of currently supported VS versions

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369368 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[MCA][X86] Add tests for LOCK variants of standard X86 arithmetic ops
Simon Pilgrim [Tue, 20 Aug 2019 11:13:20 +0000 (11:13 +0000)]
[MCA][X86] Add tests for LOCK variants of standard X86 arithmetic ops

D66424 adds the base support for LOCK so we should be able to add special case support for all these cases in future patches

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369367 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoFix MSVC "result of 32-bit shift implicitly converted to 64 bits" warning. NFCI.
Simon Pilgrim [Tue, 20 Aug 2019 10:25:57 +0000 (10:25 +0000)]
Fix MSVC "result of 32-bit shift implicitly converted to 64 bits" warning. NFCI.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369366 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[X86][Btver2] Fix latency and throughput of CMPXCHG instructions.
Andrea Di Biagio [Tue, 20 Aug 2019 10:23:55 +0000 (10:23 +0000)]
[X86][Btver2] Fix latency and throughput of CMPXCHG instructions.

On Jaguar, CMPXCHG has a latency of 11cy, and a maximum throughput of 0.33 IPC.
Throughput is superiorly limited to 0.33 because of the implicit in/out
dependency on register EAX. In the case of repeated non-atomic CMPXCHG with the
same memory location, store-to-load forwarding occurs and values for sequent
loads are quickly forwarded from the store buffer.

Interestingly, the functionality in LLVM that computes the reciprocal throughput
doesn't seem to know about RMW instructions. That functionality only looks at
the "consumed resource cycles" for the throughput computation. It should be
fixed/improved by a future patch. In particular, for RMW instructions, that
logic should also take into account for the write latency of in/out register
operands.

An atomic CMPXCHG has a latency of ~17cy. Throughput is also limited to
~17cy/inst due to cache locking, which prevents other memory uOPs to start
executing before the "lock releasing" store uOP.

CMPXCHG8rr and CMPXCHG8rm are treated specially because they decode to one less
macro opcode. Their latency tend to be the same as the other RR/RM variants. RR
variants are relatively fast 3cy (but still microcoded - 5 macro opcodes).

CMPXCHG8B is 11cy and unfortunately doesn't seem to benefit from store-to-load
forwarding. That means, throughput is clearly limited by the in/out dependency
on GPR registers. The uOP composition is sadly unknown (due to the lack of PMCs
for the Integer pipes). I have reused the same mix of consumed resource from the
other CMPXCHG instructions for CMPXCHG8B too.
LOCK CMPXCHG8B is instead 18cycles.

CMPXCHG16B is 32cycles. Up to 38cycles when the LOCK prefix is specified. Due to
the in/out dependencies, throughput is limited to 1 instruction every 32 (or 38)
cycles dependeing on whether the LOCK prefix is specified or not.
I wouldn't be surprised if the microcode for CMPXCHG16B is similar to 2x
microcode from CMPXCHG8B. So, I have speculatively set the JALU01 consumption to
2x the resource cycles used for CMPXCHG8B.

The two new hasLockPrefix() functions are used by the btver2 scheduling model
check if a MCInst/MachineInst has a LOCK prefix. Calls to hasLockPrefix() have
been encoded in predicates of variant scheduling classes that describe lat/thr
of CMPXCHG.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369365 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[yaml2obj/obj2yaml][MachO] Fix a test failure in big endian hosts
Seiya Nuta [Tue, 20 Aug 2019 09:58:31 +0000 (09:58 +0000)]
[yaml2obj/obj2yaml][MachO] Fix a test failure in big endian hosts

These section contents are dummy data (0xdeadbeef) and it's endianess
does not matter.

- http://lab.llvm.org:8011/builders/clang-ppc64be-linux/builds/37265

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369360 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[DWARF] Fix DWARFUnit::getDebugInfoSize() for 64-bit DWARF.
Igor Kudrin [Tue, 20 Aug 2019 09:50:44 +0000 (09:50 +0000)]
[DWARF] Fix DWARFUnit::getDebugInfoSize() for 64-bit DWARF.

The calculation there was correct only for DWARF32.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369356 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[yaml2obj/obj2yaml][MachO] Allow setting custom section data
Seiya Nuta [Tue, 20 Aug 2019 08:49:07 +0000 (08:49 +0000)]
[yaml2obj/obj2yaml][MachO] Allow setting custom section data

Reviewers: alexshap, jhenderson, rupprecht

Reviewed By: alexshap, jhenderson

Subscribers: abrachet, hiraditya, llvm-commits

Tags: #llvm

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369348 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[llvm-objcopy][MachO] Fix method names. NFC.
Seiya Nuta [Tue, 20 Aug 2019 08:36:47 +0000 (08:36 +0000)]
[llvm-objcopy][MachO] Fix method names. NFC.

Reviewers: alexshap, rupprecht, jhenderson

Reviewed By: alexshap, rupprecht

Subscribers: jakehehrlich, abrachet, llvm-commits

Tags: #llvm

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369346 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[test/Object] - Move/rewrite 2 more test cases.
George Rimar [Tue, 20 Aug 2019 08:23:57 +0000 (08:23 +0000)]
[test/Object] - Move/rewrite 2 more test cases.

This patch makes a change for test/Object tests responsible
for relocations.

* 2 tests were moved to llvm-readobj/llvm-objdump folders:
Object/elf-reloc-no-sym.test -> tools/llvm-readobj/elf-reloc-no-sym.test
Object/objdump-reloc-shared.test -> tools/llvm-objdump/relocations-in-nonreloc.test

* A prerecompiled binary was removed and these tests were refactored.

Differential revision: https://reviews.llvm.org/D66291

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369342 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[MC] Delete an overload of MCExpr::evaluateKnownAbsolute and its associated hack
Fangrui Song [Tue, 20 Aug 2019 07:42:04 +0000 (07:42 +0000)]
[MC] Delete an overload of MCExpr::evaluateKnownAbsolute and its associated hack

The hack dated back to 2010 (r121076) and was documented by r122144:

  // FIXME: The use if InSet = Addrs is a hack. Setting InSet causes us
  // absolutize differences across sections and that is what the MachO writer
  // uses Addrs for.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369337 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[Attributor] Fix -Wunused-variable in -DLLVM_ENABLE_ASSERTIONS=off builds after r369331
Fangrui Song [Tue, 20 Aug 2019 07:21:43 +0000 (07:21 +0000)]
[Attributor] Fix -Wunused-variable in -DLLVM_ENABLE_ASSERTIONS=off builds after r369331

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369334 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[X86] Add back the -x86-experimental-vector-widening-legalization comand line flag...
Craig Topper [Tue, 20 Aug 2019 06:58:00 +0000 (06:58 +0000)]
[X86] Add back the -x86-experimental-vector-widening-legalization comand line flag and all associated code, but leave it enabled by default

Google is reporting performance issues with the new default behavior
and have asked for a way to switch back to the old behavior while we
investigate and make fixes.

I've restored all of the code that had since been removed and added
additional checks of the command flag onto code paths that are
not otherwise guarded by a check of getTypeAction.

I've also modified the cost model tables to hopefully get us back
to the previous costs.

Hopefully we won't need to support this for very long since we
have no test coverage of the old behavior so we can very easily
break it.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369332 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[Attributor] Create abstract attributes on-demand
Johannes Doerfert [Tue, 20 Aug 2019 06:15:50 +0000 (06:15 +0000)]
[Attributor] Create abstract attributes on-demand

Before, we create the set of abstract attributes initially and then
dealt with the fact hat a lookup could fail, e.g., return a nullptr.
This patch will ensure we always return a valid object from a lookup,
allowing us not only to remove the nullptr checks but also to grow the
set of abstract attributes "in-flight" on-demand.

One can now start from those that have the best chance of improving
performance without the need to specify all they might depend on.

While this introduces some boilerplate, the usage of attributes is much
easier and cleaner now.

Reviewers: uenoku, sstefan1

Subscribers: hiraditya, bollu, llvm-commits

Tags: #llvm

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369331 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[Attributor][NFC] Cleanup statistics code
Johannes Doerfert [Tue, 20 Aug 2019 06:09:56 +0000 (06:09 +0000)]
[Attributor][NFC] Cleanup statistics code

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369330 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[Attributor] Use structured deduction for AADereferenceable
Johannes Doerfert [Tue, 20 Aug 2019 06:08:35 +0000 (06:08 +0000)]
[Attributor] Use structured deduction for AADereferenceable

Summary:
This is analogous to D66128 but for AADereferenceable. We have the logic
concentrated in the floating value updateImpl and we use the combiner
helper classes for arguments and return values.

The regressions will go away with "on-demand" attribute creation.
Improvements are already visible in the existing tests.

Reviewers: uenoku, sstefan1

Subscribers: hiraditya, bollu, jfb, llvm-commits

Tags: #llvm

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369329 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[Attributor] Use structured deduction for AANonNull
Johannes Doerfert [Tue, 20 Aug 2019 06:02:39 +0000 (06:02 +0000)]
[Attributor] Use structured deduction for AANonNull

Summary:
What D66126 did for AAAlign, this patch does for AANonNull. Agian, the
logic becomes more concise and localized. Again, returned poiners are
not annotated properly but that will not be an issue if this lands with
the "on-demand" generation of attributes. First improvements due to the
genericValueTraversal are already visible.

Reviewers: sstefan1, uenoku

Subscribers: hiraditya, bollu, llvm-commits

Tags: #llvm

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369328 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[Attributor] Fix the "clamp" operator
Johannes Doerfert [Tue, 20 Aug 2019 05:57:01 +0000 (05:57 +0000)]
[Attributor] Fix the "clamp" operator

The clamp operator should not take the known of the given state as the
known is potentially based on assumed information. This also adds TODOs
to guide improvements.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369327 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[NFC] Test commit, fix some comment spelling.
Thomas Raoux [Tue, 20 Aug 2019 05:21:27 +0000 (05:21 +0000)]
[NFC] Test commit, fix some comment spelling.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369326 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[AsmPrinter] Remove const qualifier from EmitBasicBlockStart.
Karl-Johan Karlsson [Tue, 20 Aug 2019 05:13:57 +0000 (05:13 +0000)]
[AsmPrinter] Remove const qualifier from EmitBasicBlockStart.

Overriders may want to modify state in it. AMDGPU wants
to, but has to make its members mutable in order to do so.

Besides, EmitBasicBlockEnd is not const, so why should
Start be?

Patch by Bevin Hansson.

Reviewed By: nickdesaulniers

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369325 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoMCAsmMacro: add `#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)` to some dump...
Fangrui Song [Tue, 20 Aug 2019 04:14:43 +0000 (04:14 +0000)]
MCAsmMacro: add `#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)` to some dump() declarations

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369324 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[WebAssembly][MC] Fix -Wunused-variable in -DLLVM_ENABLE_ASSERTIONS=off builds after...
Fangrui Song [Tue, 20 Aug 2019 02:02:57 +0000 (02:02 +0000)]
[WebAssembly][MC] Fix -Wunused-variable in -DLLVM_ENABLE_ASSERTIONS=off builds after r369317

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369318 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[WebAssembly][MC] Simplify WasmObjectWriter::recordRelocation. NFC.
Sam Clegg [Tue, 20 Aug 2019 00:33:50 +0000 (00:33 +0000)]
[WebAssembly][MC] Simplify WasmObjectWriter::recordRelocation. NFC.

WebAssembly doesn't support PC relative relocation or relocation
expressions that can't be reduced to single symbol.

The only support for we have for fixups involving two symbols are when
both symbols are defined and withing the same section.  In this case
evaluateFixup will already have evaluated to the expression before
calling recordRelocation.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369317 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[SLP][NFC] Avoid repetitive calls to getSameOpcode()
Dinar Temirbulatov [Tue, 20 Aug 2019 00:22:04 +0000 (00:22 +0000)]
[SLP][NFC] Avoid repetitive calls to getSameOpcode()

We can avoid repetitive calls getSameOpcode() for already known tree elements by keeping MainOp and AltOp in TreeEntry.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369315 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[cmake] Link in LLVMPasses due to dependency by LLVMOrcJIT; NFC
Hubert Tong [Mon, 19 Aug 2019 23:12:48 +0000 (23:12 +0000)]
[cmake] Link in LLVMPasses due to dependency by LLVMOrcJIT; NFC

Summary:
rL367756 (f5c40cb) increases the dependency of LLVMOrcJIT on LLVMPasses.
In particular, symbols defined in LLVMPasses that are referenced by the
destructor of `PassBuilder` are now referenced by LLVMOrcJIT through
`Speculation.cpp.o`.

We believe that referencing symbols defined in LLVMPasses in the
destructor of `PassBuilder` is valid, and that adding to the set of such
symbols is legitimate. To support such cases, this patch adds LLVMPasses
to the set of libraries being linked when linking in LLVMOrcJIT causes
such symbols from LLVMPasses to be referenced.

Reviewers: Whitney, anhtuyen, pree-jackie

Reviewed By: pree-jackie

Subscribers: mgorny, llvm-commits

Tags: #llvm

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369310 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[lit] Check for accidental external command calls
Joel E. Denny [Mon, 19 Aug 2019 22:59:37 +0000 (22:59 +0000)]
[lit] Check for accidental external command calls

This patch extends lit's test suite to check that lit's internal shell
doesn't accidentally execute internal commands as external commands.
It does so by putting fake failing versions of those commands in
`PATH` while the entire lit test suite is running.  Without the fixes
in D65697 but with its tests, this approach catches accidental
external `env` calls.

Reviewed By: probinson

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369309 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[Support][Time profiler] Make FE codegen blocks to be inside frontend blocks
Anton Afanasyev [Mon, 19 Aug 2019 22:58:26 +0000 (22:58 +0000)]
[Support][Time profiler] Make FE codegen blocks to be inside frontend blocks

Summary:
Add `Frontend` time trace entry to `HandleTranslationUnit()` function.
Add test to check all codegen blocks are inside frontend blocks.
Also, change `--time-trace-granularity` option a bit to make sure very small
time blocks are outputed to json-file when using `--time-trace-granularity=0`.

This fixes http://llvm.org/pr41969

Reviewers: russell.gallop, lebedev.ri, thakis

Reviewed By: russell.gallop

Subscribers: vsapsai, aras-p, lebedev.ri, hiraditya, cfe-commits, llvm-commits

Tags: #clang, #llvm

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369308 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[ORC] fix use-after-free detected by -Wreturn-stack-address
Matthias Gehre [Mon, 19 Aug 2019 21:59:44 +0000 (21:59 +0000)]
[ORC] fix use-after-free detected by -Wreturn-stack-address

Summary:
llvm/lib/ExecutionEngine/Orc/Layer.cpp:53:12: warning: returning address of local temporary object [-Wreturn-stack-address]

In
```
StringRef IRMaterializationUnit::getName() const {
[...]
     return TSM.withModuleDo(
        [](const Module &M) { return M.getModuleIdentifier(); });
```
`getModuleIdentifier()` returns a `const std::string &`, but the implicit return type
of the lambda is `std::string` by value, and thus the returned `StringRef` refers
to a temporary `std::string`.

Detect by annotating `llvm::StringRef` with `[[gsl::Pointer]]`.

Reviewers: lhames, sgraenitz

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369306 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[CaptureTracker] Let subclasses provide dereferenceability information
Johannes Doerfert [Mon, 19 Aug 2019 21:56:38 +0000 (21:56 +0000)]
[CaptureTracker] Let subclasses provide dereferenceability information

Summary:
CaptureTracker subclasses might have better dereferenceability
information which allows null pointer checks to be no-capturing.
The first user will be D59922.

Reviewers: sanjoy, hfinkel, aykevl, sstefan1, uenoku, xbolva00

Subscribers: hiraditya, bollu, llvm-commits

Tags: #llvm

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369305 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoRecommit "[Attributor] Fix: Do not partially resolve returned calls."
Johannes Doerfert [Mon, 19 Aug 2019 21:35:31 +0000 (21:35 +0000)]
Recommit "[Attributor] Fix: Do not partially resolve returned calls."

This reverts commit b1752f670f3d6393306dd5d37546b6e23384d8a2.

Fixed the issue with a different commit, reapply this one as it was,
afaik, not broken.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369303 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoRecommit "[llvm-objcopy][MachO] Implement a layout algorithm for executables"
Seiya Nuta [Mon, 19 Aug 2019 21:12:02 +0000 (21:12 +0000)]
Recommit "[llvm-objcopy][MachO] Implement a layout algorithm for executables"

Summary: The layout algorithm for relocatable objects and for executable are somewhat different. This patch implements the latter one based on the algorithm in LLD (MachOFileLayout).

Reviewers: alexshap, rupprecht, jhenderson

Reviewed By: alexshap

Subscribers: jakehehrlich, abrachet, llvm-commits

Tags: #llvm

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369301 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoRefactor isPointerOffset (NFC).
Evgeniy Stepanov [Mon, 19 Aug 2019 21:08:04 +0000 (21:08 +0000)]
Refactor isPointerOffset (NFC).

Summary:
Simplify the API using Optional<> and address comments in
         https://reviews.llvm.org/D66165

Reviewers: vitalybuka

Subscribers: hiraditya, llvm-commits, ostannard, pcc

Tags: #llvm

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369300 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoFixed placement of llvm.global_dtors on Windows.
Vyacheslav Zakharin [Mon, 19 Aug 2019 21:07:03 +0000 (21:07 +0000)]
Fixed placement of llvm.global_dtors on Windows.

Differential revision: https://reviews.llvm.org/D66373

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369299 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoRecommit "[llvm-objcopy][MachO] Support load commands used in executables/shared...
Seiya Nuta [Mon, 19 Aug 2019 21:05:31 +0000 (21:05 +0000)]
Recommit "[llvm-objcopy][MachO] Support load commands used in executables/shared libraries"

Summary:
This patch implements copying some load commands that appear in executables/shared libraries such as the indirect symbol table.

I don't add tests intentionally because this patch is incomplete: we need a layout algorithm for executables/shared libraries. I'll submit it as a separate patch with tests.

Reviewers: alexshap, rupprecht, jhenderson, compnerd

Reviewed By: alexshap

Subscribers: abrachet, mgorny, mgrang, MaskRay, mtrent, jakehehrlich, llvm-commits

Tags: #llvm

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369298 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoMemTag: stack initializer merging.
Evgeniy Stepanov [Mon, 19 Aug 2019 20:47:09 +0000 (20:47 +0000)]
MemTag: stack initializer merging.

Summary:
MTE provides instructions to update memory tags and data at the same
time. This change makes use of those to generate more compact code for
stack variable tagging + initialization.

We collect memory store and memset instructions following an alloca or a
lifetime.start call, and replace them with the corresponding MTE
intrinsics. Since the intrinsics work on 16-byte aligned chunks, the
stored values are combined as necessary.

Reviewers: pcc, vitalybuka, ostannard

Subscribers: srhines, javed.absar, hiraditya, llvm-commits

Tags: #llvm

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369297 91177308-0d34-0410-b5e6-96231b3b80d8