platform/upstream/llvm.git
4 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

llvm-svn: 369486

4 years ago[NFC] Remove lldb_utility namespace.
Jonas Devlieghere [Wed, 21 Aug 2019 00:50:46 +0000 (00:50 +0000)]
[NFC] Remove lldb_utility namespace.

While generating the Doxygen I noticed this lone namespace that has one
class and one function in it. This moves them into lldb_private.

llvm-svn: 369485

4 years agoUpdate a few tests that may change the platform to save & restore
Jason Molenda [Wed, 21 Aug 2019 00:27:30 +0000 (00:27 +0000)]
Update a few tests that may change the platform to save & restore
the platform in the setUp/tearDown methods.  I want to migrate the
re-instatement of the correct plaform to the setUp base method but
haven't had time to look at that yet, so I want to land this handful
of fixes until I get to it.

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

llvm-svn: 369484

4 years agoFix missing __muloti4 function with UBSAN
Eric Fiselier [Wed, 21 Aug 2019 00:16:33 +0000 (00:16 +0000)]
Fix missing __muloti4 function with UBSAN

llvm-svn: 369483

4 years agoAttempt to fix MSAN failures in benchmarks
Eric Fiselier [Wed, 21 Aug 2019 00:14:48 +0000 (00:14 +0000)]
Attempt to fix MSAN failures in benchmarks

llvm-svn: 369482

4 years agolibcxx: Rename .hpp files in libcxx/test/support to .h
Nico Weber [Wed, 21 Aug 2019 00:14:12 +0000 (00:14 +0000)]
libcxx: Rename .hpp files in libcxx/test/support to .h

LLVM uses .h as its extension for header files.

Files renamed using:

    for f in libcxx/test/support/*.hpp; do git mv $f ${f%.hpp}.h; done

References to the files updated using:

    for f in $(git diff master | grep 'rename from' | cut -f 3 -d ' '); do
        a=$(basename $f);
        echo $a;
        rg -l $a libcxx | xargs sed -i '' "s/$a/${a%.hpp}.h/";
    done

HPP include guards updated manually using:

    for f in $(git diff master | grep 'rename from' | cut -f 3 -d ' '); do
      echo ${f%.hpp}.h ;
    done | xargs mvim

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

llvm-svn: 369481

4 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

llvm-svn: 369480

4 years ago[Doxygen] Document private class members.
Jonas Devlieghere [Wed, 21 Aug 2019 00:10:19 +0000 (00:10 +0000)]
[Doxygen] Document private class members.

Given that the C++ documentation is meant for LLDB developers it makes
sense to include private class members in the output.

llvm-svn: 369479

4 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

llvm-svn: 369478

4 years ago[dotest] Don't set the DWARF version override in CFLAGS_EXTRA.
Jonas Devlieghere [Tue, 20 Aug 2019 23:56:32 +0000 (23:56 +0000)]
[dotest] Don't set the DWARF version override in CFLAGS_EXTRA.

We cannot override the DWARF version in the CFLAGS_EXTRA because they
are used by tests that explicitly build without debug info. Instead, we
pass them through the regular CFLAGS.

llvm-svn: 369477

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

llvm-svn: 369476

4 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

llvm-svn: 369475

4 years agoAdd triple to new test to try to pacify bots
Reid Kleckner [Tue, 20 Aug 2019 23:32:51 +0000 (23:32 +0000)]
Add triple to new test to try to pacify bots

llvm-svn: 369474

4 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.

llvm-svn: 369473

4 years ago[AArch64][asan] fix typo in AsanStats::Print
Sebastian Pop [Tue, 20 Aug 2019 23:28:05 +0000 (23:28 +0000)]
[AArch64][asan] fix typo in AsanStats::Print

This created an infinite loop that timed out several build bots while
executing the test in compiler-rt/test/asan/TestCases/atexit_stats.cpp

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

llvm-svn: 369472

4 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.

llvm-svn: 369471

4 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

llvm-svn: 369470

4 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

llvm-svn: 369469

4 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

llvm-svn: 369468

4 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

llvm-svn: 369467

4 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

llvm-svn: 369466

4 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

llvm-svn: 369465

4 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

llvm-svn: 369464

4 years agoAdd a missing _VSTD:: before a call to merge. Fixes PR43034. Checked the rest of...
Marshall Clow [Tue, 20 Aug 2019 22:23:35 +0000 (22:23 +0000)]
Add a missing _VSTD:: before a call to merge. Fixes PR43034. Checked the rest of 'algorithm' looking for unqualified calls. Didn't find any.

llvm-svn: 369463

4 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.

llvm-svn: 369462

4 years ago[NFC] Fix -Wdocumentation warnings in Utility.
Jonas Devlieghere [Tue, 20 Aug 2019 22:20:46 +0000 (22:20 +0000)]
[NFC] Fix -Wdocumentation warnings in Utility.

This patch fixes a bunch of -Wdocumentation warnings in Utility. I'm
sure there are still a bunch outdated comments left, but this fixes the
most flagrant inconsistencies that the compiler understands.

llvm-svn: 369461

4 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

llvm-svn: 369460

4 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

llvm-svn: 369459

4 years ago[DebugInfo] Add debug location to dynamic atexit destructor
Alexandre Ganea [Tue, 20 Aug 2019 22:09:49 +0000 (22:09 +0000)]
[DebugInfo] Add debug location to dynamic atexit destructor

Fixes PR43012

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

llvm-svn: 369458

4 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

llvm-svn: 369457

4 years ago[Symbol] Move VerifyDecl to ClangASTContext
Alex Langford [Tue, 20 Aug 2019 22:06:13 +0000 (22:06 +0000)]
[Symbol] Move VerifyDecl to ClangASTContext

VerifyDecl is specific to clang and is only used in ClangASTContext.

llvm-svn: 369456

4 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

llvm-svn: 369455

4 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

llvm-svn: 369454

4 years ago[LLDB][Test] Remove `skipIfWindows` for conditional breakpoint test (NFC)
Med Ismail Bennani [Tue, 20 Aug 2019 21:58:22 +0000 (21:58 +0000)]
[LLDB][Test] Remove `skipIfWindows` for conditional breakpoint test (NFC)

Summary:
The test for conditional breakpoints on Windows was skipped because
there was no expression evaluation support at the time it was written.

After removing the annotation and testing it again, the test is passing.
http://lists.llvm.org/pipermail/lldb-dev/2019-August/015405.html

Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
Reviewers: stella.stamenova, jingham

Subscribers: lldb-commits

Tags: #lldb

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

llvm-svn: 369453

4 years ago[NFC] Update RegularExpression documentation
Jonas Devlieghere [Tue, 20 Aug 2019 21:56:49 +0000 (21:56 +0000)]
[NFC] Update RegularExpression documentation

llvm-svn: 369452

4 years ago[analyzer] NFC: Remove the BugTypes set from BugReporter.
Artem Dergachev [Tue, 20 Aug 2019 21:41:20 +0000 (21:41 +0000)]
[analyzer] NFC: Remove the BugTypes set from BugReporter.

Its only purpose was to avoid a bug that's caused by
making a virtual call in BugReporter's destructor.

llvm-svn: 369451

4 years ago[analyzer] Fix a crash when destroying a non-region.
Artem Dergachev [Tue, 20 Aug 2019 21:41:17 +0000 (21:41 +0000)]
[analyzer] Fix a crash when destroying a non-region.

Add defensive check that prevents a crash when we try to evaluate a destructor
whose this-value is a concrete integer that isn't a null.

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

llvm-svn: 369450

4 years ago[analyzer] Improve VirtualCallChecker and enable parts of it by default.
Artem Dergachev [Tue, 20 Aug 2019 21:41:14 +0000 (21:41 +0000)]
[analyzer] Improve VirtualCallChecker and enable parts of it by default.

Calling a pure virtual method during construction or destruction
is undefined behavior. It's worth it to warn about it by default.
That part is now known as the cplusplus.PureVirtualCall checker.

Calling a normal virtual method during construction or destruction
may be fine, but does behave unexpectedly, as it skips virtual dispatch.
Do not warn about this by default, but let projects opt in into it
by enabling the optin.cplusplus.VirtualCall checker manually.

Give the two parts differentiated warning text:

  Before:

    Call to virtual function during construction or destruction:
    Call to pure virtual function during construction

    Call to virtual function during construction or destruction:
    Call to virtual function during destruction

  After:

    Pure virtual method call:
    Call to pure virtual method 'X::foo' during construction
        has undefined behavior

    Unexpected loss of virtual dispatch:
    Call to virtual method 'Y::bar' during construction
        bypasses virtual dispatch

Also fix checker names in consumers that support them (eg., clang-tidy)
because we now have different checker names for pure virtual calls and
regular virtual calls.

Also fix capitalization in the bug category.

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

llvm-svn: 369449

4 years agoFix a couple of unguarded operator, calls in algorithm. Fixes PR#43063. Updated all...
Marshall Clow [Tue, 20 Aug 2019 21:31:51 +0000 (21:31 +0000)]
Fix a couple of unguarded operator, calls in algorithm. Fixes PR#43063. Updated all the heap tests to check this.

llvm-svn: 369448

4 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

llvm-svn: 369447

4 years ago[COFF] Check errorCount before committing the output file
Martin Storsjo [Tue, 20 Aug 2019 21:08:14 +0000 (21:08 +0000)]
[COFF] Check errorCount before committing the output file

This avoids producing an output file if errors appeared late in the
linking process (e.g. while fixing relocations, or as in the test,
while checking for multiple resources). If an output file is produced,
build tools might not retry building it on rebuilds, even if a previous
build failed due to the error return code.

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

llvm-svn: 369445

4 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.

llvm-svn: 369444

4 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.

llvm-svn: 369443

4 years ago[NewPM] Run ubsan-coroutines test under the legacy pass manager only
Leonard Chan [Tue, 20 Aug 2019 20:55:36 +0000 (20:55 +0000)]
[NewPM] Run ubsan-coroutines test under the legacy pass manager only

The passes that lower the llvm.coro.* instrinsics have not yet been ported,
so only run under the legacy PM for now.

See https://bugs.llvm.org/show_bug.cgi?id=42867

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

llvm-svn: 369442

4 years ago[AArch64] Speed-up leak and address sanitizers on AArch64 for 48-bit VMA
Sebastian Pop [Tue, 20 Aug 2019 20:54:05 +0000 (20:54 +0000)]
[AArch64] Speed-up leak and address sanitizers on AArch64 for 48-bit VMA

This patch fixes https://github.com/google/sanitizers/issues/703
On a Graviton-A1 aarch64 machine with 48-bit VMA,
the time spent in LSan and ASan reduced from 2.5s to 0.01s when running

clang -fsanitize=leak compiler-rt/test/lsan/TestCases/sanity_check_pure_c.c && time ./a.out
clang -fsanitize=address compiler-rt/test/lsan/TestCases/sanity_check_pure_c.c && time ./a.out

With this patch, LSan and ASan create both the 32 and 64 allocators and select
at run time between the two allocators following a global variable that is
initialized at init time to whether the allocator64 can be used in the virtual
address space.

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

llvm-svn: 369441

4 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

llvm-svn: 369440

4 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

llvm-svn: 369439

4 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

llvm-svn: 369438

4 years ago[libc++] Fix std::abs tests
Zoe Carver [Tue, 20 Aug 2019 20:44:59 +0000 (20:44 +0000)]
[libc++] Fix std::abs tests

On systems where sizeof(long) == sizeof(int)
the current tests failed. This commit updates
those tests to work on all systems.
std::abs has specific long specializations
which can be used instead.

llvm-svn: 369437

4 years ago[Symbol][NFC] Remove references to clang in TypeMap
Alex Langford [Tue, 20 Aug 2019 20:44:36 +0000 (20:44 +0000)]
[Symbol][NFC] Remove references to clang in TypeMap

llvm-svn: 369436

4 years ago[CMake] Remove LLDB_TEST_USE_CUSTOM_C(XX)_COMPILER
Jonas Devlieghere [Tue, 20 Aug 2019 20:20:20 +0000 (20:20 +0000)]
[CMake] Remove LLDB_TEST_USE_CUSTOM_C(XX)_COMPILER

Given that LLDB_TEST_USE_CUSTOM_C_COMPILER and LLDB_TEST_C_COMPILER are
both set at configuration time, I don't really see the point of having
both. This patch simplifies things and uses the custom C/C++ compiler
when the variable is set, and uses the default one when it's not set.
The variable can be unset by passing -ULLDB_TEST_C_COMPILER to CMake.

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

llvm-svn: 369435

4 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

llvm-svn: 369434

4 years ago[GWP-ASan] Fix typos.
Mitch Phillips [Tue, 20 Aug 2019 20:16:11 +0000 (20:16 +0000)]
[GWP-ASan] Fix typos.

Summary:
Fix two spelling typos and de-indent a guarded #define so that it's
consistent with clang-format.

Reviewers: vitalybuka

Reviewed By: vitalybuka

Subscribers: #sanitizers, llvm-commits

Tags: #sanitizers, #llvm

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

llvm-svn: 369433

4 years ago[OPENMP]Fix delayed diagnostics for standalone declare target directive.
Alexey Bataev [Tue, 20 Aug 2019 19:50:13 +0000 (19:50 +0000)]
[OPENMP]Fix delayed diagnostics for standalone declare target directive.

If the function is marked as declare target in a standalone directive,
the delayed diagnostics is not emitted. Patch fixes this problem.

llvm-svn: 369432

4 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.

llvm-svn: 369431

4 years agoForce honoring nthreads-var and thread-limit-var inside teams construct on host
Jonathan Peyton [Tue, 20 Aug 2019 19:39:17 +0000 (19:39 +0000)]
Force honoring nthreads-var and thread-limit-var inside teams construct on host

This patch fixes https://bugs.llvm.org/show_bug.cgi?id=42906, via adding
adjustment of number of threads on enter to the teams construct on host
according to user settings. This allows to pass checks and avoid assertions
at time of team of threads creation.

Patch by Andrey Churbanov

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

llvm-svn: 369430

4 years ago[libc++] Avoid implicit conversion warning in a <random> test
Louis Dionne [Tue, 20 Aug 2019 19:28:26 +0000 (19:28 +0000)]
[libc++] Avoid implicit conversion warning in a <random> test

By stashing the computation of `E::max() - E::min()` in a variable, we
avoid the warning introduced in r367497. Note that we use `auto` to
avoid having to deduce the type of the computation, which is not a
problem since Clang provides `auto` as an extension even in C++03 (and
we disable warnings related to using C++11 extensions in the test suite).

llvm-svn: 369429

4 years agofix buildbot start script to no longer hang
Eric Fiselier [Tue, 20 Aug 2019 19:06:23 +0000 (19:06 +0000)]
fix buildbot start script to no longer hang

llvm-svn: 369428

4 years ago[Sema][Typo] Fix assertion failure for expressions with multiple typos
David Goldman [Tue, 20 Aug 2019 19:03:15 +0000 (19:03 +0000)]
[Sema][Typo] Fix assertion failure for expressions with multiple typos

Summary:
As Typo Resolution can create new TypoExprs while resolving typos,
it is necessary to recurse through the expression to search for more
typos.

This should fix the assertion failure in `clang::Sema::~Sema()`:
  `DelayedTypos.empty() && "Uncorrected typos!"`

Notes:
- In case some TypoExprs are created but thrown away, Sema
  now has a Vector that is used to keep track of newly created
  typos.
- For expressions with multiple typos, we only give suggestions
  if we are able to resolve all typos in the expression
- This patch is similar to D37521 except that it does not eagerly
  commit to a correction for the first typo in the expression.
  Instead, it will search for corrections which fix all of the
  typos in the expression.

Subscribers: cfe-commits

Tags: #clang

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

llvm-svn: 369427

4 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

llvm-svn: 369426

4 years ago[COFF] Print the file name on errors writing the pdb file
Martin Storsjo [Tue, 20 Aug 2019 18:56:48 +0000 (18:56 +0000)]
[COFF] Print the file name on errors writing the pdb file

This avoids confusing contextless error messages such as "No such file
or directory" if e.g. the pdb output file should be written to a
nonexistent directory. (This can happen with linkrepro scripts, at least
old ones.)

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

llvm-svn: 369425

4 years ago[ClangExpressionParser] Add ClangDeclVendor
Alex Langford [Tue, 20 Aug 2019 18:47:30 +0000 (18:47 +0000)]
[ClangExpressionParser] Add ClangDeclVendor

Summary:
This introduces a layer between DeclVendor and the currently implemented
DeclVendors (ClangModulesDeclVendor and AppleObjCDeclVendor). This
allows the removal of DeclVendor::GetImporterSource which is extremely
clang-specific, freeing up the interface to be more general.

A good follow up to this would be to remove the remaining instances of
clang in DeclVendor, either by moving things to ClangDeclVendor or by
using wrappers (e.g. CompilerDecl instead of clang::NamedDecl).

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

llvm-svn: 369424

4 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

llvm-svn: 369423

4 years ago[libc++] Implement LWG 3199
Louis Dionne [Tue, 20 Aug 2019 18:21:06 +0000 (18:21 +0000)]
[libc++] Implement LWG 3199

Summary:
The resolution of LWG 3199 makes sure that input-streaming into an empty bitset
does not set the failbit on the input stream.

Reviewers: mclow.lists, EricWF

Subscribers: christof, jkorous, dexonsmith, libcxx-commits

Tags: #libc

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

llvm-svn: 369422

4 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

llvm-svn: 369421

4 years ago[libc++] Precise XFAIL for AppleClang 11
Louis Dionne [Tue, 20 Aug 2019 18:05:06 +0000 (18:05 +0000)]
[libc++] Precise XFAIL for AppleClang 11

This test doesn't fail on all patch levels of AppleClang 11

llvm-svn: 369420

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

llvm-svn: 369419

4 years agoFix name of the error message, NFC.
Alexey Bataev [Tue, 20 Aug 2019 17:50:13 +0000 (17:50 +0000)]
Fix name of the error message, NFC.

llvm-svn: 369418

4 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.

llvm-svn: 369417

4 years agobump lld version used by buildbots
Eric Fiselier [Tue, 20 Aug 2019 17:43:00 +0000 (17:43 +0000)]
bump lld version used by buildbots

llvm-svn: 369416

4 years ago[Attr] Support _attribute__ ((fallthrough))
Nathan Huckleberry [Tue, 20 Aug 2019 17:16:49 +0000 (17:16 +0000)]
[Attr] Support _attribute__ ((fallthrough))

Summary: Fixed extraneous matches of non-NullStmt

Reviewers: aaron.ballman, rsmith, efriedma, xbolva00

Reviewed By: aaron.ballman, rsmith, xbolva00

Subscribers: riccibruno, arphaman, ziangwan, ojeda, xbolva00, nickdesaulniers, cfe-commits

Tags: #clang

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

llvm-svn: 369414

4 years ago[libc++] fix test for unsigned char
Zoe Carver [Tue, 20 Aug 2019 17:09:00 +0000 (17:09 +0000)]
[libc++] fix test for unsigned char

On some systems char is unsigned.
If that is the case, we will now
test signed char twice in std::abs.
NFC. Fixes the build bots.

llvm-svn: 369413

4 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.

llvm-svn: 369412

4 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.

llvm-svn: 369411

4 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

llvm-svn: 369410

4 years ago[libc++] Disable <chrono> ""d and ""y literal tests on AppleClang 10.0.0
Louis Dionne [Tue, 20 Aug 2019 16:45:27 +0000 (16:45 +0000)]
[libc++] Disable <chrono> ""d and ""y literal tests on AppleClang 10.0.0

In r368882, I enabled those tests for all AppleClang's above version 9.
However, it turns out that the feature is only supported starting with
AppleClang 10.0.1, not AppleClang 10.0.0. This commit fixes that hole.

llvm-svn: 369409

4 years ago[LifetimeAnalysis] Add support for free functions
Gabor Horvath [Tue, 20 Aug 2019 16:45:06 +0000 (16:45 +0000)]
[LifetimeAnalysis] Add support for free functions

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

llvm-svn: 369408

4 years agoMake the FindTypes(std::vector<CompilerContext>, ...) API testable in lldb-test
Adrian Prantl [Tue, 20 Aug 2019 16:44:25 +0000 (16:44 +0000)]
Make the FindTypes(std::vector<CompilerContext>, ...) API testable in lldb-test

This adds a -compiler-context=<...> option to lldb-test that trakes a
comma-separated string that is a list of kind/name pairs and
translates it into a std::vector<CompilerContext>, a CompilerContext
being a pair of context-kind and name.

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

<rdar://problem/54471165>

llvm-svn: 369407

4 years ago[libc++] Populate a lit feature including the compiler patch level
Louis Dionne [Tue, 20 Aug 2019 16:41:38 +0000 (16:41 +0000)]
[libc++] Populate a lit feature including the compiler patch level

If the compiler is (for example) AppleClang 10.0.1, we would previously
populate the following lit features:

    apple-clang
    apple-clang-10
    apple-clang-10.0

This patch additionally populates a feature called 'apple-clang-10.0.1',
which allows more precise enabling/disabling of tests.

llvm-svn: 369406

4 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

llvm-svn: 369405

4 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

llvm-svn: 369404

4 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.

llvm-svn: 369403

4 years agowin: Enable /Zc:twoPhase by default if targeting MSVC 2017 update 3 or newer
Nico Weber [Tue, 20 Aug 2019 16:28:11 +0000 (16:28 +0000)]
win: Enable /Zc:twoPhase by default if targeting MSVC 2017 update 3 or newer

MSVC 2017 update 3 (_MSC_VER 1911) enables /Zc:twoPhase by default, and
so should clang-cl:
https://docs.microsoft.com/en-us/cpp/build/reference/zc-twophase

clang-cl takes the MSVC version it emulates from the -fmsc-version flag,
or if that's not passed it tries to check what the installed version of
MSVC is and uses that, and failing that it uses a default version that's
currently 1911. So this changes the default if no -fmsc-version flag is
passed and no installed MSVC is detected. (It also changes the default
if -fmsc-version is passed or MSVC is detected, and either indicates
_MSC_VER >= 1911.)

As mentioned in the MSDN article, the Windows SDK header files in
version 10.0.15063.0 (Creators Update or Redstone 2) and earlier
versions do not work correctly with /Zc:twoPhase. If you need to use
these old SDKs with a new clang-cl, explicitly pass /Zc:twoPhase- to get
the old behavior.

Fixes PR43032.

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

llvm-svn: 369402

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

llvm-svn: 369401

4 years ago[scudo][standalone] Fix malloc_iterate
Kostya Kortchinsky [Tue, 20 Aug 2019 16:17:08 +0000 (16:17 +0000)]
[scudo][standalone] Fix malloc_iterate

Summary:
cferris's Bionic tests found an issue in Scudo's `malloc_iterate`.

We were inclusive of both boundaries, which resulted in a `Block` that
was located on said boundary to be possibly accounted for twice, or
just being accounted for while iterating on regions that are not ours
(usually the unmapped ones in between Primary regions).

The fix is to exclude the upper boundary in `iterateOverChunks`, and
add a regression test.

This additionally corrects a typo in a comment, and change the 64-bit
Primary iteration function to not assume that `BatchClassId` is 0.

Reviewers: cferris, morehouse, hctim, vitalybuka, eugenis

Reviewed By: hctim

Subscribers: delcypher, #sanitizers, llvm-commits

Tags: #llvm, #sanitizers

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

llvm-svn: 369400

4 years agoFix availability of __thread_id on builds with external threading. Reviewed as https...
Marshall Clow [Tue, 20 Aug 2019 16:16:23 +0000 (16:16 +0000)]
Fix availability of __thread_id on builds with external threading. Reviewed as https://reviews.llvm.org/D66480

llvm-svn: 369399

4 years ago[lldb] Use the new Regex::isValid() with no parameter
Jan Kratochvil [Tue, 20 Aug 2019 16:08:27 +0000 (16:08 +0000)]
[lldb] Use the new Regex::isValid() with no parameter

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

llvm-svn: 369398

4 years ago[clang] Use the new Regex::isValid() with no parameter
Jan Kratochvil [Tue, 20 Aug 2019 16:07:31 +0000 (16:07 +0000)]
[clang] Use the new Regex::isValid() with no parameter

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

llvm-svn: 369397

4 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

llvm-svn: 369396

4 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

llvm-svn: 369395

4 years ago[libc++] std::abs should not return double
Zoe Carver [Tue, 20 Aug 2019 15:43:25 +0000 (15:43 +0000)]
[libc++] std::abs should not return double

Implement LWG Issue 2735 by adding std::abs
tests for several types and checking their
return value. NFC.

llvm-svn: 369394

4 years ago[libc++] Explicitly cast in generate_canonical
Louis Dionne [Tue, 20 Aug 2019 15:39:20 +0000 (15:39 +0000)]
[libc++] Explicitly cast in generate_canonical

A new clang warning introduced in r367497 was complaining about
the change in value.

Thanks to Brian Cain for the patch.
Differential Revision: https://reviews.llvm.org/D66422

llvm-svn: 369393

4 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

llvm-svn: 369392

4 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

llvm-svn: 369391

4 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.

llvm-svn: 369390

4 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

llvm-svn: 369389

4 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

llvm-svn: 369388

4 years ago[clangd] Fix one testcase in XRefsTests.
Haojian Wu [Tue, 20 Aug 2019 14:07:27 +0000 (14:07 +0000)]
[clangd] Fix one testcase in XRefsTests.

Summary:
The test didn't test anything actually -- it used "[]" as annotation which should be
"[[]]".

This patch also fixes a bug in XRef where we may return duplicated refs.

Reviewers: ilya-biryukov

Subscribers: MaskRay, jkorous, arphaman, kadircet, cfe-commits

Tags: #clang

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

llvm-svn: 369387

4 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

llvm-svn: 369386

4 years ago[Syntax] Added function to get macro expansion tokens to TokenBuffer.
Johan Vikstrom [Tue, 20 Aug 2019 13:34:01 +0000 (13:34 +0000)]
[Syntax] Added function to get macro expansion tokens to TokenBuffer.

Summary:
Returns the first token in every mapping where the token is an identifier.
This API is required to be able to highlight macro expansions in clangd.

Reviewers: hokein, ilya-biryukov

Subscribers: kadircet, cfe-commits

Tags: #clang

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

llvm-svn: 369385