platform/upstream/llvm.git
5 years agoclang: Don't warn on unused momit-leaf-frame-pointer when frame pointers are off.
Nico Weber [Tue, 13 Aug 2019 17:37:09 +0000 (17:37 +0000)]
clang: Don't warn on unused momit-leaf-frame-pointer when frame pointers are off.

This fixes a regression from r365860: As that commit message
states, there are 3 valid states targeted by the combination of
-f(no-)omit-frame-pointer and -m(no-)omit-leaf-frame-pointer.

After r365860 it's impossible to get from state 10 (omit just
leaf frame pointers) to state 11 (omit all frame pointers)
in a single command line without getting a warning.

This change restores that functionality.

Fixes PR42966.

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

llvm-svn: 368728

5 years agoUse Register over unsigned in LateEHPrepare (NFC)
Heejin Ahn [Tue, 13 Aug 2019 17:35:44 +0000 (17:35 +0000)]
Use Register over unsigned in LateEHPrepare (NFC)

Summary:
While D65962 is pending for review, I landed D65475 that added one more
use of `unsigned`. Changed it to `Register`.

Reviewers: dsanders

Subscribers: dschuff, sbc100, jgravelle-google, hiraditya, llvm-commits

Tags: #llvm

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

llvm-svn: 368727

5 years ago[util] Allow callsigns when running git llvm revert
Jordan Rupprecht [Tue, 13 Aug 2019 17:19:53 +0000 (17:19 +0000)]
[util] Allow callsigns when running git llvm revert

llvm-svn: 368726

5 years ago[NFC] Updated tests after r368724
David Bolvansky [Tue, 13 Aug 2019 17:19:16 +0000 (17:19 +0000)]
[NFC] Updated tests after r368724

llvm-svn: 368725

5 years ago[SimplifyLibCalls] Add noalias from known callsites
David Bolvansky [Tue, 13 Aug 2019 17:18:46 +0000 (17:18 +0000)]
[SimplifyLibCalls] Add noalias from known callsites

Summary:
Should be fine for memcpy, strcpy, strncpy.

Reviewers: jdoerfert, efriedma

Reviewed By: jdoerfert

Subscribers: uenoku, llvm-commits

Tags: #llvm

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

llvm-svn: 368724

5 years ago[ValueTracking] Improve reverse assumption inference
Nikita Popov [Tue, 13 Aug 2019 17:15:42 +0000 (17:15 +0000)]
[ValueTracking] Improve reverse assumption inference

Use isGuaranteedToTransferExecutionToSuccessor() instead of
isSafeToSpeculativelyExecute() when seeing whether we can propagate
the information in an assume backwards in isValidAssumeForContext().
The latter is more general - it also allows arbitrary loads/stores -
and is also the condition we want: if our assume is guaranteed to
execute, its condition not holding would be UB.

Original patch by arielb1.

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

llvm-svn: 368723

5 years ago[NFC] Revisited/updated tests
David Bolvansky [Tue, 13 Aug 2019 17:07:02 +0000 (17:07 +0000)]
[NFC] Revisited/updated tests

llvm-svn: 368722

5 years agoReland r368691: "[AIX] Implement LR prolog/epilog save/restore"
Hubert Tong [Tue, 13 Aug 2019 17:05:53 +0000 (17:05 +0000)]
Reland r368691: "[AIX] Implement LR prolog/epilog save/restore"

Trying again with the code changes (and not just the new test).

Summary:
This patch fixes the offsets of fields in the stack frame linkage save
area for AIX.

Reviewers: sfertile, hubert.reinterpretcast, jasonliu, Xiangling_L, xingxue, ZarkoCA, daltenty

Reviewed By: hubert.reinterpretcast

Subscribers: wuzish, nemanjai, hiraditya, kbarton, MaskRay, jsji, llvm-commits

Tags: #llvm

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

Patch by Chris Bowler!

llvm-svn: 368721

5 years ago[NFC][AIX] Use assert instead of llvm_unreachable
David Tenty [Tue, 13 Aug 2019 17:04:51 +0000 (17:04 +0000)]
[NFC][AIX] Use assert instead of llvm_unreachable

Addresses post-commit comments on https://reviews.llvm.org/D64825. Use
assert instead of llvm_unreachable to check if invalid csect types are being
generated. Use report_fatal_error on unimplemented XCOFF features.

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

llvm-svn: 368720

5 years ago[lld][WebAssembly] Allow linking of pic code into static binaries
Sam Clegg [Tue, 13 Aug 2019 17:02:02 +0000 (17:02 +0000)]
[lld][WebAssembly] Allow linking of pic code into static binaries

Summary: See https://github.com/emscripten-core/emscripten/issues/9013

Subscribers: dschuff, jgravelle-google, aheejin, sunfish, llvm-commits

Tags: #llvm

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

llvm-svn: 368719

5 years ago[Dwarf] Complete the list of type tags.
Jonas Devlieghere [Tue, 13 Aug 2019 17:00:54 +0000 (17:00 +0000)]
[Dwarf] Complete the list of type tags.

An incorrect verification error revealed that the list of type tags was
incomplete. This patch adds the missing types by adding a tag kind to
the Dwarf.def file, which is used by the `isType` function.

A test was added for the original verification error.

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

llvm-svn: 368718

5 years ago[analyzer][NFC] Refactoring BugReporter.cpp P3.: std::shared_pointer<PathDiagnosticPi...
Kristof Umann [Tue, 13 Aug 2019 16:45:48 +0000 (16:45 +0000)]
[analyzer][NFC] Refactoring BugReporter.cpp P3.: std::shared_pointer<PathDiagnosticPiece> -> PathDiagnosticPieceRef

find clang/ -type f -exec sed -i 's/std::shared_ptr<PathDiagnosticPiece>/PathDiagnosticPieceRef/g' {} \;
git diff -U3 --no-color HEAD^ | clang-format-diff-6.0 -p1 -i

Just as C++ is meant to be refactored, right?

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

llvm-svn: 368717

5 years ago[X86] Add some vXi8 extract subvector cost model tests
Simon Pilgrim [Tue, 13 Aug 2019 16:44:40 +0000 (16:44 +0000)]
[X86] Add some vXi8 extract subvector cost model tests

We don't have full 512-bit test coverage yet - but there's enough to help test D65892

llvm-svn: 368716

5 years ago[SLC] Improve dereferenceable bytes annotation
David Bolvansky [Tue, 13 Aug 2019 16:44:16 +0000 (16:44 +0000)]
[SLC] Improve dereferenceable bytes annotation

llvm-svn: 368715

5 years agoGlobalISel: Partially implement fewerElementsVector G_UNMERGE_VALUES
Matt Arsenault [Tue, 13 Aug 2019 16:26:28 +0000 (16:26 +0000)]
GlobalISel: Partially implement fewerElementsVector G_UNMERGE_VALUES

Odd sized vectors aren't handled yet.

llvm-svn: 368713

5 years ago[ARM] Fix detection of duplicates when parsing reg list operands
Momchil Velikov [Tue, 13 Aug 2019 16:13:00 +0000 (16:13 +0000)]
[ARM] Fix detection of duplicates when parsing reg list operands

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

llvm-svn: 368712

5 years ago[ARM] Fix encoding of APSR in CLRM instruction
Momchil Velikov [Tue, 13 Aug 2019 16:12:46 +0000 (16:12 +0000)]
[ARM] Fix encoding of APSR in CLRM instruction

The APSR is encoded by setting bit 15 in the register list of the CLRM
instruction (cf. https://static.docs.arm.com/ddi0553/bh/DDI0553B_h_armv8m_arm.pdf).

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

llvm-svn: 368711

5 years ago[lld][test] Update test to print ELF note description data
Jordan Rupprecht [Tue, 13 Aug 2019 16:11:09 +0000 (16:11 +0000)]
[lld][test] Update test to print ELF note description data

llvm-svn: 368710

5 years agoGlobalISel: Implement lower for G_SHUFFLE_VECTOR
Matt Arsenault [Tue, 13 Aug 2019 16:09:07 +0000 (16:09 +0000)]
GlobalISel: Implement lower for G_SHUFFLE_VECTOR

llvm-svn: 368709

5 years ago[ORC] Refactor definition-generation, add a generator for static libraries.
Lang Hames [Tue, 13 Aug 2019 16:05:18 +0000 (16:05 +0000)]
[ORC] Refactor definition-generation, add a generator for static libraries.

This patch replaces the JITDylib::DefinitionGenerator typedef with a class of
the same name, and adds support for attaching a sequence of DefinitionGeneration
objects to a JITDylib.

This patch also adds a new definition generator,
StaticLibraryDefinitionGenerator, that can be used to add symbols fom a static
library to a JITDylib. An object from the static library will be added (via
a supplied ObjectLayer reference) whenever a symbol from that object is
referenced.

To enable testing, lli is updated to add support for the --extra-archive option
when running in -jit-kind=orc-lazy mode.

llvm-svn: 368707

5 years agoFix crash on switch conditions of non-integer types in templates
Elizabeth Andrews [Tue, 13 Aug 2019 15:53:19 +0000 (15:53 +0000)]
Fix crash on switch conditions of non-integer types in templates

Clang currently crashes for switch statements inside a template when
the condition is a non-integer field. The crash is due to incorrect
type-dependency of field. Type-dependency of member expressions is
currently set based on the containing class. This patch changes this for
'members of the current instantiation' to set the type dependency based
on the member's type instead.

A few lit tests started to fail once I applied this patch because errors
are now diagnosed earlier (does not wait till instantiation). I've modified
these tests in this patch as well.

Patch fixes PR#40982

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

llvm-svn: 368706

5 years agoGlobalISel: Add more verifier checks for G_SHUFFLE_VECTOR
Matt Arsenault [Tue, 13 Aug 2019 15:52:21 +0000 (15:52 +0000)]
GlobalISel: Add more verifier checks for G_SHUFFLE_VECTOR

llvm-svn: 368705

5 years agoGlobalISel: Change representation of shuffle masks
Matt Arsenault [Tue, 13 Aug 2019 15:34:38 +0000 (15:34 +0000)]
GlobalISel: Change representation of shuffle masks

Currently shufflemasks get emitted as any other constant, and you end
up with a bunch of virtual registers of G_CONSTANT with a
G_BUILD_VECTOR. The AArch64 selector then asserts on anything that
doesn't fit this pattern. This isn't an ideal representation, and
should avoid legalization and have fewer opportunities for a
representational error.

Rather than invent a new shuffle mask operand type, similar to what
ShuffleVectorSDNode does, just track the original IR Constant mask
operand. I don't completely like the idea of adding another link to
the IR, but MIR is already quite dependent on IR constants already,
and this will allow sharing the shuffle mask utility functions with
the IR.

llvm-svn: 368704

5 years ago[libc++] Always build with -fvisibility=hidden
Louis Dionne [Tue, 13 Aug 2019 15:02:53 +0000 (15:02 +0000)]
[libc++] Always build with -fvisibility=hidden

Summary:
This avoids symbols being accidentally exported from the dylib when they
shouldn't. The next step is to use a pragma to apply hidden visibility
to all declarations (unless otherwise specified), which will allow us
to drop the per-declaration hidden visibility attributes we currently
have.

This also has the nice side effect of making sure the dylib exports the
same symbols regardless of the optimization level.

PR38138

Reviewers: EricWF, mclow.lists

Subscribers: mgorny, christof, jkorous, dexonsmith, libcxx-commits

Tags: #libc

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

llvm-svn: 368703

5 years ago[CodeGen][SelectionDAG] More efficient code for X % C == 0 (SREM case)
Roman Lebedev [Tue, 13 Aug 2019 14:57:37 +0000 (14:57 +0000)]
[CodeGen][SelectionDAG] More efficient code for X % C == 0 (SREM case)

Summary:
This implements an optimization described in Hacker's Delight 10-17:
when `C` is constant, the result of `X % C == 0` can be computed
more cheaply without actually calculating the remainder.
The motivation is discussed here: https://bugs.llvm.org/show_bug.cgi?id=35479.

One huge caveat: this signed case is only valid for positive divisors.

While we can freely negate negative divisors, we can't negate `INT_MIN`,
so for now if `INT_MIN` is encountered, we bailout.
As a follow-up, it should be possible to handle that more gracefully
via extra `and`+`setcc`+`select`.

This passes llvm's test-suite, and from cursory(!) cross-examination
the folds (the assembly) match those of GCC, and manual checking via alive
did not reveal any issues (other than the `INT_MIN` case)

Reviewers: RKSimon, spatel, hermord, craig.topper, xbolva00

Reviewed By: RKSimon, xbolva00

Subscribers: xbolva00, thakis, javed.absar, hiraditya, dexonsmith, llvm-commits

Tags: #llvm

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

llvm-svn: 368702

5 years ago[TargetLowering][NFC] prepareUREMEqFold(): fixup comment
Roman Lebedev [Tue, 13 Aug 2019 14:57:08 +0000 (14:57 +0000)]
[TargetLowering][NFC] prepareUREMEqFold(): fixup comment

The comment initially matched the code, but the code was incorrect
and was fixed after the initial revert back back when it was introduced,
but the comment was never updated.

llvm-svn: 368701

5 years ago[clang-tidy] Update `TransformerClangTidyCheck` to use new `buildMatchers` functionality.
Yitzhak Mandelbaum [Tue, 13 Aug 2019 14:48:13 +0000 (14:48 +0000)]
[clang-tidy] Update `TransformerClangTidyCheck` to use new `buildMatchers` functionality.

Summary:
`buildMatchers` is the new, more general way to extract the matcher from a rule.
This change migrates the code to use it instead of `buildMatcher`.

Reviewers: gribozavr

Subscribers: xazax.hun, cfe-commits

Tags: #clang

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

llvm-svn: 368700

5 years agoRevert r368691; test checked in without changes by accident
Hubert Tong [Tue, 13 Aug 2019 14:43:34 +0000 (14:43 +0000)]
Revert r368691; test checked in without changes by accident

llvm-svn: 368699

5 years ago[llvm-readelf] Implement note parsing for NT_FILE and unknown descriptors
Jordan Rupprecht [Tue, 13 Aug 2019 14:38:45 +0000 (14:38 +0000)]
[llvm-readelf] Implement note parsing for NT_FILE and unknown descriptors

Summary:
This patch implements two note parsers; one for NT_FILE coredumps, e.g.:

```
  CORE                  0x00000080      NT_FILE (mapped files)
    Page size: 4096
                 Start                 End         Page Offset
    0x0000000000001000  0x0000000000002000  0x0000000000003000
        /path/to/a.out
    0x0000000000004000  0x0000000000005000  0x0000000000006000
        /path/to/libc.so
    0x0000000000007000  0x0000000000008000  0x0000000000009000
        [stack]
```

(A more realistic example can be tested locally by creating a crashing program and running `llvm-readelf -n core`)

And also implements a raw hex dump for unknown descriptor data for unhandled descriptor types.

Reviewers: MaskRay, jhenderson, grimar, alexshap

Reviewed By: MaskRay, grimar

Subscribers: emaste, llvm-commits, labath

Tags: #llvm

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

llvm-svn: 368698

5 years agoEnable memtag sanitizer in all AArch64 toolchains
Momchil Velikov [Tue, 13 Aug 2019 14:20:23 +0000 (14:20 +0000)]
Enable memtag sanitizer in all AArch64 toolchains

That sanitizer does not have runtime library or other dependencies.

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

llvm-svn: 368697

5 years ago[AArch64] Make the memtag sanitizer require the memtag extension
Momchil Velikov [Tue, 13 Aug 2019 14:20:06 +0000 (14:20 +0000)]
[AArch64] Make the memtag sanitizer require the memtag extension

... or otherwise we get an ICE.

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

llvm-svn: 368696

5 years ago[lldb] Fix Microsoft guard variable detection
Raphael Isemann [Tue, 13 Aug 2019 14:13:39 +0000 (14:13 +0000)]
[lldb] Fix Microsoft guard variable detection

Apparently we need to check for a suffix, not a prefix. This broke
probably broke expression evaluation on Windows.

llvm-svn: 368695

5 years ago[analyzer][NFC] Refactoring BugReporter.cpp P2.: Clean up the construction of bug...
Kristof Umann [Tue, 13 Aug 2019 13:56:12 +0000 (13:56 +0000)]
[analyzer][NFC] Refactoring BugReporter.cpp P2.: Clean up the construction of bug paths and finding a valid report

This patch refactors the utility functions and classes around the construction
of a bug path.

At a very high level, this consists of 3 steps:

* For all BugReports in the same BugReportEquivClass, collect all their error
nodes in a set. With that set, create a new, trimmed ExplodedGraph whose leafs
are all error nodes.
* Until a valid report is found, construct a bug path, which is yet another
ExplodedGraph, that is linear from a given error node to the root of the graph.
* Run all visitors on the constructed bug path. If in this process the report
got invalidated, start over from step 2.

Now, to the changes within this patch:

* Do not allow the invalidation of BugReports up to the point where the trimmed
graph is constructed. Checkers shouldn't add bug reports that are known to be
invalid, and should use visitors and argue about the entirety of the bug path if
needed.
* Do not calculate indices. I may be biased, but I personally find code like
this horrible. I'd like to point you to one of the comments in the original code:

SmallVector<const ExplodedNode *, 32> errorNodes;
for (const auto I : bugReports) {
  if (I->isValid()) {
    HasValid = true;
    errorNodes.push_back(I->getErrorNode());
  } else {
    // Keep the errorNodes list in sync with the bugReports list.
    errorNodes.push_back(nullptr);
  }
}

Not on my watch. Instead, use a far easier to follow trick: store a pointer to
the BugReport in question, not an index to it.

* Add range iterators to ExplodedGraph's successors and predecessors, and a
visitor range to BugReporter.
* Rename TrimmedGraph to BugPathGetter. Because that is what it has always been:
no sane graph type should store an iterator-like state, or have an interface not
exposing a single graph-like functionalities.
* Rename ReportGraph to BugPathInfo, because it is only a linear path with some
other context.
* Instead of having both and out and in parameter (which I think isn't ever
excusable unless we use the out-param for caching), return a record object with
descriptive getter methods.
* Where descriptive names weren't sufficient, compliment the code with comments.

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

llvm-svn: 368694

5 years agoFix -Wdocumentation warning (@returns used in void function). NFCI.
Simon Pilgrim [Tue, 13 Aug 2019 13:55:38 +0000 (13:55 +0000)]
Fix -Wdocumentation warning (@returns used in void function). NFCI.

llvm-svn: 368693

5 years agoFix -Wdocumentation typo. NFCI.
Simon Pilgrim [Tue, 13 Aug 2019 13:52:20 +0000 (13:52 +0000)]
Fix -Wdocumentation typo. NFCI.

llvm-svn: 368692

5 years ago[AIX] Implement LR prolog/epilog save/restore
Hubert Tong [Tue, 13 Aug 2019 13:38:24 +0000 (13:38 +0000)]
[AIX] Implement LR prolog/epilog save/restore

Summary:
This patch fixes the offsets of fields in the stack frame linkage save
area for AIX.

Reviewers: sfertile, hubert.reinterpretcast, jasonliu, Xiangling_L, xingxue, ZarkoCA, daltenty

Reviewed By: hubert.reinterpretcast

Subscribers: wuzish, nemanjai, hiraditya, kbarton, MaskRay, jsji, llvm-commits

Tags: #llvm

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

Patch by Chris Bowler!

llvm-svn: 368691

5 years ago[AIX][test/Index] Set/propagate AIXTHREAD_STK for AIX
Hubert Tong [Tue, 13 Aug 2019 13:38:15 +0000 (13:38 +0000)]
[AIX][test/Index] Set/propagate AIXTHREAD_STK for AIX

Summary:
Some tests perform deep recursion, which requires a larger pthread stack
size than the relatively low default of 192 KiB for 64-bit processes on
AIX. The `AIXTHREAD_STK` environment variable provides a non-intrusive
way to request a larger pthread stack size for the tests. The required
pthread stack size depends on the build configuration.

A 4 MiB default is generous compared to the 512 KiB of macOS; however,
it is known that some compilers on AIX produce code that uses
comparatively more stack space.

Reviewers: xingxue, daltenty, jasonliu

Reviewed By: daltenty

Subscribers: arphaman, jfb, cfe-commits

Tags: #clang

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

llvm-svn: 368690

5 years ago[analyzer][NFC] Refactoring BugReporter.cpp P1.: Store interesting symbols/regions...
Kristof Umann [Tue, 13 Aug 2019 13:09:48 +0000 (13:09 +0000)]
[analyzer][NFC] Refactoring BugReporter.cpp P1.: Store interesting symbols/regions in a simple set

The goal of this refactoring effort was to better understand how interestingness
was propagated in BugReporter.cpp, which eventually turned out to be a dead end,
but with such a twist, I wouldn't even want to spoil it ahead of time. However,
I did get to learn a lot about how things are working in there.

In these series of patches, as well as cleaning up the code big time, I invite
you to study how BugReporter.cpp operates, and discuss how we could design this
file to reduce the horrible mess that it is.

This patch reverts a great part of rC162028, which holds the title "Allow
multiple PathDiagnosticConsumers to be used with a BugReporter at the same
time.". This, however doesn't imply that there's any need for multiple "layers"
or stacks of interesting symbols and regions, quite the contrary, I would argue
that we would like to generate the same amount of information for all output
types, and only process them differently.

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

llvm-svn: 368689

5 years ago[lldb] Reland "Refactor guard variable checks in IRForTarget"
Raphael Isemann [Tue, 13 Aug 2019 13:09:18 +0000 (13:09 +0000)]
[lldb] Reland "Refactor guard variable checks in IRForTarget"

It seems the broken guard variable check for Windows was a feature(TM)
and not a bug, so let's keep add a flag to the guard check that keeps
the old behavior in the places where we ignored guard variables before.

llvm-svn: 368688

5 years ago[InstCombine] Non-canonical clamp-like pattern handling
Roman Lebedev [Tue, 13 Aug 2019 12:49:28 +0000 (12:49 +0000)]
[InstCombine] Non-canonical clamp-like pattern handling

Summary:
Given a pattern like:
```
%old_cmp1 = icmp slt i32 %x, C2
%old_replacement = select i1 %old_cmp1, i32 %target_low, i32 %target_high
%old_x_offseted = add i32 %x, C1
%old_cmp0 = icmp ult i32 %old_x_offseted, C0
%r = select i1 %old_cmp0, i32 %x, i32 %old_replacement
```
it can be rewritten as more canonical pattern:
```
%new_cmp1 = icmp slt i32 %x, -C1
%new_cmp2 = icmp sge i32 %x, C0-C1
%new_clamped_low = select i1 %new_cmp1, i32 %target_low, i32 %x
%r = select i1 %new_cmp2, i32 %target_high, i32 %new_clamped_low
```
Iff `-C1 s<= C2 s<= C0-C1`
Also, `ULT` predicate can also be `UGE`; or `UGT` iff `C0 != -1` (+invert result)
Also, `SLT` predicate can also be `SGE`; or `SGT` iff `C2 != INT_MAX` (+invert result)

If `C1 == 0`, then all 3 instructions must be one-use; else at most either `%old_cmp1` or `%old_x_offseted` can have extra uses.
NOTE: if we could reuse `%old_cmp1` as one of the comparisons we'll have to build, this could be less limiting.

So there are two icmp's, each one with 3 predicate variants, so there are 9 fold variants:

|     | ULT                            | UGE                             | UGT                             |
| SLT | https://rise4fun.com/Alive/yIJ | https://rise4fun.com/Alive/5BfN | https://rise4fun.com/Alive/INH  |
| SGE | https://rise4fun.com/Alive/hd8 | https://rise4fun.com/Alive/Abk  | https://rise4fun.com/Alive/PlzS |
| SGT | https://rise4fun.com/Alive/VYG | https://rise4fun.com/Alive/oMY  | https://rise4fun.com/Alive/KrzC |
{F9730206}

This fold was brought up in https://reviews.llvm.org/D65148#1603922 by @dmgreen, and is needed to unblock that patch.
This patch requires D65530.

Reviewers: spatel, nikic, xbolva00, dmgreen

Reviewed By: spatel

Subscribers: hiraditya, llvm-commits, dmgreen

Tags: #llvm

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

llvm-svn: 368687

5 years ago[InstCombine][NFC] Rename IsFreeToInvert() -> isFreeToInvert() for consistency
Roman Lebedev [Tue, 13 Aug 2019 12:49:16 +0000 (12:49 +0000)]
[InstCombine][NFC] Rename IsFreeToInvert() -> isFreeToInvert() for consistency

As per https://reviews.llvm.org/D65530#inline-592325

llvm-svn: 368686

5 years ago[InstCombine] foldXorOfICmps(): don't give up on non-single-use ICmp's if all users...
Roman Lebedev [Tue, 13 Aug 2019 12:49:06 +0000 (12:49 +0000)]
[InstCombine] foldXorOfICmps(): don't give up on non-single-use ICmp's if all users are freely invertible

Summary:
This is rather unconventional..

As the comment there says, we don't have much folds for xor-of-icmps,
we try to turn them into an and-of-icmps, for which we have plenty of folds.
But if the ICmp we need to invert is not single-use - we give up.

As discussed in https://reviews.llvm.org/D65148#1603922,
we may have a non-canonical CLAMP pattern, with bit match and
select-of-threshold that we'll potentially clamp.
As it can be seen in `canonicalize-clamp-with-select-of-constant-threshold-pattern.ll`,
out of all 8 variations of the pattern, only two are **not** canonicalized into
the variant with and+icmp instead of bit math.
The reason is because the ICmp we need to invert is not single-use - we give up.

We indeed can't perform this fold at will, the general rule is that
we should not increase instruction count in InstCombine,

But we wouldn't end up increasing instruction count if we can adapt every other
user to the inverted value. This way the `not` we create **will** get folded,
and in the end the instruction count did not increase.

For that, of course, we need to look at the users of a Value,
which is again rather unconventional for InstCombine :S

Thus i'm proposing to be a little bit more insistive in `foldXorOfICmps()`.
The alternatives would be to not create that `not`, but add duplicate code to
manually invert all users; or to add some even less general combine to handle
some more specific pattern[s].

Reviewers: spatel, nikic, RKSimon, craig.topper

Reviewed By: spatel

Subscribers: hiraditya, jdoerfert, dmgreen, llvm-commits

Tags: #llvm

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

llvm-svn: 368685

5 years ago[pstl] Allow customizing whether per-TU insulation is provided
Louis Dionne [Tue, 13 Aug 2019 12:49:00 +0000 (12:49 +0000)]
[pstl] Allow customizing whether per-TU insulation is provided

Like we do in libc++, PSTL needs the ability to constrain
ABI-unstable symbols to each translation unit. This is OFF by
default (like for libc++), because most people don't care about
this and there is a cost associated to enabling the option (code
bloat because templates are not deduped across TUs).

I'm using '#pragma clang attribute push' to avoid marking each
declaration with an attribute, which quickly becomes difficult
to maintain.

llvm-svn: 368684

5 years ago[libTooling] In Transformer, generalize `applyFirst` to admit rules with incompatible...
Yitzhak Mandelbaum [Tue, 13 Aug 2019 12:31:29 +0000 (12:31 +0000)]
[libTooling] In Transformer, generalize `applyFirst` to admit rules with incompatible matchers.

Summary:
This patch removes an (artificial) limitation of `applyFirst`, which requires
that all of the rules' matchers can be grouped together in a single `anyOf()`.
This change generalizes the code to group the matchers into separate `anyOf`s
based on compatibility. Correspondingly, `buildMatcher` is changed to
`buildMatchers`, to allow for returning a set of matchers rather than just one.

Reviewers: gribozavr

Subscribers: cfe-commits

Tags: #clang

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

llvm-svn: 368681

5 years ago[lldb][NFC] Add basic IOHandler completion test
Raphael Isemann [Tue, 13 Aug 2019 12:12:19 +0000 (12:12 +0000)]
[lldb][NFC] Add basic IOHandler completion test

We have no test coverage for the IOHandler code that is doing the
completion in the command line. This is adding a pexpect-based test
as a preparation for the switch to using CompletionRequest in the
whole completion machinery.

llvm-svn: 368679

5 years ago[llvm-readobj] - Remove 'error(Error EC)' helper.
George Rimar [Tue, 13 Aug 2019 12:07:41 +0000 (12:07 +0000)]
[llvm-readobj] - Remove 'error(Error EC)' helper.

We do not need it. I replaced it with
reportError(StringRef Input, Error Err).

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

llvm-svn: 368677

5 years ago[CodeGen] Disable UBSan for coroutine functions
Brian Gesiak [Tue, 13 Aug 2019 12:02:25 +0000 (12:02 +0000)]
[CodeGen] Disable UBSan for coroutine functions

Summary:
As explained in http://lists.llvm.org/pipermail/llvm-dev/2018-March/121924.html,
the LLVM coroutines transforms are not yet able to move the
instructions for UBSan null checking past coroutine suspend boundaries.
For now, disable all UBSan checks when generating code for coroutines
functions.

I also considered an approach where only '-fsanitize=null' would be disabled,
However in practice this led to other LLVM errors when writing object files:
"Cannot represent a difference across sections". For now, disable all
UBSan checks until coroutine transforms are updated to handle them.

Test Plan:
1. check-clang
2. Compile the program in https://gist.github.com/modocache/54a036c3bf9c06882fe85122e105d153
   using the '-fsanitize=null' option and confirm it does not crash
   during LLVM IR generation.

Reviewers: GorNishanov, vsk, eric_niebler, lewissbaker

Reviewed By: vsk

Subscribers: cfe-commits

Tags: #clang

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

llvm-svn: 368675

5 years ago[pstl] Rename PARALLELSTL_BACKEND to PSTL_PARALLEL_BACKEND
Louis Dionne [Tue, 13 Aug 2019 11:50:26 +0000 (11:50 +0000)]
[pstl] Rename PARALLELSTL_BACKEND to PSTL_PARALLEL_BACKEND

It makes more sense to name configuration options as PSTL_XXX.
Also, I'm naming it PSTL_PARALLEL_BACKEND because we might introduce
the ability to customize the vectorization backend, in which case
PSTL_BACKEND would become ambiguous.

llvm-svn: 368672

5 years agogn build: Extract git() and git_out() functions in sync script
Nico Weber [Tue, 13 Aug 2019 11:48:15 +0000 (11:48 +0000)]
gn build: Extract git() and git_out() functions in sync script

llvm-svn: 368671

5 years agogn build: Merge r368630
Nico Weber [Tue, 13 Aug 2019 11:32:54 +0000 (11:32 +0000)]
gn build: Merge r368630

llvm-svn: 368668

5 years agogn build: Give cmake sync script an opt-in --write flag
Nico Weber [Tue, 13 Aug 2019 11:32:45 +0000 (11:32 +0000)]
gn build: Give cmake sync script an opt-in --write flag

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

llvm-svn: 368667

5 years ago[libc++] Fix incorrect UNSUPPORTED annotation
Louis Dionne [Tue, 13 Aug 2019 11:25:16 +0000 (11:25 +0000)]
[libc++] Fix incorrect UNSUPPORTED annotation

The test was marked as UNSUPPORTED for clang-6 and clang-6, instead of
clang-6 and clang-7.

llvm-svn: 368666

5 years agogn build: Make sync script group output by revision
Nico Weber [Tue, 13 Aug 2019 11:24:20 +0000 (11:24 +0000)]
gn build: Make sync script group output by revision

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

llvm-svn: 368665

5 years ago[libc++] Use [[nodiscard]] for lock_guard, as an extension
Louis Dionne [Tue, 13 Aug 2019 11:12:28 +0000 (11:12 +0000)]
[libc++] Use [[nodiscard]] for lock_guard, as an extension

Summary:
D64914 added support for applying [[nodiscard]] to constructors. This
commit uses that capability to flag incorrect uses of std::lock_guard
where one forgets to actually create a variable for the lock_guard.

rdar://45790820

Reviewers: mclow.lists, EricWF

Subscribers: christof, jkorous, dexonsmith, libcxx-commits, Quuxplusone, lebedev.ri

Tags: #libc

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

llvm-svn: 368664

5 years ago[X86] XFormVExtractWithShuffleIntoLoad - handle shuffle mask scaling
Simon Pilgrim [Tue, 13 Aug 2019 11:11:42 +0000 (11:11 +0000)]
[X86] XFormVExtractWithShuffleIntoLoad - handle shuffle mask scaling

If the target shuffle mask is from a wider type, attempt to scale the mask so that the extraction can attempt to peek through.

Fixes the regression mentioned in rL368662

Reapplying this as rL368308 had to be reverted as part of rL368660 to revert rL368276

llvm-svn: 368663

5 years ago[X86] SimplifyDemandedVectorElts - attempt to recombine target shuffle using Demanded...
Simon Pilgrim [Tue, 13 Aug 2019 10:51:39 +0000 (10:51 +0000)]
[X86] SimplifyDemandedVectorElts - attempt to recombine target shuffle using DemandedElts mask (reapplied)

If we don't demand all elements, then attempt to combine to a simpler shuffle.

At the moment we can only do this if Depth == 0 as combineX86ShufflesRecursively uses Depth to track whether the shuffle has really changed or not - we'll need to change this before we can properly start merging combineX86ShufflesRecursively into SimplifyDemandedVectorElts.

The insertps-combine.ll regression is because XFormVExtractWithShuffleIntoLoad can't see through shuffles of different widths - this will be fixed in a follow-up commit.

Reapplying this as rL368307 had to be reverted as part of rL368660 to revert rL368276

llvm-svn: 368662

5 years ago[ELF] Don't special case symbolic relocations with 0 addend to ifunc in writable...
Fangrui Song [Tue, 13 Aug 2019 09:43:40 +0000 (09:43 +0000)]
[ELF] Don't special case symbolic relocations with 0 addend to ifunc in writable locations

Currently the following 3 relocation types do not trigger the creation
of a canonical PLT (which changes STT_GNU_IFUNC to STT_FUNC and
redirects all references):

1) GOT-generating (`needsGot`)
2) PLT-generating (`needsPlt`)
3) R_ABS with 0 addend in a writable location. This is used for
  for ifunc function pointers in writable sections such as .data and .toc.

This patch deletes case 3) to simplify the R_*_IRELATIVE generating
logic added in D57371. Other advantages:

* It is guaranteed no more than 1 R_*_IRELATIVE is created for an ifunc.
* PPC64: no need to special case ifunc in toc-indirect to toc-relative relaxation. See D65755

The deleted elf::addIRelativeRelocs demonstrates that one-pass scan
through relocations makes several optimizations difficult. This is
something we can think about in the future.

Reviewed By: peter.smith

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

llvm-svn: 368661

5 years agoRevert r368276 "[TargetLowering] SimplifyDemandedBits - call SimplifyMultipleUseDeman...
Hans Wennborg [Tue, 13 Aug 2019 09:33:25 +0000 (09:33 +0000)]
Revert r368276 "[TargetLowering] SimplifyDemandedBits - call SimplifyMultipleUseDemandedBits for ISD::EXTRACT_VECTOR_ELT"

This introduced a false positive MemorySanitizer warning about use of
uninitialized memory in a vectorized crc function in Chromium. That suggests
maybe something is not right with this transformation. See
https://crbug.com/992853#c7 for a reproducer.

This also reverts the follow-up commits r368307 and r368308 which
depended on this.

> This patch attempts to peek through vectors based on the demanded bits/elt of a particular ISD::EXTRACT_VECTOR_ELT node, allowing us to avoid dependencies on ops that have no impact on the extract.
>
> In particular this helps remove some unnecessary scalar->vector->scalar patterns.
>
> The wasm shift patterns are annoying - @tlively has indicated that the wasm vector shift codegen are to be refactored in the near-term and isn't considered a major issue.
>
> Differential Revision: https://reviews.llvm.org/D65887

llvm-svn: 368660

5 years ago[ELF] Simplify handling of exportDynamic and isPreemptible
Fangrui Song [Tue, 13 Aug 2019 09:12:52 +0000 (09:12 +0000)]
[ELF] Simplify handling of exportDynamic and isPreemptible

In Writer::includeInDynSym(), exportDynamic is used by a Defined with
protected or default visibility, to record whether it is required to be
exported into .dynsym. It is set when any of the following conditions
hold:

1) There is an interposable symbol from a DSO (Undefined or SharedSymbol with default visibility)
2) If -shared or --export-dynamic is specified, any symbol in an object file/bitcode sets this property, unless suppressed by canBeOmittedFromSymbolTable().
3) --dynamic-list when producing an executable

4) protected symbol from a DSO preempted by copy relocation/canonical PLT when
  --ignore-{data,function}-address-equality is specified
5) ifunc is exported when -z ifunc-noplt is specified

Bullet points 4) and 5) are irrelevant in this patch.

Bullet 3) does not play well with 1) and 2). When -shared is specified,
exportDynamic of most symbols is true. This makes it incapable to record
--dynamic-list marked symbols. We thus have obscure:

    if (!config->shared)
      b->exportDynamic = true;
    else if (b->includeInDynsym())
      b->isPreemptible = true;

This patch adds another bit `Symbol::inDynamicList` to record
3). We can thus simplify handleDynamicList() by unifying the DSO and
  executable cases. It also allows us to simplify isPreemptible - now
the field is only used in finalizeSections() and later stages.

Reviewed By: peter.smith

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

llvm-svn: 368659

5 years ago[NFC] Updated tests after r368657
David Bolvansky [Tue, 13 Aug 2019 09:12:07 +0000 (09:12 +0000)]
[NFC] Updated tests after r368657

llvm-svn: 368658

5 years ago[SimplifyLibCalls] Add dereferenceable bytes from known callsites
David Bolvansky [Tue, 13 Aug 2019 09:11:49 +0000 (09:11 +0000)]
[SimplifyLibCalls] Add dereferenceable bytes from known callsites

Summary:
int mm(char *a, char *b) {
    return memcmp(a,b,16);
}

Currently:
define dso_local i32 @mm(i8* nocapture readonly %a, i8* nocapture readonly %b) local_unnamed_addr #1 {
entry:
  %call = tail call i32 @memcmp(i8* %a, i8* %b, i64 16)
  ret i32 %call
}

After patch:
define dso_local i32 @mm(i8* nocapture readonly %a, i8* nocapture readonly %b) local_unnamed_addr #1 {
entry:
  %call = tail call i32 @memcmp(i8* dereferenceable(16)  %a, i8* dereferenceable(16)  %b, i64 16)
  ret i32 %call
}

Reviewers: jdoerfert, efriedma

Reviewed By: jdoerfert

Subscribers: javed.absar, spatel, llvm-commits

Tags: #llvm

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

llvm-svn: 368657

5 years ago[NFC][InstCombine] Non-canonical clamp pattern: non-canonical predicate tests
Roman Lebedev [Tue, 13 Aug 2019 08:14:13 +0000 (08:14 +0000)]
[NFC][InstCombine] Non-canonical clamp pattern: non-canonical predicate tests

We can't handle 'uge' case because we can't ever get it,
there needs to be extra use on that compare or else it will be
canonicalized, but because of extra use we can't handle it.

'sge' case we can have.

llvm-svn: 368656

5 years ago[ASTImporter] Import additional flags for functions.
Balazs Keri [Tue, 13 Aug 2019 08:04:06 +0000 (08:04 +0000)]
[ASTImporter] Import additional flags for functions.

Summary:
At AST import of function delcarations import the flags for defaulted
and deleted.

Reviewers: martong, a.sidorin, shafik, a_sidorin

Reviewed By: a_sidorin

Subscribers: rnkovacs, dkrupp, Szelethus, gamesh411, cfe-commits

Tags: #clang

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

llvm-svn: 368655

5 years ago[PowerPC] Fix ICE when truncating some vectors
Qiu Chaofan [Tue, 13 Aug 2019 07:53:29 +0000 (07:53 +0000)]
[PowerPC] Fix ICE when truncating some vectors

The legalizer would hit an assertion on PowerPC platform when truncating
a vector whose size is not power of 2.  This patch is to add a check to
prevent vectors with such odd-size elements from being custom lowered.

Reviewed By: Hal Finkel

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

llvm-svn: 368654

5 years ago[AArch64][GlobalISel] Replace explicit vreg creation with implicit using SrcOp. NFC.
Amara Emerson [Tue, 13 Aug 2019 06:55:32 +0000 (06:55 +0000)]
[AArch64][GlobalISel] Replace explicit vreg creation with implicit using SrcOp. NFC.

llvm-svn: 368653

5 years ago[GlobalISel] Make the InstructionSelector instance non-const, allowing state to be...
Amara Emerson [Tue, 13 Aug 2019 06:26:59 +0000 (06:26 +0000)]
[GlobalISel] Make the InstructionSelector instance non-const, allowing state to be maintained.

Currently we can't keep any state in the selector object that we get from
subtarget. As a result we have to plumb through all our variables through
multiple functions. This change makes it non-const and adds a virtual init()
method to allow further state to be captured for each target.

AArch64 makes use of this in this patch to cache a call to hasFnAttribute()
which is expensive to call, and is used on each selection of G_BRCOND.

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

llvm-svn: 368652

5 years ago[ELF] Rename odd variable names "New" after r365730. NFC
Fangrui Song [Tue, 13 Aug 2019 06:19:39 +0000 (06:19 +0000)]
[ELF] Rename odd variable names "New" after r365730. NFC

New -> newSym or newFlags

Reviewed By: atanasyan

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

llvm-svn: 368651

5 years agoAdded unit tests to check supported rounding modes
Serge Pavlov [Tue, 13 Aug 2019 05:21:18 +0000 (05:21 +0000)]
Added unit tests to check supported rounding modes

Also added fixed misspelled metadata name.

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

llvm-svn: 368650

5 years ago[ELF][test] Add dynamic-list-preempt2.s
Fangrui Song [Tue, 13 Aug 2019 05:08:46 +0000 (05:08 +0000)]
[ELF][test] Add dynamic-list-preempt2.s

When producing a DSO, the isPreemptible property of a Defined with
default or protected visibility is affected by the --dynamic-list file,
but not by interposable symbols in other DSOs.

llvm-svn: 368649

5 years ago[GlobalISel]: Add KnownBits for G_XOR
Aditya Nandakumar [Tue, 13 Aug 2019 04:32:33 +0000 (04:32 +0000)]
[GlobalISel]: Add KnownBits for G_XOR

https://reviews.llvm.org/D66119

llvm-svn: 368648

5 years agoVerifier: check prof branch_weights
Yevgeny Rouban [Tue, 13 Aug 2019 04:03:38 +0000 (04:03 +0000)]
Verifier: check prof branch_weights

This patch is to check some of constraints on
!pro branch_weights metadata:
https://llvm.org/docs/BranchWeightMetadata.html

Reviewers: asbirlea, reames, chandlerc
Reviewed By: reames
Differential Revision: https://reviews.llvm.org/D61179

llvm-svn: 368647

5 years agoDo not call replaceAllUsesWith to upgrade calls to ARC runtime functions
Akira Hatanaka [Tue, 13 Aug 2019 01:23:06 +0000 (01:23 +0000)]
Do not call replaceAllUsesWith to upgrade calls to ARC runtime functions
to intrinsic calls

This fixes a bug in r368311.

It turns out that the ARC runtime functions in the IR can have pointer
parameter types that are not i8* or i8**. Instead of RAUWing normal
functions with intrinsics, manually bitcast the arguments before passing
them to the intrinsic functions and bitcast the return value back to the
type of the original call instruction.

This recommits r368634, which was reverted in r368637. The loop in the
patch was iterating over uses of a function and deleting function calls
inside it, which caused bots to crash.

rdar://problem/54125406

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

llvm-svn: 368646

5 years ago[AMDGPU] Fix msan failure in printf lowering
Stanislav Mekhanoshin [Tue, 13 Aug 2019 01:07:27 +0000 (01:07 +0000)]
[AMDGPU] Fix msan failure in printf lowering

llvm-svn: 368645

5 years ago[lld] Remove unnecessary "class Lazy"
Bob Haarman [Tue, 13 Aug 2019 01:02:30 +0000 (01:02 +0000)]
[lld] Remove unnecessary "class Lazy"

llvm-svn: 368644

5 years agoEliminate implicit Register->unsigned conversions in VirtRegMap. NFC
Daniel Sanders [Tue, 13 Aug 2019 00:55:24 +0000 (00:55 +0000)]
Eliminate implicit Register->unsigned conversions in VirtRegMap. NFC

Summary:
This was mostly an experiment to assess the feasibility of completely
eliminating a problematic implicit conversion case in D61321 in advance of
landing that* but it also happens to align with the goal of propagating the
use of Register/MCRegister instead of unsigned so I believe it makes sense
to commit it.

The overall process for eliminating the implicit conversions from
Register/MCRegister -> unsigned was to:
1. Add an explicit conversion to support genuinely required conversions to
   unsigned. For example, using them as an index for IndexedMap. Sadly it's
   not possible to have an explicit and implicit conversion to the same
   type and only deprecate the implicit one so I called the explicit
   conversion get().
2. Temporarily annotate the implicit conversion to unsigned with
   LLVM_ATTRIBUTE_DEPRECATED to make them visible
3. Eliminate implicit conversions by propagating Register/MCRegister/
   explicit-conversions appropriately
4. Remove the deprecation added in 2.

* My conclusion is that it isn't feasible as there's too much code to
  update in one go.

Depends on D65678

Reviewers: arsenm

Subscribers: MatzeB, wdng, hiraditya, llvm-commits

Tags: #llvm

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

llvm-svn: 368643

5 years ago[TSan] Fix test failing on Linux
Julian Lettner [Tue, 13 Aug 2019 00:37:48 +0000 (00:37 +0000)]
[TSan] Fix test failing on Linux

llvm-svn: 368641

5 years agoclang-scan-deps: do not spawn threads when LLVM_ENABLE_THREADS is disabled
Alex Lorenz [Tue, 13 Aug 2019 00:36:35 +0000 (00:36 +0000)]
clang-scan-deps: do not spawn threads when LLVM_ENABLE_THREADS is disabled

llvm-svn: 368640

5 years ago[Symbol] Remove redundant include
Alex Langford [Tue, 13 Aug 2019 00:25:49 +0000 (00:25 +0000)]
[Symbol] Remove redundant include

llvm-svn: 368638

5 years agoRevert "Do not call replaceAllUsesWith to upgrade calls to ARC runtime functions"
Akira Hatanaka [Tue, 13 Aug 2019 00:20:36 +0000 (00:20 +0000)]
Revert "Do not call replaceAllUsesWith to upgrade calls to ARC runtime functions"

This reverts commit r368634 because it broke a bot.

llvm-svn: 368637

5 years agoMove findBBwithCalls to the file it's used in to avoid unused function
Eric Christopher [Tue, 13 Aug 2019 00:05:01 +0000 (00:05 +0000)]
Move findBBwithCalls to the file it's used in to avoid unused function
warnings.

llvm-svn: 368636

5 years ago[X86] Remove 'Server' from Tigerlake description comments.
Craig Topper [Tue, 13 Aug 2019 00:00:27 +0000 (00:00 +0000)]
[X86] Remove 'Server' from Tigerlake description comments.

Tigerlake is a client CPU not a server CPU.

llvm-svn: 368635

5 years agoDo not call replaceAllUsesWith to upgrade calls to ARC runtime functions
Akira Hatanaka [Mon, 12 Aug 2019 23:53:23 +0000 (23:53 +0000)]
Do not call replaceAllUsesWith to upgrade calls to ARC runtime functions
to intrinsic calls

This fixes a bug in r368311.

It turns out that the ARC runtime functions in the IR can have pointer
parameter types that are not i8* or i8**. Instead of RAUWing normal
functions with intrinsics, manually bitcast the arguments before passing
them to the intrinsic functions and bitcast the return value back to the
type of the original call instruction.

rdar://problem/54125406

llvm-svn: 368634

5 years ago[AMDGPU] removed unused functions from printf lowering
Stanislav Mekhanoshin [Mon, 12 Aug 2019 23:32:35 +0000 (23:32 +0000)]
[AMDGPU] removed unused functions from printf lowering

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

llvm-svn: 368633

5 years ago[clang] Update isDerivedFrom to support Objective-C classes 🔍
Stephane Moore [Mon, 12 Aug 2019 23:23:35 +0000 (23:23 +0000)]
[clang] Update isDerivedFrom to support Objective-C classes 🔍

Summary:
This change updates `isDerivedFrom` to support Objective-C classes by
converting it to a polymorphic matcher.

Notes:
The matching behavior for Objective-C classes is modeled to match the
behavior of `isDerivedFrom` with C++ classes. To that effect,
`isDerivedFrom` matches aliased types of derived Objective-C classes,
including compatibility aliases. To achieve this, the AST visitor has
been updated to map compatibility aliases to their underlying
Objective-C class.

`isSameOrDerivedFrom` also provides similar behaviors for C++ and
Objective-C classes. The behavior that
`cxxRecordDecl(isSameOrDerivedFrom("X"))` does not match
`class Y {}; typedef Y X;` is mirrored for Objective-C in that
`objcInterfaceDecl(isSameOrDerivedFrom("X"))` does not match either
`@interface Y @end typedef Y X;` or
`@interface Y @end @compatibility_alias X Y;`.

Test Notes:
Ran clang unit tests.

Reviewers: aaron.ballman, jordan_rose, rjmccall, klimek, alexfh, gribozavr

Reviewed By: aaron.ballman, gribozavr

Subscribers: cfe-commits

Tags: #clang

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

llvm-svn: 368632

5 years ago[WinEH] Fix catch block parent frame pointer offset
Reid Kleckner [Mon, 12 Aug 2019 23:02:00 +0000 (23:02 +0000)]
[WinEH] Fix catch block parent frame pointer offset

r367088 made it so that funclets store XMM registers into their local
frame instead of storing them to the parent frame. However, that change
forgot to update the parent frame pointer offset for catch blocks. This
change does that.

Fixes crashes when an exception is rethrown in a catch block that saves
XMMs, as described in https://crbug.com/992860.

llvm-svn: 368631

5 years ago[TextAPI] Fix & Add tests for tbd files version 3.
Juergen Ributzka [Mon, 12 Aug 2019 23:01:07 +0000 (23:01 +0000)]
[TextAPI] Fix & Add tests for tbd files version 3.

- There was a simple typo in TextStub code that prevented version 3 files to be read.
- Included a version 3 unit test to handle the differences in the format.
- Also a typo in Error.h inside the comments.

https://reviews.llvm.org/D66041

This patch is from Cyndy Ishida <cyndy_ishida@apple.com>.

llvm-svn: 368630

5 years ago[risc-v] Apply llvm-prefer-register-over-unsigned from clang-tidy to LLVM
Daniel Sanders [Mon, 12 Aug 2019 22:41:02 +0000 (22:41 +0000)]
[risc-v] Apply llvm-prefer-register-over-unsigned from clang-tidy to LLVM

Summary:
This clang-tidy check is looking for unsigned integer variables whose initializer
starts with an implicit cast from llvm::Register and changes the type of the
variable to llvm::Register (dropping the llvm:: where possible).

Depends on D65919

Reviewers: lenary

Subscribers: jholewinski, MatzeB, qcolombet, dschuff, jyknight, dylanmckay, sdardis, nemanjai, jvesely, wdng, nhaehnle, sbc100, jgravelle-google, kristof.beyls, hiraditya, aheejin, kbarton, fedor.sergeev, javed.absar, asb, rbar, johnrusso, simoncook, apazos, sabuasal, niosHD, jrtc27, MaskRay, zzheng, edward-jones, atanasyan, rogfer01, MartinMosbeck, brucehoult, the_o, tpr, PkmX, jocewei, jsji, Petar.Avramovic, asbirlea, Jim, s.egerton, llvm-commits

Tags: #llvm

Differential Revision for full review was: https://reviews.llvm.org/D65962

llvm-svn: 368629

5 years ago[aarch64] Apply llvm-prefer-register-over-unsigned from clang-tidy to LLVM
Daniel Sanders [Mon, 12 Aug 2019 22:40:53 +0000 (22:40 +0000)]
[aarch64] Apply llvm-prefer-register-over-unsigned from clang-tidy to LLVM

Summary:
This clang-tidy check is looking for unsigned integer variables whose initializer
starts with an implicit cast from llvm::Register and changes the type of the
variable to llvm::Register (dropping the llvm:: where possible).

Manual fixups in:
AArch64InstrInfo.cpp - genFusedMultiply() now takes a Register* instead of unsigned*
AArch64LoadStoreOptimizer.cpp - Ternary operator was ambiguous between Register/MCRegister. Settled on Register

Depends on D65919

Reviewers: aemerson

Subscribers: jholewinski, MatzeB, qcolombet, dschuff, jyknight, dylanmckay, sdardis, nemanjai, jvesely, wdng, nhaehnle, sbc100, jgravelle-google, kristof.beyls, hiraditya, aheejin, kbarton, fedor.sergeev, javed.absar, asb, rbar, johnrusso, simoncook, apazos, sabuasal, niosHD, jrtc27, MaskRay, zzheng, edward-jones, atanasyan, rogfer01, MartinMosbeck, brucehoult, the_o, tpr, PkmX, jocewei, jsji, Petar.Avramovic, asbirlea, Jim, s.egerton, llvm-commits

Tags: #llvm

Differential Revision for full review was: https://reviews.llvm.org/D65962

llvm-svn: 368628

5 years ago[webassembly] Apply llvm-prefer-register-over-unsigned from clang-tidy to LLVM
Daniel Sanders [Mon, 12 Aug 2019 22:40:45 +0000 (22:40 +0000)]
[webassembly] Apply llvm-prefer-register-over-unsigned from clang-tidy to LLVM

Summary:
This clang-tidy check is looking for unsigned integer variables whose initializer
starts with an implicit cast from llvm::Register and changes the type of the
variable to llvm::Register (dropping the llvm:: where possible).

Reviewers: aheejin

Subscribers: jholewinski, MatzeB, qcolombet, dschuff, jyknight, dylanmckay, sdardis, nemanjai, jvesely, wdng, nhaehnle, sbc100, jgravelle-google, kristof.beyls, hiraditya, aheejin, kbarton, fedor.sergeev, javed.absar, asb, rbar, johnrusso, simoncook, apazos, sabuasal, niosHD, jrtc27, MaskRay, zzheng, edward-jones, atanasyan, rogfer01, MartinMosbeck, brucehoult, the_o, tpr, PkmX, jocewei, jsji, Petar.Avramovic, asbirlea, Jim, s.egerton, llvm-commits

Tags: #llvm

Differential Revision for whole review: https://reviews.llvm.org/D65962

llvm-svn: 368627

5 years ago[AMDGPU] Use PredicateControl in MIMGBaseOpcode. NFC.
Stanislav Mekhanoshin [Mon, 12 Aug 2019 22:32:21 +0000 (22:32 +0000)]
[AMDGPU] Use PredicateControl in MIMGBaseOpcode. NFC.

This is infrastructural, will be needed for future work.
For some reason it was only used in MIMG_NoSampler, while
needed everywere we use MIMGBaseOpcode if we want to use
predicates.

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

llvm-svn: 368626

5 years ago[Attributor] Use the cached data layout directly
Johannes Doerfert [Mon, 12 Aug 2019 22:21:09 +0000 (22:21 +0000)]
[Attributor] Use the cached data layout directly

This removes the warning by using the new DL member.
It also simplifies the code.

llvm-svn: 368625

5 years agoTitle: Fix build warning for operator<< when using GCC 7.
Whitney Tsang [Mon, 12 Aug 2019 22:20:54 +0000 (22:20 +0000)]
Title: Fix build warning for operator<< when using GCC 7.
Authored By: etiotto
Differential Revision: https://reviews.llvm.org/D63459

llvm-svn: 368624

5 years ago[X86] Allow combineTruncateWithSat to use pack instructions for i16->i8 without AVX512BW.
Craig Topper [Mon, 12 Aug 2019 22:18:23 +0000 (22:18 +0000)]
[X86] Allow combineTruncateWithSat to use pack instructions for i16->i8 without AVX512BW.

We need AVX512BW to be able to truncate an i16 vector. If we don't
have that we have to extend i16->i32, then trunc, i32->i8. But we
won't be able to remove the min/max if we do that. At least not
without more special handling.

llvm-svn: 368623

5 years ago[Attributor][NFC] Add IntegerState raw_ostream << operator
Johannes Doerfert [Mon, 12 Aug 2019 22:07:34 +0000 (22:07 +0000)]
[Attributor][NFC] Add IntegerState raw_ostream << operator

llvm-svn: 368622

5 years ago[Attributor] Make the InformationCache an Attributor member
Johannes Doerfert [Mon, 12 Aug 2019 22:05:53 +0000 (22:05 +0000)]
[Attributor] Make the InformationCache an Attributor member

The functionality is not changed but the interfaces are simplified and
repetition is removed.

llvm-svn: 368621

5 years ago[CompilerType] Pass an ExecutionContextScope to GetTypeBitAlign.
Davide Italiano [Mon, 12 Aug 2019 21:49:54 +0000 (21:49 +0000)]
[CompilerType] Pass an ExecutionContextScope to GetTypeBitAlign.

llvm-svn: 368620

5 years ago[GWP-ASan] Update backtrace function signature.
Mitch Phillips [Mon, 12 Aug 2019 21:36:44 +0000 (21:36 +0000)]
[GWP-ASan] Update backtrace function signature.

Summary:
Updates the function signature and comments for backtracing (and printing
backtraces). This update brings GWP-ASan in line with future requirements for
stack frame compression, wherein the length of the trace is provided
explicitly, rather than relying on nullptr-termination.

Reviewers: vlad.tsyrklevich

Reviewed By: vlad.tsyrklevich

Subscribers: #sanitizers, llvm-commits, morehouse

Tags: #sanitizers, #llvm

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

llvm-svn: 368619

5 years ago[GISel]: Fix a bug in KnownBits where we should have been using SizeInBits
Aditya Nandakumar [Mon, 12 Aug 2019 21:28:12 +0000 (21:28 +0000)]
[GISel]: Fix a bug in KnownBits where we should have been using SizeInBits

https://reviews.llvm.org/D66039

We were using getIndexSize instead of getIndexSizeInBits().
Added test case for G_PTRTOINT and G_INTTOPTR.

llvm-svn: 368618

5 years ago[libFuzzer] Merge: print feature coverage number as well.
Max Moroz [Mon, 12 Aug 2019 20:21:27 +0000 (20:21 +0000)]
[libFuzzer] Merge: print feature coverage number as well.

Summary:
feature coverage is a useful signal that is available during the merge
process, but was not printed previously.

Output example:

```
$ ./fuzzer -use_value_profile=1 -merge=1 new_corpus/ seed_corpus/
INFO: Seed: 1676551929
INFO: Loaded 1 modules   (2380 inline 8-bit counters): 2380 [0x90d180, 0x90dacc),
INFO: Loaded 1 PC tables (2380 PCs): 2380 [0x684018,0x68d4d8),
MERGE-OUTER: 180 files, 78 in the initial corpus
MERGE-OUTER: attempt 1
INFO: Seed: 1676574577
INFO: Loaded 1 modules   (2380 inline 8-bit counters): 2380 [0x90d180, 0x90dacc),
INFO: Loaded 1 PC tables (2380 PCs): 2380 [0x684018,0x68d4d8),
INFO: -max_len is not provided; libFuzzer will not generate inputs larger than 1048576 bytes
MERGE-INNER: using the control file '/tmp/libFuzzerTemp.111754.txt'
MERGE-INNER: 180 total files; 0 processed earlier; will process 180 files now
#1 pulse  cov: 134 ft: 330 exec/s: 0 rss: 37Mb
#2 pulse  cov: 142 ft: 462 exec/s: 0 rss: 38Mb
#4 pulse  cov: 152 ft: 651 exec/s: 0 rss: 38Mb
#8 pulse  cov: 152 ft: 943 exec/s: 0 rss: 38Mb
#16 pulse  cov: 520 ft: 2783 exec/s: 0 rss: 39Mb
#32 pulse  cov: 552 ft: 3280 exec/s: 0 rss: 41Mb
#64 pulse  cov: 576 ft: 3641 exec/s: 0 rss: 50Mb
#78 LOADED cov: 602 ft: 3936 exec/s: 0 rss: 88Mb
#128 pulse  cov: 611 ft: 3996 exec/s: 0 rss: 93Mb
#180 DONE   cov: 611 ft: 4016 exec/s: 0 rss: 155Mb
MERGE-OUTER: succesfull in 1 attempt(s)
MERGE-OUTER: the control file has 39741 bytes
MERGE-OUTER: consumed 0Mb (37Mb rss) to parse the control file
MERGE-OUTER: 9 new files with 80 new features added; 9 new coverage edges
```

Reviewers: hctim, morehouse

Reviewed By: morehouse

Subscribers: delcypher, #sanitizers, llvm-commits, kcc

Tags: #llvm, #sanitizers

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

llvm-svn: 368617

5 years agoRevert "[lldb] Refactor guard variable checks in IRForTarget"
Stella Stamenova [Mon, 12 Aug 2019 20:08:07 +0000 (20:08 +0000)]
Revert "[lldb] Refactor guard variable checks in IRForTarget"

This reverts commit 94fbbf712e906464f5f3abbeabcfcbc05d5352ec.

llvm-svn: 368616