platform/upstream/llvm.git
5 years agoTableGen/ISel: Allow PatFrag predicate code to access captured operands
Nicolai Haehnle [Fri, 30 Nov 2018 14:15:13 +0000 (14:15 +0000)]
TableGen/ISel: Allow PatFrag predicate code to access captured operands

Summary:
This simplifies writing predicates for pattern fragments that are
automatically re-associated or commuted.

For example, a followup patch adds patterns for fragments of the form
(add (shl $x, $y), $z) to the AMDGPU backend. Such patterns are
automatically commuted to (add $z, (shl $x, $y)), which makes it basically
impossible to refer to $x, $y, and $z generically in the PredicateCode.

With this change, the PredicateCode can refer to $x, $y, and $z simply
as `Operands[i]`.

Test confirmed that there are no changes to any of the generated files
when building all (non-experimental) targets.

Change-Id: I61c00ace7eed42c1d4edc4c5351174b56b77a79c

Reviewers: arsenm, rampitec, RKSimon, craig.topper, hfinkel, uweigand

Subscribers: wdng, tpr, llvm-commits

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

llvm-svn: 347992

5 years ago[RISCV] Add additional CSR instruction aliases (imm. operands)
Alex Bradbury [Fri, 30 Nov 2018 14:10:52 +0000 (14:10 +0000)]
[RISCV] Add additional CSR instruction aliases (imm. operands)

This patch adds CSR instructions aliases for the cases where the instruction
takes an immediate operand but the alias doesn't have the i suffix. This is
necessary for gas/gcc compatibility.

gas doesn't do a similar conversion for fsflags or fsrm, so this should be
complete.

Differential Revision: https://reviews.llvm.org/D55008
Patch by Luís Marques.

llvm-svn: 347991

5 years agoFix parenthesis warning in IVDescriptors
Renato Golin [Fri, 30 Nov 2018 13:54:36 +0000 (13:54 +0000)]
Fix parenthesis warning in IVDescriptors

llvm-svn: 347990

5 years agoAdd a new reduction pattern match
Renato Golin [Fri, 30 Nov 2018 13:40:10 +0000 (13:40 +0000)]
Add a new reduction pattern match

Adding a new reduction pattern match for vectorizing code similar
to TSVC s3111:

for (int i = 0; i < N; i++)
  if (a[i] > b)
    sum += a[i];

This patch adds support for fadd, fsub and fmull, as well as multiple
branches and different (but compatible) instructions (ex. add+sub) in
different branches.

The difference from the previous patch(https://reviews.llvm.org/D49168)
is as follows:
 - Added check of fast-math property of fp-instruction to the
   previous patch
 - Fix/add some pattern for if-reduction.ll

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

Patch by Takahiro Miyoshi <takahiro.miyoshi@linaro.org>
     and Masakazu Ueno <masakazu.ueno@linaro.org>

llvm-svn: 347989

5 years ago[RISCV] Add UNIMP instruction (32- and 16-bit forms)
Alex Bradbury [Fri, 30 Nov 2018 13:39:17 +0000 (13:39 +0000)]
[RISCV] Add UNIMP instruction (32- and 16-bit forms)

This patch adds support for UNIMP in both 32- and 16-bit forms. The 32-bit
form can be seen as a variant of the ECALL/EBREAK/etc. family of instructions.
The 16-bit form is just all zeroes, which isn't a valid RISC-V instruction,
but still follows the 16-bit instruction form (i.e. bits 0-1 != 11).

Until recently unimp was undocumented and supported just by binutils, which
printed unimp for either the 16 or 32-bit form. Both forms are now documented
<https://github.com/riscv/riscv-asm-manual/pull/20> and binutils now supports
c.unimp <https://sourceware.org/ml/binutils-cvs/2018-11/msg00179.html>.

Differential Revision: https://reviews.llvm.org/D54316
Patch by Luís Marques.

llvm-svn: 347988

5 years agoFix warning about unused variable [NFC]
Mikael Holmen [Fri, 30 Nov 2018 13:38:33 +0000 (13:38 +0000)]
Fix warning about unused variable [NFC]

llvm-svn: 347987

5 years ago[SelectionDAG] Support result type promotion for FLT_ROUNDS_
Alex Bradbury [Fri, 30 Nov 2018 13:18:33 +0000 (13:18 +0000)]
[SelectionDAG] Support result type promotion for FLT_ROUNDS_

For targets where i32 is not a legal type (e.g. 64-bit RISC-V),
LegalizeIntegerTypes must promote the result of ISD::FLT_ROUNDS_.

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

llvm-svn: 347986

5 years ago[llvm-mca] Simplify code in class Scheduler. NFCI
Andrea Di Biagio [Fri, 30 Nov 2018 12:49:30 +0000 (12:49 +0000)]
[llvm-mca] Simplify code in class Scheduler. NFCI

llvm-svn: 347985

5 years ago[clangd] Penalize destructor and overloaded operators in code completion.
Eric Liu [Fri, 30 Nov 2018 11:17:15 +0000 (11:17 +0000)]
[clangd] Penalize destructor and overloaded operators in code completion.

Reviewers: hokein

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

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

llvm-svn: 347983

5 years ago[clangd] Drop injected class name when class scope is not explicitly specified.
Eric Liu [Fri, 30 Nov 2018 11:12:40 +0000 (11:12 +0000)]
[clangd] Drop injected class name when class scope is not explicitly specified.

Summary: E.g. allow injected "A::A" in `using A::A^` but not in "A^".

Reviewers: kadircet

Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, cfe-commits

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

llvm-svn: 347982

5 years agolyzer] [HOTFIX!] SValBuilder crash when `aggressive-binary-operation-simplification...
Adam Balogh [Fri, 30 Nov 2018 10:37:44 +0000 (10:37 +0000)]
lyzer] [HOTFIX!] SValBuilder crash when `aggressive-binary-operation-simplification` enabled

During the review of D41938 a condition check with an early exit accidentally
slipped into a branch, leaving the other branch unprotected. This may result in
an assertion later on. This hotfix moves this contition check outside of the
branch.

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

llvm-svn: 347981

5 years ago[SelectionDAG] Support promotion of PREFETCH operands
Alex Bradbury [Fri, 30 Nov 2018 10:06:31 +0000 (10:06 +0000)]
[SelectionDAG] Support promotion of PREFETCH operands

For targets where i32 is not a legal type (e.g. 64-bit RISC-V),
LegalizeIntegerTypes must promote the operands of ISD::PREFETCH.

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

llvm-svn: 347980

5 years ago[LoopSimplifyCFG] Update MemorySSA in terminator folding. PR39783
Max Kazantsev [Fri, 30 Nov 2018 10:06:23 +0000 (10:06 +0000)]
[LoopSimplifyCFG] Update MemorySSA in terminator folding. PR39783

Terminator folding transform lacks MemorySSA update for memory Phis,
while they exist within MemorySSA analysis. They need exactly the same
type of updates as regular Phis. Failing to update them properly ends up
with inconsistent MemorySSA and manifests in various assertion failures.

This patch adds Memory Phi updates to this transform.

Thanks to @jonpa for finding this!

Differential Revision: https://reviews.llvm.org/D55050
Reviewed By: asbirlea

llvm-svn: 347979

5 years ago[SelectionDAG] Support promotion of FRAMEADDR/RETURNADDR operands
Alex Bradbury [Fri, 30 Nov 2018 10:02:06 +0000 (10:02 +0000)]
[SelectionDAG] Support promotion of FRAMEADDR/RETURNADDR operands

For targets where i32 is not a legal type (e.g. 64-bit RISC-V),
LegalizeIntegerTypes must promote the operand.

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

llvm-svn: 347978

5 years ago[TargetLowering][RISCV] Introduce isSExtCheaperThanZExt hook and implement for RISC-V
Alex Bradbury [Fri, 30 Nov 2018 09:56:54 +0000 (09:56 +0000)]
[TargetLowering][RISCV] Introduce isSExtCheaperThanZExt hook and implement for RISC-V

DAGTypeLegalizer::PromoteSetCCOperands currently prefers to zero-extend
operands when it is able to do so. For some targets this is more expensive
than a sign-extension, which is also a valid choice. Introduce the
isSExtCheaperThanZExt hook and use it in the new SExtOrZExtPromotedInteger
helper. On RISC-V, we prefer sign-extension for FromTy == MVT::i32 and ToTy ==
MVT::i64, as it can be performed using a single instruction.

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

llvm-svn: 347977

5 years ago[NFC] Simplify and reduce tests for PR39783
Max Kazantsev [Fri, 30 Nov 2018 09:51:25 +0000 (09:51 +0000)]
[NFC] Simplify and reduce tests for PR39783

llvm-svn: 347976

5 years ago[NativePDB] Fix ast-reconstruction test on x86
Aleksandr Urakov [Fri, 30 Nov 2018 09:50:11 +0000 (09:50 +0000)]
[NativePDB] Fix ast-reconstruction test on x86

Summary:
This patch fixes ast-reconstruction.cpp test on x86 platform.

Patch by: leonid.mashinskiy

Reviewers: zturner, stella.stamenova

Reviewed By: zturner

Subscribers: aleksandr.urakov, lldb-commits

Tags: #lldb

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

llvm-svn: 347975

5 years ago[Target] Do not skip a stop on a breakpoint if a plan was completed
Aleksandr Urakov [Fri, 30 Nov 2018 09:45:52 +0000 (09:45 +0000)]
[Target] Do not skip a stop on a breakpoint if a plan was completed

Summary:
This patch fixes the next situation. On Windows clang-cl makes no stub before
the main function, so the main function is located exactly on module entry
point. May be it is the same on other platforms. So consider the following
sequence:

- set a breakpoint on main and stop there;
- try to evaluate expression, which requires a code execution on the debuggee
  side. Such an execution always returns to the module entry, and the plan waits
  for it there;
- the plan understands that it is complete now and removes its breakpoint. But
  the breakpoint site is still there, because we also have a breakpoint on
  entry;
- StopInfo analyzes a situation. It sees that we have stopped on the breakpoint
  site, and it sees that the breakpoint site has owners, and no one logical
  breakpoint is internal (because the plan is already completed and it have
  removed its breakpoint);
- StopInfo thinks that it's a user breakpoint and skips it to avoid recursive
  computations;
- the program continues.

So in this situation the program continues without a stop right after
the expression evaluation. To avoid this an additional check that
the plan was completed was added.

Reviewers: jingham, zturner, boris.ulasevich

Reviewed by: jingham

Tags: #lldb

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

llvm-svn: 347974

5 years ago[RISCV] Introduce codegen patterns for instructions introduced in RV64I
Alex Bradbury [Fri, 30 Nov 2018 09:38:44 +0000 (09:38 +0000)]
[RISCV] Introduce codegen patterns for instructions introduced in RV64I

As discussed in the RFC
<http://lists.llvm.org/pipermail/llvm-dev/2018-October/126690.html>, 64-bit
RISC-V has i64 as the only legal integer type.  This patch introduces patterns
to support codegen of the new instructions
introduced in RV64I: addiw, addiw, subw, sllw, slliw, srlw, srliw, sraw,
sraiw, ld, sd.

Custom selection code is needed for srliw as SimplifyDemandedBits will remove
lower bits from the mask, meaning the obvious pattern won't work:

def : Pat<(sext_inreg (srl (and GPR:$rs1, 0xffffffff), uimm5:$shamt), i32),
          (SRLIW GPR:$rs1, uimm5:$shamt)>;
This is sufficient to compile and execute all of the GCC torture suite for
RV64I other than those files using frameaddr or returnaddr intrinsics
(LegalizeDAG doesn't know how to promote the operands - a future patch
addresses this).

When promoting i32 sltu/sltiu operands, it would be more efficient to use
sign-extension rather than zero-extension for RV64. A future patch adds a hook
to allow this.

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

llvm-svn: 347973

5 years ago[docs][AtomicExpandPass] Document the alternate lowering strategy for part-word atomi...
Alex Bradbury [Fri, 30 Nov 2018 09:23:24 +0000 (09:23 +0000)]
[docs][AtomicExpandPass] Document the alternate lowering strategy for part-word atomicrmw/cmpxchg

D47882, D48130 and D48131 introduce a new lowering strategy for part-word
atomicrmw/cmpxchg and uses it to lower these operations for the RISC-V target.
Rather than having AtomicExpandPass produce the LL/SC loop in the IR level, it
instead calculates the necessary mask values and inserts a target-specific
intrinsic, which is lowered at a much later stage (after register allocation).
This ensures that architecture-specific restrictions for forward-progress in
LL/SC loops can be guaranteed.

This patch documents this new AtomicExpandPass functionality. See the previous
llvm-dev RFC for more info
<http://lists.llvm.org/pipermail/llvm-dev/2018-June/123993.html>.

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

llvm-svn: 347971

5 years agoFix a use-after-scope bug.
Haojian Wu [Fri, 30 Nov 2018 09:23:01 +0000 (09:23 +0000)]
Fix a use-after-scope bug.

llvm-svn: 347970

5 years ago[clangd] Bump vscode-clangd v0.0.8
Haojian Wu [Fri, 30 Nov 2018 09:18:31 +0000 (09:18 +0000)]
[clangd] Bump vscode-clangd v0.0.8

llvm-svn: 347969

5 years ago[clangd] Fix junk output in clangd vscode plugin
Haojian Wu [Fri, 30 Nov 2018 09:14:52 +0000 (09:14 +0000)]
[clangd] Fix junk output in clangd vscode plugin

Summary:
When using the vscode clangd plugin, lots and lots of junk output is printed to the output window, which constantly reopens itself.
Example output:

I[11:13:17.733] <-- textDocument/codeAction(4)
I[11:13:17.733] --> reply:textDocument/codeAction(4) 0 ms
I[11:13:17.937] <-- textDocument/codeAction(5)
I[11:13:17.937] --> reply:textDocument/codeAction(5) 0 ms
I[11:13:18.557] <-- textDocument/hover(6)
I[11:13:18.606] --> reply:textDocument/hover(6) 48 ms

This should prevent that from happening.

Patch by James Findley!

Reviewers: ioeric, ilya-biryukov, hokein

Reviewed By: ioeric

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

Tags: #clang-tools-extra

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

llvm-svn: 347968

5 years ago[X86] Emit PACKUS directly from the v16i8 LowerMULH code instead of using a shuffle.
Craig Topper [Fri, 30 Nov 2018 08:32:05 +0000 (08:32 +0000)]
[X86] Emit PACKUS directly from the v16i8 LowerMULH code instead of using a shuffle.

llvm-svn: 347967

5 years ago[X86] Change the pre-sse4.1 code in the v16i8 MULHU lowering to be what we get after...
Craig Topper [Fri, 30 Nov 2018 08:32:01 +0000 (08:32 +0000)]
[X86] Change the pre-sse4.1 code in the v16i8 MULHU lowering to be what we get after DAG combine cleans it up.

Previously we emitted a punpcklbw/punpckhbw to move the byte elements into the upper half of 16 bit elements then shifted right by 8 to zero the upper bits. After DAG combine we end up with punpcklbw/punpckhbw into the lower bits with zeros in the uppers bits and no shifts. So just emit that directly.

llvm-svn: 347966

5 years ago[ARM] Don't expand sdiv when optimising for minsize
Sjoerd Meijer [Fri, 30 Nov 2018 08:14:28 +0000 (08:14 +0000)]
[ARM] Don't expand sdiv when optimising for minsize

Don't expand SDIV with an immediate that is a power of 2 if we optimise for
minimum code size. For example:

sdiv %1, i32 4

gets expanded to a sequence of 3 instructions, but this is suboptimal for
minimum code size so instead we just generate a MOV and a SDIV if integer
division is supported.

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

llvm-svn: 347965

5 years ago[CodeGen] Fix bugs in BranchFolderPass when debug labels are generated.
Hsiangkai Wang [Fri, 30 Nov 2018 08:07:29 +0000 (08:07 +0000)]
[CodeGen] Fix bugs in BranchFolderPass when debug labels are generated.

Skip DBG_VALUE and DBG_LABEL in branch folding algorithms.

The bug is reported in
https://bugs.chromium.org/p/chromium/issues/detail?id=898160.

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

llvm-svn: 347964

5 years ago[NFC] Refine doxygen format.
Hsiangkai Wang [Fri, 30 Nov 2018 08:07:24 +0000 (08:07 +0000)]
[NFC] Refine doxygen format.

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

llvm-svn: 347963

5 years ago[PDB] Support PDB-backed expressions evaluation
Aleksandr Urakov [Fri, 30 Nov 2018 07:12:22 +0000 (07:12 +0000)]
[PDB] Support PDB-backed expressions evaluation

Summary:
This patch contains several small fixes, which makes it possible to evaluate
expressions on Windows using information from PDB. The changes are:
- several sanitize checks;
- make IRExecutionUnit::MemoryManager::getSymbolAddress to not return a magic
  value on a failure, because callers wait 0 in this case;
- entry point required to be a file address, not RVA, in the ObjectFilePECOFF;
- do not crash on a debuggee second chance exception - it may be an expression
  evaluation crash;
- create parameter declarations for functions in AST to make it possible to call
  debugee functions from expressions;
- relax name searching rules for variables, functions, namespaces and types. Now
  it works just like in the DWARF plugin;
- fix endless recursion in SymbolFilePDB::ParseCompileUnitFunctionForPDBFunc.

Reviewers: zturner, asmith, stella.stamenova

Reviewed By: stella.stamenova, asmith

Tags: #lldb

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

llvm-svn: 347962

5 years ago[SystemZ::TTI] i8/i16 operands extension costs revisited
Jonas Paulsson [Fri, 30 Nov 2018 07:09:34 +0000 (07:09 +0000)]
[SystemZ::TTI] i8/i16 operands extension costs revisited

Three minor changes to these extra costs:

* For ICmp instructions, instead of adding 2 all the time for extending each
  operand, this is only done if that operand is neither a load or an
  immediate.

* The operands extension costs for divides removed, because we now use a high
  cost already for the divide (20).

* The costs for lhsr/ashr extra costs removed as this did not seem useful.

Review: Ulrich Weigand
https://reviews.llvm.org/D55053

llvm-svn: 347961

5 years ago[Symbol] Search symbols with name and type in a symbol file
Aleksandr Urakov [Fri, 30 Nov 2018 06:56:37 +0000 (06:56 +0000)]
[Symbol] Search symbols with name and type in a symbol file

Summary:
This patch adds possibility of searching a public symbol with name and type in
a symbol file, not only in a symtab. It is helpful when working with PE, because
PE's symtabs contain only imported / exported symbols only. Such a search is
required for e.g. evaluation of an expression that calls some function of
the debuggee.

Reviewers: zturner, asmith, labath, clayborg, espindola

Reviewed By: clayborg

Subscribers: davide, emaste, arichardson, aleksandr.urakov, jingham,
             lldb-commits, stella.stamenova

Tags: #lldb

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

llvm-svn: 347960

5 years ago[X86] Fix a couple types in SimplifyDemandedVectorEltsForTargetNode. NFCI
Craig Topper [Fri, 30 Nov 2018 06:23:55 +0000 (06:23 +0000)]
[X86] Fix a couple types in SimplifyDemandedVectorEltsForTargetNode. NFCI

We had a EVT variable capturing the result of getSimpleValueType which returns an MVT. Another place using EVT that could have been MVT. And an 'int' that should be 'unsigned'.

llvm-svn: 347959

5 years ago[llvm-objcopy] Move elf-specific tests into subfolder
Alexander Shaposhnikov [Fri, 30 Nov 2018 05:43:39 +0000 (05:43 +0000)]
[llvm-objcopy] Move elf-specific tests into subfolder

In this diff the elf-specific tests are moved into the subfolder llvm-objcopy/ELF
(the change was discussed in the comments on https://reviews.llvm.org/D54674).
A separate code reivew wasn't sent for this change
since Phabricator is failing to create such a large diff.

Test plan:
make check-all
make check-llvm-tools
make check-llvm-tools-llvm-objcopy

llvm-svn: 347958

5 years agoRevert r344580 "[analyzer] Nullability: Don't detect post factum violation..."
Artem Dergachev [Fri, 30 Nov 2018 04:26:17 +0000 (04:26 +0000)]
Revert r344580 "[analyzer] Nullability: Don't detect post factum violation..."

Fails under ASan!

llvm-svn: 347956

5 years ago[analyzer] MallocChecker: Avoid redundant transitions.
Artem Dergachev [Fri, 30 Nov 2018 03:52:42 +0000 (03:52 +0000)]
[analyzer] MallocChecker: Avoid redundant transitions.

Don't generate a checker-tagged node unconditionally on the first
checkDeadSymbols callback when no pointers are tracked.

This is a tiny performance optimization; it may change the behavior slightly
by making Static Analyzer bail out on max-nodes one node later (which is good)
but any test would either break for no good reason or become useless
every time someone sneezes.

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

llvm-svn: 347955

5 years ago[analyzer] Nullability: Don't detect post factum violation on concrete values.
Artem Dergachev [Fri, 30 Nov 2018 03:39:58 +0000 (03:39 +0000)]
[analyzer] Nullability: Don't detect post factum violation on concrete values.

The checker suppresses warnings on paths on which a nonnull value is assumed
to be nullable. This probably deserves a warning, but it's a separate story.

Now, because dead symbol collection fires in pretty random moments,
there sometimes was a situation when dead symbol collection fired after
computing a parameter but before actually evaluating call enter into the
function, which triggered the suppression when the argument was null
in the first place earlier than the obvious warning for null-to-nonnull
was emitted, causing false negatives.

Only trigger the suppression for symbols, not for concrete values.

It is impossible to constrain a concrete value post-factum because
it is impossible to constrain a concrete value at all.

This covers all the necessary cases because by the time we reach the call,
symbolic values should be either not constrained to null, or already collapsed
into concrete null values. Which in turn happens because they are passed through
the Store, and the respective collapse is implemented as part of getSVal(),
which is also weird.

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

llvm-svn: 347954

5 years ago[analyzer] Fix the "Zombie Symbols" bug.
Artem Dergachev [Fri, 30 Nov 2018 03:27:50 +0000 (03:27 +0000)]
[analyzer] Fix the "Zombie Symbols" bug.

It's an old bug that consists in stale references to symbols remaining in the
GDM if they disappear from other program state sections as a result of any
operation that isn't the actual dead symbol collection. The most common example
here is:

   FILE *fp = fopen("myfile.txt", "w");
   fp = 0; // leak of file descriptor

In this example the leak were not detected previously because the symbol
disappears from the public part of the program state due to evaluating
the assignment. For that reason the checker never receives a notification
that the symbol is dead, and never reports a leak.

This patch not only causes leak false negatives, but also a number of other
problems, including false positives on some checkers.

What's worse, even though the program state contains a finite number of symbols,
the set of symbols that dies is potentially infinite. This means that is
impossible to compute the set of all dead symbols to pass off to the checkers
for cleaning up their part of the GDM.

No longer compute the dead set at all. Disallow iterating over dead symbols.
Disallow querying if any symbols are dead. Remove the API for marking symbols
as dead, as it is no longer necessary. Update checkers accordingly.

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

llvm-svn: 347953

5 years agoFix the Xcode project (pt. 2)
Jonas Devlieghere [Fri, 30 Nov 2018 02:44:16 +0000 (02:44 +0000)]
Fix the Xcode project (pt. 2)

Apparently LLVM's libSupport depends on libDemangle to print the stack
trace. I'm not sure if this is desired but for now we don't have much
choice if we want to turn to bot green again.

llvm-svn: 347952

5 years ago[analyzer] Fixes after rebase.
George Karpenkov [Fri, 30 Nov 2018 02:19:29 +0000 (02:19 +0000)]
[analyzer] Fixes after rebase.

llvm-svn: 347951

5 years ago[analyzer] RetainCountChecker for OSObject model the "free" call
George Karpenkov [Fri, 30 Nov 2018 02:19:16 +0000 (02:19 +0000)]
[analyzer] RetainCountChecker for OSObject model the "free" call

The "free" call frees the object immediately, ignoring the reference count.
Sadly, it is actually used in a few places, so we need to model it.

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

llvm-svn: 347950

5 years ago[analyzer] RetainCountChecker: recognize that OSObject can be created directly using...
George Karpenkov [Fri, 30 Nov 2018 02:19:03 +0000 (02:19 +0000)]
[analyzer] RetainCountChecker: recognize that OSObject can be created directly using an operator "new"

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

llvm-svn: 347949

5 years ago[analyzer] Switch retain count checker for OSObject to use OS_* attributes
George Karpenkov [Fri, 30 Nov 2018 02:18:50 +0000 (02:18 +0000)]
[analyzer] Switch retain count checker for OSObject to use OS_* attributes

Instead of generalized reference counting annotations.

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

llvm-svn: 347948

5 years ago[attributes] Add a family of OS_CONSUMED, OS_RETURNS and OS_RETURNS_RETAINED attributes
George Karpenkov [Fri, 30 Nov 2018 02:18:37 +0000 (02:18 +0000)]
[attributes] Add a family of OS_CONSUMED, OS_RETURNS and OS_RETURNS_RETAINED attributes

The addition adds three attributes for communicating ownership,
analogous to existing NS_ and CF_ attributes.
The attributes are meant to be used for communicating ownership of all
objects in XNU (Darwin kernel) and all of the kernel modules.
The ownership model there is very similar, but still different from the
Foundation model, so we think that introducing a new family of
attributes is appropriate.

The addition required a sizeable refactoring of the existing code for
CF_ and NS_ ownership attributes, due to tight coupling and the fact
that differentiating between the types was previously done using a
boolean.

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

llvm-svn: 347947

5 years ago[analyzer] [NFC] Minor refactoring of RetainCountDiagnostics
George Karpenkov [Fri, 30 Nov 2018 02:18:23 +0000 (02:18 +0000)]
[analyzer] [NFC] Minor refactoring of RetainCountDiagnostics

Move visitors to the implementation file, move a complicated logic into
a function.

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

llvm-svn: 347946

5 years ago[analyzer] For OSObject, trust that functions starting with Get
George Karpenkov [Fri, 30 Nov 2018 02:18:10 +0000 (02:18 +0000)]
[analyzer] For OSObject, trust that functions starting with Get

(uppercase) are also getters.

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

llvm-svn: 347945

5 years ago[analyzer] Print a fully qualified name for functions in RetainCountChecker diagnostics
George Karpenkov [Fri, 30 Nov 2018 02:17:57 +0000 (02:17 +0000)]
[analyzer] Print a fully qualified name for functions in RetainCountChecker diagnostics

Attempt to get a fully qualified name from AST if an SVal corresponding
to the object is not available.

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

llvm-svn: 347944

5 years ago[analyzer] Add the type of the leaked object to the diagnostic message
George Karpenkov [Fri, 30 Nov 2018 02:17:44 +0000 (02:17 +0000)]
[analyzer] Add the type of the leaked object to the diagnostic message

If the object is a temporary, and there is no variable it binds to,
let's at least print out the object name in order to help differentiate
it from other temporaries.

rdar://45175098

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

llvm-svn: 347943

5 years ago[analyzer] Reference leaked object by name, even if it was created in an inlined...
George Karpenkov [Fri, 30 Nov 2018 02:17:31 +0000 (02:17 +0000)]
[analyzer] Reference leaked object by name, even if it was created in an inlined function.

rdar://45532181

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

llvm-svn: 347942

5 years ago[analyzer] [NFC] Test dumping trimmed graph
George Karpenkov [Fri, 30 Nov 2018 02:17:18 +0000 (02:17 +0000)]
[analyzer] [NFC] Test dumping trimmed graph

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

llvm-svn: 347941

5 years ago[analyzer] [NFC] Some miscellaneous clean ups and documentation fixes.
George Karpenkov [Fri, 30 Nov 2018 02:17:05 +0000 (02:17 +0000)]
[analyzer] [NFC] Some miscellaneous clean ups and documentation fixes.

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

llvm-svn: 347940

5 years agoFix build warnings introduced in rL347938
Mircea Trofin [Fri, 30 Nov 2018 01:53:17 +0000 (01:53 +0000)]
Fix build warnings introduced in rL347938

Summary:
Suppressed warnings in release builds due to variable used
only in assert statement.

Subscribers: llvm-commits, eraman, mgorny

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

llvm-svn: 347939

5 years agoRevert "Revert r347596 "Support for inserting profile-directed cache prefetches""
Mircea Trofin [Fri, 30 Nov 2018 01:01:52 +0000 (01:01 +0000)]
Revert "Revert r347596 "Support for inserting profile-directed cache prefetches""

Summary:
This reverts commit d8517b96dfbd42e6a8db33c50d1fa1e58e63fbb9.

Fix: correct  the use of DenseMap.

Reviewers: davidxl, hans, wmi

Reviewed By: wmi

Subscribers: mgorny, eraman, llvm-commits

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

llvm-svn: 347938

5 years ago[CMake] build correctly if build path contains whitespace
Shoaib Meenai [Fri, 30 Nov 2018 00:30:53 +0000 (00:30 +0000)]
[CMake] build correctly if build path contains whitespace

The add_llvm_symbol_exports function in AddLLVM.cmake creates command
line link flags with paths containing CMAKE_CURRENT_BINARY_DIR, but that
will break if CMAKE_CURRENT_BINARY_DIR contains whitespace. This patch
adds quotes to those paths.

Fixes PR39843.

Patch by John Garvin.

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

llvm-svn: 347937

5 years agoFix the Xcode project
Jonas Devlieghere [Fri, 30 Nov 2018 00:09:04 +0000 (00:09 +0000)]
Fix the Xcode project

This fixes the driver with the Xcode project. We need to link the driver
against the correct LLVM libraries and make sure we're disabling
exceptions/rtti.

Thanks to Jim for helping me figure this out.

llvm-svn: 347936

5 years ago[SCEV] Guard movement of insertion point for loop-invariants
Warren Ristow [Fri, 30 Nov 2018 00:02:54 +0000 (00:02 +0000)]
[SCEV] Guard movement of insertion point for loop-invariants

r320789 suppressed moving the insertion point of SCEV expressions with
dev/rem operations to the loop header in non-loop-invariant situations.
This, and similar, hoisting is also unsafe in the loop-invariant case,
since there may be a guard against a zero denominator. This is an
adjustment to the fix of r320789 to suppress the movement even in the
loop-invariant case.

This fixes PR30806.

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

llvm-svn: 347934

5 years agoRevert r346560 "[winasan] Unpoison the stack in NtTerminateThread"
Reid Kleckner [Thu, 29 Nov 2018 23:57:17 +0000 (23:57 +0000)]
Revert r346560 "[winasan] Unpoison the stack in NtTerminateThread"

This reverts r343606 again. The NtTerminateThread interceptor is causing
problems in NaCl:
https://ci.chromium.org/p/chromium/builders/luci.chromium.ci/CrWinAsan/1839

I reproduced the problem locally and tried my best to debug them, but
it's beyond me.

llvm-svn: 347933

5 years agoRevert r347799: Add omp_get_device_num() and update other device API
Jonathan Peyton [Thu, 29 Nov 2018 23:56:14 +0000 (23:56 +0000)]
Revert r347799: Add omp_get_device_num() and update other device API

There is a conflict between libomptarget and libomp concerning some of the
standard OpenMP device API which needs further intestigation.

llvm-svn: 347932

5 years agoFirst part of P0482 - Establish that char8_t is an integral type, and that numeric_li...
Marshall Clow [Thu, 29 Nov 2018 23:21:18 +0000 (23:21 +0000)]
First part of P0482 - Establish that char8_t is an integral type, and that numeric_limits<char8_t> is valid and sane. (second try)

llvm-svn: 347930

5 years ago[gn build] merge r346978 and r347741.
Nico Weber [Thu, 29 Nov 2018 23:03:17 +0000 (23:03 +0000)]
[gn build] merge r346978 and r347741.

llvm-svn: 347929

5 years ago[gn build] Set +x bit on .py files in llvm/utils/gn/build.
Nico Weber [Thu, 29 Nov 2018 22:56:40 +0000 (22:56 +0000)]
[gn build] Set +x bit on .py files in llvm/utils/gn/build.

Also add a shebang line to write_cmake_config.py.

llvm-svn: 347928

5 years ago[gn build] Add template for running llvm-tblgen and use it to add build file for...
Nico Weber [Thu, 29 Nov 2018 22:53:21 +0000 (22:53 +0000)]
[gn build] Add template for running llvm-tblgen and use it to add build file for llvm/lib/IR.

Also adds a boring build file for llvm/lib/BinaryFormat (needed by llvm/lib/IR).

lib/IR marks Attributes and IntrinsicsEnum as public_deps (because IR's public
headers include the generated .inc files), so projects depending on lib/IR will
implicitly depend on them being generated. As a consequence, most targets won't
have to explicitly list a dependency on these tablegen steps (contrast with
intrinsics_gen in the cmake build).

This doesn't yet have the optimization where tablegen's output is only updated
if it's changed.

Differential Revision: https://reviews.llvm.org/D55028#inline-486755

llvm-svn: 347927

5 years ago[-gmodules] Honor -fdebug-prefix-map in the debug info inside PCMs.
Adrian Prantl [Thu, 29 Nov 2018 22:33:09 +0000 (22:33 +0000)]
[-gmodules] Honor -fdebug-prefix-map in the debug info inside PCMs.

This patch passes -fdebug-prefix-map (a feature for renaming source
paths in the debug info) through to the per-module codegen options and
adds the debug prefix map to the module hash.

<rdar://problem/46045865>

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

llvm-svn: 347926

5 years ago[gn build] Add a script checking if sources in BUILD.gn and CMakeLists.txt files...
Nico Weber [Thu, 29 Nov 2018 22:25:31 +0000 (22:25 +0000)]
[gn build] Add a script checking if sources in BUILD.gn and CMakeLists.txt files match.

Also fix a missing file in lib/Support/BUILD.gn found by the script.

The script is very stupid and assumes that CMakeLists.txt follow the standard
LLVM CMakeLists.txt formatting with one cpp source file per line. Despite its
simplicity, it works well in practice.

It would be nice if it also checked deps and maybe automatically applied its
suggestions.

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

llvm-svn: 347925

5 years ago[lldbsuite] Build with -gdwarf on Windows
Stella Stamenova [Thu, 29 Nov 2018 22:15:23 +0000 (22:15 +0000)]
[lldbsuite] Build with -gdwarf on Windows

Earlier this month there was a change in clang that defaulted to using codeview rather than dwarf on Windows. Since all the tests rely on dwarf, we need to explicitly request dwarf when building on Windows.

llvm-svn: 347924

5 years ago[WebAssembly] Expand unavailable integer operations for vectors
Thomas Lively [Thu, 29 Nov 2018 22:01:01 +0000 (22:01 +0000)]
[WebAssembly] Expand unavailable integer operations for vectors

Summary:
Expands for vector types all of the integer operations that are
expanded for scalars because they are not supported at all by
WebAssembly.

This CL has no tests because such tests would really be testing the
target-independent expansion, but I'm happy to add tests if reviewers
think it would be helpful.

Reviewers: aheejin, dschuff

Subscribers: sbc100, jgravelle-google, sunfish, llvm-commits

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

llvm-svn: 347923

5 years agoProduce an error on non-encodable offsets for darwin ARM scattered relocations.
Jonas Devlieghere [Thu, 29 Nov 2018 21:58:23 +0000 (21:58 +0000)]
Produce an error on non-encodable offsets for darwin ARM scattered relocations.

Scattered ARM relocations for Mach-O's only have 24 bits available to
encode the offset. This is not checked but just truncated and can result
in corrupt binaries after linking because the relocations are applied to
the wrong offset. This patch will check and error out in those
situations instead of emitting a wrong relocation.

Patch by: Sander Bogaert (dzn)

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

llvm-svn: 347922

5 years ago[libcxx] Make UNSUPPORTED for std::async test more fine grained
Louis Dionne [Thu, 29 Nov 2018 21:25:29 +0000 (21:25 +0000)]
[libcxx] Make UNSUPPORTED for std::async test more fine grained

The test was previously marked as unsupported on all Apple platforms, when
we really just want to mark it as unsupported for previously shipped dylibs
on macosx.

llvm-svn: 347920

5 years ago[OPENMP][NVPTX]Call get __kmpc_global_thread_num in worker after
Alexey Bataev [Thu, 29 Nov 2018 21:21:32 +0000 (21:21 +0000)]
[OPENMP][NVPTX]Call get __kmpc_global_thread_num in worker after
initialization.

Function __kmpc_global_thread_num  should be called only after
initialization, not earlier.

llvm-svn: 347919

5 years agoComment tweak requested in code review. NFC
Paul Robinson [Thu, 29 Nov 2018 21:13:51 +0000 (21:13 +0000)]
Comment tweak requested in code review. NFC

I forgot to do this before committing D54755.

llvm-svn: 347918

5 years ago[DAGCombiner] narrow truncated binops
Sanjay Patel [Thu, 29 Nov 2018 20:58:26 +0000 (20:58 +0000)]
[DAGCombiner] narrow truncated binops

The motivating case for this is shown in:
https://bugs.llvm.org/show_bug.cgi?id=32023
and the corresponding rot16.ll regression tests.

Because x86 scalar shift amounts are i8 values, we can end up with trunc-binop-trunc
sequences that don't get folded in IR.

As the TODO comments suggest, there will be regressions if we extend this (for x86,
we mostly seem to be missing LEA opportunities, but there are likely vector folds
missing too). I think those should be considered existing bugs because this is the
same transform that we do as an IR canonicalization in instcombine. We just need
more tests to make those visible independent of this patch.

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

llvm-svn: 347917

5 years ago[obj2yaml] [COFF] Write RVA instead of VA for sections, fix roundtripping executables
Martin Storsjo [Thu, 29 Nov 2018 20:53:57 +0000 (20:53 +0000)]
[obj2yaml] [COFF] Write RVA instead of VA for sections, fix roundtripping executables

yaml2obj writes the yaml value as is to the output file.

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

llvm-svn: 347916

5 years ago[OpenMP] Add a new version of the SPMD deinit kernel function
Gheorghe-Teodor Bercea [Thu, 29 Nov 2018 20:53:49 +0000 (20:53 +0000)]
[OpenMP] Add a new version of the SPMD deinit kernel function

Summary: This patch adds a new runtime for the SPMD deinit kernel function which replaces the previous function. The new function takes as argument the flag which signals whether the runtime is required or not. This enables the compiler to optimize out the part of the deinit function which are not needed.

Reviewers: ABataev, caomhin

Reviewed By: ABataev

Subscribers: jholewinski, guansong, cfe-commits

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

llvm-svn: 347915

5 years ago[RISCV] Implement codegen for cmpxchg on RV32IA
Alex Bradbury [Thu, 29 Nov 2018 20:43:42 +0000 (20:43 +0000)]
[RISCV] Implement codegen for cmpxchg on RV32IA

Utilise a similar ('late') lowering strategy to D47882. The changes to
AtomicExpandPass allow this strategy to be utilised by other targets which
implement shouldExpandAtomicCmpXchgInIR.

All cmpxchg are lowered as 'strong' currently and failure ordering is ignored.
This is conservative but correct.

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

llvm-svn: 347914

5 years agoAdding .vscode to svn:ignore
Leonard Mosescu [Thu, 29 Nov 2018 20:41:10 +0000 (20:41 +0000)]
Adding .vscode to svn:ignore

llvm-svn: 347913

5 years ago[X86] Change the pre-type legalization DAG combine added in r347898 into a custom...
Craig Topper [Thu, 29 Nov 2018 20:18:58 +0000 (20:18 +0000)]
[X86] Change the pre-type legalization DAG combine added in r347898 into a custom type legalization operation instead.

This seems to produce the same results on the tests we have.

llvm-svn: 347912

5 years agoRevert r347871 "Fix: Add support for TFE/LWE in image intrinsic"
David Stuttard [Thu, 29 Nov 2018 20:14:17 +0000 (20:14 +0000)]
Revert r347871 "Fix: Add support for TFE/LWE in image intrinsic"

Also revert fix r347876

One of the buildbots was reporting a failure in some relevant tests that I can't
repro or explain at present, so reverting until I can isolate.

llvm-svn: 347911

5 years agoIntroduce MaxUsesToExplore argument to capture tracking
Artur Pilipenko [Thu, 29 Nov 2018 20:08:12 +0000 (20:08 +0000)]
Introduce MaxUsesToExplore argument to capture tracking

Currently CaptureTracker gives up if it encounters a value with more than 20
uses. The motivation for this cap is to keep it relatively cheap for
BasicAliasAnalysis use case, where the results can't be cached. Although, other
clients of CaptureTracker might be ok with higher cost. This patch introduces an
argument for PointerMayBeCaptured functions to specify the max number of uses to
explore. The motivation for this change is a downstream user of CaptureTracker,
but I believe upstream clients of CaptureTracker might also benefit from more
fine grained cap.

Reviewed By: hfinkel

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

llvm-svn: 347910

5 years ago[WebAssembly] Allow undefined symbols when building shared libraries
Sam Clegg [Thu, 29 Nov 2018 20:07:13 +0000 (20:07 +0000)]
[WebAssembly] Allow undefined symbols when building shared libraries

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

llvm-svn: 347909

5 years agoRevert commit r347904 because it broke older compilers
Marshall Clow [Thu, 29 Nov 2018 20:04:47 +0000 (20:04 +0000)]
Revert commit r347904 because it broke older compilers

llvm-svn: 347908

5 years ago[OpenMP] Add stubs for Task affinity API
Jonathan Peyton [Thu, 29 Nov 2018 20:04:29 +0000 (20:04 +0000)]
[OpenMP] Add stubs for Task affinity API

This patch adds __kmpc_omp_reg_task_with_affinity to register affinity
information for tasks. For now, the affinity information is not used,
and the function always succeeds. This also adds the kmp_task_affinity_info_t
structure to store the task affinity information.

Patch by Terry Wilmarth

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

llvm-svn: 347907

5 years ago[MachineScheduler] Order FI-based memops based on stack direction
Francis Visoiu Mistrih [Thu, 29 Nov 2018 20:03:19 +0000 (20:03 +0000)]
[MachineScheduler] Order FI-based memops based on stack direction

It makes more sense to order FI-based memops in descending order when
the stack goes down. This allows offsets to stay "consecutive" and allow
easier pattern matching.

llvm-svn: 347906

5 years agoRevert "NFC: Fix case of CommentVisitor::Visit methods"
Stephen Kelly [Thu, 29 Nov 2018 19:50:10 +0000 (19:50 +0000)]
Revert "NFC: Fix case of CommentVisitor::Visit methods"

This reverts commit 0859c80137ac5fb3c86e7802cb8c5ef56f921cce.

llvm-svn: 347905

5 years agoFirst part of P0482 - Establish that char8_t is an integral type, and that numeric_li...
Marshall Clow [Thu, 29 Nov 2018 19:49:48 +0000 (19:49 +0000)]
First part of P0482 - Establish that char8_t is an integral type, and that numeric_limits<char8_t> is valid and sane.

llvm-svn: 347904

5 years ago[libcxx] Remove bad_array_length
Louis Dionne [Thu, 29 Nov 2018 19:44:57 +0000 (19:44 +0000)]
[libcxx] Remove bad_array_length

Summary:
std::bad_array_length was added by n3467, but this never made it into C++.
This commit removes the definition of std::bad_array_length from the headers
AND from the shared library. See the comments in the ABI changelog for details
about the ABI implications of this change.

Reviewers: mclow.lists, dexonsmith, howard.hinnant, EricWF

Subscribers: christof, jkorous, libcxx-commits

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

llvm-svn: 347903

5 years ago[SelectionDAG][AArch64][X86] Move legalization of vector MULHS/MULHU from LegalizeDAG...
Craig Topper [Thu, 29 Nov 2018 19:36:17 +0000 (19:36 +0000)]
[SelectionDAG][AArch64][X86] Move legalization of vector MULHS/MULHU from LegalizeDAG to LegalizeVectorOps

I believe we should be legalizing these with the rest of vector binary operations. If any custom lowering is required for these nodes, this will give the DAG combine between LegalizeVectorOps and LegalizeDAG to run on the custom code before constant build_vectors are lowered in LegalizeDAG.

I've moved MULHU/MULHS handling in AArch64 from Lowering to isel. Moving the lowering earlier caused build_vector+extract_subvector simplifications to kick in which made the generated code worse.

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

llvm-svn: 347902

5 years agoNFC: Fix case of CommentVisitor::Visit methods
Stephen Kelly [Thu, 29 Nov 2018 19:31:32 +0000 (19:31 +0000)]
NFC: Fix case of CommentVisitor::Visit methods

This difference is very visible because it is used with other Visitor
classes together.

llvm-svn: 347901

5 years agoNFC: Move ColorScope to global scope
Stephen Kelly [Thu, 29 Nov 2018 19:30:37 +0000 (19:30 +0000)]
NFC: Move ColorScope to global scope

llvm-svn: 347900

5 years agoNFC: Constify ShowColors
Stephen Kelly [Thu, 29 Nov 2018 19:30:08 +0000 (19:30 +0000)]
NFC: Constify ShowColors

llvm-svn: 347899

5 years ago[X86] Add a DAG combine pre type legalization to widen division by constant splat...
Craig Topper [Thu, 29 Nov 2018 19:13:38 +0000 (19:13 +0000)]
[X86] Add a DAG combine pre type legalization to widen division by constant splat on narrow vectors to avoid scalarization

This is another patch for -x86-experimental-vector-widening. This pre widens narrow division by constants so that we can get pass the legal type check in the generic DAG combiner. Otherwise we end up scalarizing.

I've restricted this to splats for now because it was easy to just call DAG.getConstant. Not sure what we should do for non-splat? Increase the element size?Widen the constant vector by padding with 1?

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

llvm-svn: 347898

5 years agoset default max-page-size to 4KB in lld for Android Aarch64
Zhizhou Yang [Thu, 29 Nov 2018 18:52:22 +0000 (18:52 +0000)]
set default max-page-size to 4KB in lld for Android Aarch64

Summary:
This patch passes an option '-z max-page-size=4096' to lld through clang driver.

This is for Android on Aarch64 target.

The lld default page size is too large for Aarch64, which produces larger .so files and images for arm64 device targets.
In this patch we set default page size to 4KB for Android Aarch64 targets instead.

Reviewers: srhines, danalbert, ruiu, chh, peter.smith

Reviewed By: srhines

Subscribers: javed.absar, kristof.beyls, cfe-commits, george.burgess.iv, llozano

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

llvm-svn: 347897

5 years ago[InstSimplify] fold select with implied condition
Sanjay Patel [Thu, 29 Nov 2018 18:44:39 +0000 (18:44 +0000)]
[InstSimplify] fold select with implied condition

This is an almost direct move of the functionality from InstCombine to
InstSimplify. There's no reason not to do this in InstSimplify because
we never create a new value with this transform.

(There's a question of whether any dominance-based transform belongs in
either of these passes, but that's a separate issue.)

I've changed 1 of the conditions for the fold (1 of the blocks for the
branch must be the block we started with) into an assert because I'm not
sure how that could ever be false.

We need 1 extra check to make sure that the instruction itself is in a
basic block because passes other than InstCombine may be using InstSimplify
as an analysis on values that are not wired up yet.

The 3-way compare changes show that InstCombine has some kind of
phase-ordering hole. Otherwise, we would have already gotten the intended
final result that we now show here.

llvm-svn: 347896

5 years agoSimplify the __builtin_constant_p test that was used to catch rC347417 failure
Fangrui Song [Thu, 29 Nov 2018 18:26:39 +0000 (18:26 +0000)]
Simplify the __builtin_constant_p test that was used to catch rC347417 failure

Reviewers: rsmith, void, shafik

Reviewed By: void

Subscribers: kristina, cfe-commits

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

llvm-svn: 347895

5 years ago[TableGen] Examine entire subreg compositions to detect ambiguity
Krzysztof Parzyszek [Thu, 29 Nov 2018 18:20:08 +0000 (18:20 +0000)]
[TableGen] Examine entire subreg compositions to detect ambiguity

When tablegen detects that there exist two subregister compositions that
result in the same value for some register, it will emit a warning. This
kind of an overlap in compositions should only happen when it is caused
by a user-defined composition. It can happen, however, that the user-
defined composition is not identically equal to another one, but it does
produce the same value for one or more registers. In such cases suppress
the warning.
This patch is to silence the warning when building the System Z backend
after D50725.

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

llvm-svn: 347894

5 years ago[GlobalISel] LegalizationArtifactCombiner: Combine aext([asz]ext x) -> [asz]ext x
Volkan Keles [Thu, 29 Nov 2018 18:19:24 +0000 (18:19 +0000)]
[GlobalISel] LegalizationArtifactCombiner: Combine aext([asz]ext x) -> [asz]ext x

Summary:
Replace `aext([asz]ext x)` with `aext/sext/zext x` in order to
reduce the number of instructions generated to clean up some
legalization artifacts.

Reviewers: aditya_nandakumar, dsanders, aemerson, bogner

Reviewed By: aemerson

Subscribers: rovka, kristof.beyls, javed.absar, llvm-commits

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

llvm-svn: 347893

5 years agoAdd missing REQUIRES to new test
Teresa Johnson [Thu, 29 Nov 2018 18:02:31 +0000 (18:02 +0000)]
Add missing REQUIRES to new test

Test added in r347887 requires an x86 target.

llvm-svn: 347892

5 years ago[llvm-objcopy] Delete redundant !Config.xx.empty() when followed by positive is_conta...
Fangrui Song [Thu, 29 Nov 2018 17:32:51 +0000 (17:32 +0000)]
[llvm-objcopy] Delete redundant !Config.xx.empty() when followed by positive is_contained() check

Summary: The original intention of !Config.xx.empty() was probably to emphasize the thing that is currently considered, but I feel the simplified form is actually easier to understand and it is also consistent with the call sites in other llvm components.

Reviewers: alexshap, rupprecht, jakehehrlich, jhenderson, espindola

Reviewed By: alexshap, rupprecht

Subscribers: emaste, arichardson, llvm-commits

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

llvm-svn: 347891

5 years agoAvoid redundant reference to isPodLike in SmallVect/Optional implementation
Serge Guelton [Thu, 29 Nov 2018 17:21:54 +0000 (17:21 +0000)]
Avoid redundant reference to isPodLike in SmallVect/Optional implementation

NFC, preparatory work for isPodLike cleaning.

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

llvm-svn: 347890

5 years ago[LICM] Reapply r347776 "Make LICM able to hoist phis" with fix
John Brawn [Thu, 29 Nov 2018 17:10:00 +0000 (17:10 +0000)]
[LICM] Reapply r347776 "Make LICM able to hoist phis" with fix

This commit caused a large compile-time slowdown in some cases when NDEBUG is
off due to the dominator tree verification it added. Fix this by only doing
dominator tree and loop info verification when something has been hoisted.

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

llvm-svn: 347889

5 years ago[analyzer][PlistMacroExpansion] Part 4.: Support for __VA_ARGS__
Kristof Umann [Thu, 29 Nov 2018 17:09:41 +0000 (17:09 +0000)]
[analyzer][PlistMacroExpansion] Part 4.: Support for __VA_ARGS__

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

llvm-svn: 347888

5 years ago[ThinLTO] Allow importing of multiple symbols with same GUID
Teresa Johnson [Thu, 29 Nov 2018 17:02:59 +0000 (17:02 +0000)]
[ThinLTO] Allow importing of multiple symbols with same GUID

Summary:
The is the clang side of the fix in D55047, to handle the case where
two different modules have local variables with the same GUID because
they had the same source file name at compilation time. Allow multiple
symbols with the same GUID to be imported, and test that this case works
with the distributed backend path.

Depends on D55047.

Reviewers: evgeny777

Subscribers: mehdi_amini, inglorion, eraman, steven_wu, dexonsmith, cfe-commits

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

llvm-svn: 347887