platform/upstream/llvm.git
4 years ago[Coroutines] Remove corresponding phi values when apply simplifyTerminatorLeadingToRet
Brian Gesiak [Sun, 5 Jan 2020 22:07:57 +0000 (17:07 -0500)]
[Coroutines] Remove corresponding phi values when apply simplifyTerminatorLeadingToRet

Summary:
In addMustTailToCoroResumes, we set musttail on those resume instructions that are followed by a ret instruction. This is done by simplifyTerminatorLeadingToRet which replace a sequence of branches leading to a ret with a clone of the ret.

However it forgets to remove corresponding PHI values that come from basic block of replaced branch, and may cause jumpthreading pass hangs (https://bugs.llvm.org/show_bug.cgi?id=43720)

This patch fix this issue

Test Plan:
cppcoro library with O3+flto
check-llvm

Reviewers: modocache, GorNishanov, lewissbaker

Reviewed By: modocache

Subscribers: mehdi_amini, EricWF, hiraditya, dexonsmith, jfb, llvm-commits

Tags: #llvm

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

Patch by junparser (JunMa)!

4 years agoClang-format previous commit
Stephen Kelly [Sun, 5 Jan 2020 22:58:03 +0000 (22:58 +0000)]
Clang-format previous commit

4 years ago[MC][ARM] Delete MCSection::HasData and move SHF_ARM_PURECODE logic to ARMELFObjectWr...
Fangrui Song [Sun, 5 Jan 2020 22:02:18 +0000 (14:02 -0800)]
[MC][ARM] Delete MCSection::HasData and move SHF_ARM_PURECODE logic to ARMELFObjectWriter::addTargetSectionFlags

This simplifies the generic interface and also makes SHF_ARM_PURECODE
more robust (fixes a TODO). Inspecting MCDataFragment contents covers
more cases than MCObjectStreamer::EmitBytes.

4 years agoAdd missing test
Stephen Kelly [Sun, 5 Jan 2020 21:55:13 +0000 (21:55 +0000)]
Add missing test

4 years ago[Gnu toolchain] Look at standard GCC paths for libstdcxx by default
Kristina Brooks [Sun, 5 Jan 2020 21:43:16 +0000 (21:43 +0000)]
[Gnu toolchain] Look at standard GCC paths for libstdcxx by default

Linux' current addLibCxxIncludePaths and addLibStdCxxIncludePaths
are actually almost non-Linux-specific at all, and can be reused
almost as such for all gcc toolchains. Only keep
Android/Freescale/Cray hacks in Linux's version.

Patch by sthibaul (Samuel Thibault)

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

4 years ago[MC] Delete MCSection::{rbegin,rend}
Fangrui Song [Sun, 5 Jan 2020 20:48:48 +0000 (12:48 -0800)]
[MC] Delete MCSection::{rbegin,rend}

4 years agoAllow using traverse() with bindings
Stephen Kelly [Sun, 5 Jan 2020 20:48:20 +0000 (20:48 +0000)]
Allow using traverse() with bindings

4 years agoFix oversight in AST traversal helper
Stephen Kelly [Sun, 5 Jan 2020 20:27:37 +0000 (20:27 +0000)]
Fix oversight in AST traversal helper

4 years ago[MC] Merge MCSymbol::getSectionPtr into getSection and simplify
Fangrui Song [Sun, 5 Jan 2020 20:02:11 +0000 (12:02 -0800)]
[MC] Merge MCSymbol::getSectionPtr into getSection and simplify

4 years ago[MC] Drop an unused rule about absolute temporary symbols
Fangrui Song [Sun, 5 Jan 2020 19:39:46 +0000 (11:39 -0800)]
[MC] Drop an unused rule about absolute temporary symbols

4 years ago[X86][SSE] Combine combineLogicBlendIntoConditionalNegate for VSELECT nodes (PR43660)
Simon Pilgrim [Sun, 5 Jan 2020 18:50:44 +0000 (18:50 +0000)]
[X86][SSE] Combine combineLogicBlendIntoConditionalNegate for VSELECT nodes (PR43660)

Attempt to use combineLogicBlendIntoConditionalNegate for (select M, (sub 0, X), X) -> (sub (xor X, M), M)

We limit this to cases that can't easily replace the VSELECT with a shuffle (non-constant masks) or where a BLENDV is likely to occur (which tends to result in slower codegen).

4 years ago[X86] Move combineLogicBlendIntoConditionalNegate before combineSelect. NFCI.
Simon Pilgrim [Sun, 5 Jan 2020 17:17:41 +0000 (17:17 +0000)]
[X86] Move combineLogicBlendIntoConditionalNegate before combineSelect. NFCI.

Updates function order in preparation of future fix for PR43660

4 years ago[X86] Merge (identical) LowerGC_TRANSITION_START and LowerGC_TRANSITION_END (NFC)
Simon Pilgrim [Sun, 5 Jan 2020 15:24:23 +0000 (15:24 +0000)]
[X86] Merge (identical) LowerGC_TRANSITION_START and LowerGC_TRANSITION_END (NFC)

Silences a copy+paste analyzer warning - all they are doing are inserting NOOPs in exactly the same way.

4 years ago[ARM] Use isFMAFasterThanFMulAndFAdd for scalars as well as MVE vectors
David Green [Sun, 5 Jan 2020 10:59:21 +0000 (10:59 +0000)]
[ARM] Use isFMAFasterThanFMulAndFAdd for scalars as well as MVE vectors

This adds extra scalar handling to isFMAFasterThanFMulAndFAdd, allowing
the target independent code to handle more folds in more situations (for
example if the fast math flags are present, but the global
AllowFPOpFusion option isnt). It also splits apart the HasSlowFPVMLx
into HasSlowFPVFMx, to allow VFMA and VMLA to be controlled separately
if needed.

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

4 years ago[ARM] Fill in FP16 FMA patterns
David Green [Sun, 5 Jan 2020 10:54:49 +0000 (10:54 +0000)]
[ARM] Fill in FP16 FMA patterns

This adds fp16 variants of all the fma patterns in the ARM backend.

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

4 years ago[ARM] Add and update FMA tests. NFC
David Green [Sat, 4 Jan 2020 20:16:32 +0000 (20:16 +0000)]
[ARM] Add and update FMA tests. NFC

4 years ago[ParserTest] Move raw string literal out of macro
David Green [Sun, 5 Jan 2020 11:23:35 +0000 (11:23 +0000)]
[ParserTest] Move raw string literal out of macro

Some combinations of gcc and ccache do not deal well with raw strings in
macros. Moving the string out to attempt to fix the bots.

4 years ago[LegalizeVectorOps][X86] Enable expansion of vector fp_to_uint in LegalizeVectorOps...
Craig Topper [Sun, 5 Jan 2020 03:18:50 +0000 (19:18 -0800)]
[LegalizeVectorOps][X86] Enable expansion of vector fp_to_uint in LegalizeVectorOps to avoid scalarization.

The code here isn't great in all caess. Particularly v4f64->v4i32
on 64-bit AVX targets. But there is some improvement in some
configurations.

There's definitely some issues with computeNumSignBits with
X86ISD::STRICT_FCMP. As well as not being able to propagate sign
bits through merge_values nodes that get created during custom
legalization.

4 years ago[TargetLowering] In expandFP_TO_UINT, add proper extend or truncate for the condition...
Craig Topper [Sun, 5 Jan 2020 02:14:33 +0000 (18:14 -0800)]
[TargetLowering] In expandFP_TO_UINT, add proper extend or truncate for the condition to feed the DstVT select.

Previously, for vectors we created a vselect with a condition that
didn't match what the target wanted according to getSetCCResultType.

To make up for this, X86 had a special DAG combine to detect if
the condition was all sign bits and then insert its own truncate
or extend. By adding the extend/truncate here explicitly we can
avoid that.

4 years ago[LegalizeVectorOps] Split most of ExpandStrictFPOp into a separate UnrollStrictFPOp...
Craig Topper [Sun, 5 Jan 2020 01:03:33 +0000 (17:03 -0800)]
[LegalizeVectorOps] Split most of ExpandStrictFPOp into a separate UnrollStrictFPOp method. Call that method from ExpandUINT_TO_FLOAT.

ExpandStrictFPOp calls ExpandUINT_TO_FLOAT. Previously, ExpandUINT_TO_FLOAT
returned SDValue() if it wasn't able to handle and needed to unroll.
Then ExpandStrictFPOp would detect his SDValue() and do the unroll.

After this change, ExpandUINT_TO_FLOAT will directly call
UnrollStrictFPOp and return the unrolled result.

4 years ago[ELF] Drop const qualifier to fix -Wrange-loop-analysis. NFC
Fangrui Song [Sat, 4 Jan 2020 19:53:17 +0000 (11:53 -0800)]
[ELF] Drop const qualifier to fix -Wrange-loop-analysis. NFC

```
lld/ELF/Relocations.cpp:1622:56: warning: loop variable 'ts' of type 'const std::pair<ThunkSection *, uint32_t>' (aka 'const pair<lld::elf::ThunkSection *, unsigned int>') creates a copy from type 'const std::pair<ThunkSection *, uint32_t>' [-Wrange-loop-analysis]
        for (const std::pair<ThunkSection *, uint32_t> ts : isd->thunkSections)
```

Drop const qualifier to fix -Wrange-loop-analysis.
We can make -Wrange-loop-analysis warnings (DiagnoseForRangeConstVariableCopies) on `const A` more
permissive on more types (e.g. POD -> trivially copyable), unfortunately it will not make std::pair
good, because `constexpr pair& operator=(const pair& p);` is unfortunately user-defined.

Reviewed By: Mordante

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

4 years agoGlobalISel: Scalarize all division operations
Matt Arsenault [Sat, 4 Jan 2020 18:24:09 +0000 (13:24 -0500)]
GlobalISel: Scalarize all division operations

This only handled G_SDIV, but they all are trivially scalarizable.

Also define placeholder AMDGPU division legalizer rules.

4 years agoRevert "[SCEV] Move ScalarEvolutionExpander.cpp to Transforms/Utils (NFC)."
Florian Hahn [Sat, 4 Jan 2020 18:44:38 +0000 (18:44 +0000)]
Revert "[SCEV] Move ScalarEvolutionExpander.cpp to Transforms/Utils (NFC)."

This reverts commit 51ef53f3bd23559203fe9af82ff2facbfedc1db3, as it
breaks some bots.

4 years ago[SCEV] Move ScalarEvolutionExpander.cpp to Transforms/Utils (NFC).
Florian Hahn [Sat, 4 Jan 2020 18:15:02 +0000 (18:15 +0000)]
[SCEV] Move ScalarEvolutionExpander.cpp to Transforms/Utils (NFC).

SCEVExpander modifies the underlying function so it is more suitable in
Transforms/Utils, rather than Analysis. This allows using other
transform utils in SCEVExpander.

Reviewers: sanjoy.google, efriedma, reames

Reviewed By: sanjoy.google

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

4 years ago[SCEV] Remove unused ScalarEvolutionExpander.h includes (NFC).
Florian Hahn [Sat, 4 Jan 2020 18:20:55 +0000 (18:20 +0000)]
[SCEV] Remove unused ScalarEvolutionExpander.h includes (NFC).

4 years agoGlobalISel: Define G_READCYCLECOUNTER
Matt Arsenault [Sat, 4 Jan 2020 17:46:58 +0000 (12:46 -0500)]
GlobalISel: Define G_READCYCLECOUNTER

4 years agoAMDGPU/GlobalISel: Refine SMRD selection rules
Matt Arsenault [Fri, 27 Dec 2019 15:17:45 +0000 (10:17 -0500)]
AMDGPU/GlobalISel: Refine SMRD selection rules

Fix selecting these for volatile global loads, and ensure the loads
are constant enough.

4 years agoAMDGPU/GlobalISel: Legalize more odd sized loads
Matt Arsenault [Thu, 2 Jan 2020 19:45:11 +0000 (14:45 -0500)]
AMDGPU/GlobalISel: Legalize more odd sized loads

The attempts to widen sufficently aligned, odd sized loads wasn't
consistently applied.

4 years agoAMDGPU/GlobalISel: Assume vcc phis for any vcc input
Matt Arsenault [Mon, 23 Dec 2019 23:34:59 +0000 (18:34 -0500)]
AMDGPU/GlobalISel: Assume vcc phis for any vcc input

This produces more intelligible looking results, more comparabble to
the DAG output in the simplest cases. This is probably wrong in
complex control flow, but RegBankSelect doesn't attempt analyzing if
this is on a masked path for selecting the bank yet.

4 years ago[Pass Registration] XFAIL load_extension.ll test on macOS.
Florian Hahn [Sat, 4 Jan 2020 17:32:15 +0000 (17:32 +0000)]
[Pass Registration] XFAIL load_extension.ll test on macOS.

This test fails  on macOS, causing the following bots to fail

http://green.lab.llvm.org/green/job/clang-stage1-cmake-RA-incremental/7438/
http://green.lab.llvm.org/green/job/clang-stage1-RA/5034/

Error:
Error opening 'build/./lib/libBye.dylib': dlopen(build/./lib/libBye.dylib, 9): image not found
  -load request ignored.

4 years agoAMDGPU/GlobalISel: Implement applyMappingImpl less incorrectly
Matt Arsenault [Mon, 23 Dec 2019 19:39:01 +0000 (14:39 -0500)]
AMDGPU/GlobalISel: Implement applyMappingImpl less incorrectly

We're checking the current register bank of the registers in the
instruction, but the mapping may have inserted cross bank copies and
is expecting to replace the registers.

We mostly get away with this currently, because VGPR->SGPR copies are
illegal, and we assume this won't happen. In a future change, we'll
start relying on more cross register bank copies being inserted, and
this starts to break down.

4 years ago[cmake] Remove install from add_llvm_example_library.
Florian Hahn [Sat, 4 Jan 2020 17:12:24 +0000 (17:12 +0000)]
[cmake] Remove install from add_llvm_example_library.

This should fix
http://lab.llvm.org:8011/builders/llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast/builds/30086

4 years agoRe-apply "[Examples] Add IRTransformations directory to examples."
Florian Hahn [Sat, 4 Jan 2020 15:01:43 +0000 (15:01 +0000)]
Re-apply "[Examples] Add IRTransformations directory to examples."

This reverts commit 19fd8925a4afe6efd248688cce06aceff50efe0c.

Should include a fix for PR44197.

4 years agoNFC: Fix trivial typos in comments
Kazuaki Ishizaki [Sat, 4 Jan 2020 15:28:41 +0000 (10:28 -0500)]
NFC: Fix trivial typos in comments

4 years ago[AMDGPU] need to insert wait between the scalar load and vector store to the same...
alex-t [Sat, 4 Jan 2020 15:23:14 +0000 (18:23 +0300)]
[AMDGPU] need to insert wait between the scalar load and vector store to the same address to avoid WAR conflict.

Reviewers: rampitec, vpykhtin, nhaehnle

Reviewed By: rampitec

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

4 years ago[NFCI][InstCombine] Refactor 'sink negation into select if that folds one hand of...
Roman Lebedev [Sat, 4 Jan 2020 14:24:20 +0000 (17:24 +0300)]
[NFCI][InstCombine] Refactor 'sink negation into select if that folds one hand of select to 0' fold

I would think it's better than having two practically identical folds
next to eachother, but then generalization isn't all that pretty
due to the fact that we need to produce different `sub` each time..

This change is no-functional-changes-intended refactoring.

4 years ago[InstCombine] Sink sub into hands of select if one hand becomes zero. Part 2 (PR44426)
Roman Lebedev [Sat, 4 Jan 2020 13:50:53 +0000 (16:50 +0300)]
[InstCombine] Sink sub into hands of select if one hand becomes zero. Part 2 (PR44426)

This decreases use count of %Op0, makes one hand of select to be 0,
and possibly exposes further folding potential.

Name: sub %Op0, (select %Cond, %Op0, %FalseVal) -> select %Cond, 0, (sub %Op0, %FalseVal)
  %Op0 = %TrueVal
  %o = select i1 %Cond, i8 %Op0, i8 %FalseVal
  %r = sub i8 %Op0, %o
=>
  %n = sub i8 %Op0, %FalseVal
  %r = select i1 %Cond, i8 0, i8 %n

Name: sub %Op0, (select %Cond, %TrueVal, %Op0) -> select %Cond, (sub %Op0, %TrueVal), 0
  %Op0 = %FalseVal
  %o = select i1 %Cond, i8 %TrueVal, i8 %Op0
  %r = sub i8 %Op0, %o
=>
  %n = sub i8 %Op0, %TrueVal
  %r = select i1 %Cond, i8 %n, i8 0

https://rise4fun.com/Alive/aHRt

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

4 years ago[NFC][InstCombine] 'subtract from one hands of select' pattern tests (PR44426)
Roman Lebedev [Sat, 4 Jan 2020 13:43:34 +0000 (16:43 +0300)]
[NFC][InstCombine] 'subtract from one hands of select' pattern tests (PR44426)

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

4 years ago[InstCombine] Sink sub into hands of select if one hand becomes zero (PR44426)
Roman Lebedev [Sat, 4 Jan 2020 13:31:18 +0000 (16:31 +0300)]
[InstCombine] Sink sub into hands of select if one hand becomes zero (PR44426)

This decreases use count of %Op1, makes one hand of select to be 0,
and possibly exposes further folding potential.

Name: sub (select %Cond, %Op1, %FalseVal), %Op1 -> select %Cond, 0, (sub %FalseVal, %Op1)
  %Op1 = %TrueVal
  %o = select i1 %Cond, i8 %Op1, i8 %FalseVal
  %r = sub i8 %o, %Op1
=>
  %n = sub i8 %FalseVal, %Op1
  %r = select i1 %Cond, i8 0, i8 %n

Name: sub (select %Cond, %TrueVal, %Op1), %Op1 -> select %Cond, (sub %TrueVal, %Op1), 0
  %Op1 = %FalseVal
  %o = select i1 %Cond, i8 %TrueVal, i8 %Op1
  %r = sub i8 %o, %Op1
=>
  %n = sub i8 %TrueVal, %Op1
  %r = select i1 %Cond, i8 %n, i8 0

https://rise4fun.com/Alive/avL

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

4 years ago[NFC][InstCombine] 'subtract of one hands of select' pattern tests (PR44426)
Roman Lebedev [Sat, 4 Jan 2020 13:23:44 +0000 (16:23 +0300)]
[NFC][InstCombine] 'subtract of one hands of select' pattern tests (PR44426)

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

4 years ago[Transforms][GlobalSRA] huge array causes long compilation time and huge memory usage.
Alexey Lapshin [Tue, 24 Dec 2019 21:38:09 +0000 (00:38 +0300)]
[Transforms][GlobalSRA] huge array causes long compilation time and huge memory usage.

Summary:
For artificial cases (huge array, few usages), Global SRA optimization creates
a lot of redundant data. It creates an instance of GlobalVariable for each array
element. For huge array, that means huge compilation time and huge memory usage.
Following example compiles for 10 minutes and requires 40GB of memory.

namespace {
  char LargeBuffer[64 * 1024 * 1024];
}

int main ( void ) {

    LargeBuffer[0] = 0;

    printf("\n ");

    return LargeBuffer[0] == 0;
}

The fix is to avoid Global SRA for large arrays.

Reviewers: craig.topper, rnk, efriedma, fhahn

Reviewed By: rnk

Subscribers: xbolva00, lebedev.ri, lkail, merge_guards_bot, hiraditya, llvm-commits

Tags: #llvm

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

4 years ago[TargetLowering] SimplifyDemandedBits - call SimplifyMultipleUseDemandedBits for...
Simon Pilgrim [Sat, 4 Jan 2020 13:15:50 +0000 (13:15 +0000)]
[TargetLowering] SimplifyDemandedBits - call SimplifyMultipleUseDemandedBits for ISD::EXTRACT_VECTOR_ELT (REAPPLIED)

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.

Reapplied after reversion at rL368660 due to PR42982 which was fixed at rGca7fdd41bda0.

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

4 years ago[LLD] [COFF] Don't error out on duplicate absolute symbols with the same value
Martin Storsjö [Sun, 29 Dec 2019 22:32:22 +0000 (00:32 +0200)]
[LLD] [COFF] Don't error out on duplicate absolute symbols with the same value

Both MS link.exe and GNU ld.bfd handle it this way; one can have
multiple object files defining the same absolute symbols, as long
as it defines it to the same value. But if there are multiple absolute
symbols with differing values, it is treated as an error.

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

4 years ago[X86] Update MaxIndex test in x86-cmov-converter.ll to return the index and not use...
Craig Topper [Sat, 4 Jan 2020 07:58:43 +0000 (23:58 -0800)]
[X86] Update MaxIndex test in x86-cmov-converter.ll to return the index and not use the index to look up the array after the loop.

This represents a more realistic version of the code being tested.
The cmov converter doesn't look at the code after the loop so
it doesn't matter for what's being tested.

But as noted in this twitter thread https://twitter.com/trav_downs/status/1213311159413161987
gcc can turn the previous MaxIndex code into the MaxValue code. So
returning the index makes it a distinct case.

4 years ago[OpenMP] NFC: Fix trivial typos in comments
Kelvin Li [Sat, 4 Jan 2020 03:03:42 +0000 (22:03 -0500)]
[OpenMP] NFC: Fix trivial typos in comments

Submitted by: kiszk

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

4 years ago[gn build] Port 5d304d68dd5
LLVM GN Syncbot [Sat, 4 Jan 2020 02:17:36 +0000 (02:17 +0000)]
[gn build] Port 5d304d68dd5

4 years agoRevert "[gicombiner] Add GIMatchTree and use it for the code generation"
Daniel Sanders [Sat, 4 Jan 2020 02:13:50 +0000 (18:13 -0800)]
Revert "[gicombiner] Add GIMatchTree and use it for the code generation"

All the windows bots are failing match-tree.td and there's no obvious cause that
I can see. It's not just the %p formatting problem. My best guess is that
there's an ordering issue too but I'll need further information to figure that
out. Revert while I'm investigating.

This reverts commit 64f1bb5cd2c6d69af7c74ec68840029603560238 and 77d4b5f5feff663e70b347516cc4c77fa5cd2a20

4 years ago[lldb/Command] Add --force option for `watchpoint delete` command
Med Ismail Bennani [Sat, 28 Dec 2019 13:47:51 +0000 (14:47 +0100)]
[lldb/Command] Add --force option for `watchpoint delete` command

Currently, there is no option to delete all the watchpoint without LLDB
asking for a confirmation. Besides making the watchpoint delete command
homogeneous with the breakpoint delete command, this option could also
become handy to trigger automated watchpoint deletion i.e. using
breakpoint actions.

rdar://42560586

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

Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
4 years ago[X86] Autogenerate complete checks. NFC
Craig Topper [Sat, 4 Jan 2020 01:18:07 +0000 (17:18 -0800)]
[X86] Autogenerate complete checks. NFC

4 years ago[Remarks] Warn if a remark file is not found when processing static archives
Francis Visoiu Mistrih [Fri, 3 Jan 2020 22:50:19 +0000 (14:50 -0800)]
[Remarks] Warn if a remark file is not found when processing static archives

Static archives contain object files which contain sections pointing to
external remark files.

When static archives are shipped without the remark files, dsymutil
shouldn't generate an error.

Instead, generate a warning to inform the user that remarks for that
library won't be available in the .dSYM.

4 years ago[UserExpression] Clean up `return` after `else`.
Davide Italiano [Sat, 4 Jan 2020 00:49:51 +0000 (16:49 -0800)]
[UserExpression] Clean up `return` after `else`.

4 years ago[gicombiner] Correct 64f1bb5cd2c to account for MSVC's %p format
Daniel Sanders [Sat, 4 Jan 2020 00:51:28 +0000 (16:51 -0800)]
[gicombiner] Correct 64f1bb5cd2c to account for MSVC's %p format

4 years ago[Diagnostic] Add test for previous b4b904e19bb356724b2c6aea0199ce05c6f15cdb
Tyker [Fri, 3 Jan 2020 23:14:17 +0000 (00:14 +0100)]
[Diagnostic] Add test for previous b4b904e19bb356724b2c6aea0199ce05c6f15cdb

4 years ago[gn build] Port 64f1bb5cd2c
LLVM GN Syncbot [Sat, 4 Jan 2020 00:24:04 +0000 (00:24 +0000)]
[gn build] Port 64f1bb5cd2c

4 years ago[gicombiner] Add GIMatchTree and use it for the code generation
Daniel Sanders [Fri, 3 Jan 2020 23:53:25 +0000 (15:53 -0800)]
[gicombiner] Add GIMatchTree and use it for the code generation

Summary:
GIMatchTree's job is to build a decision tree by zipping all the
GIMatchDag's together.

Each DAG is added to the tree builder as a leaf and partitioners are used
to subdivide each node until there are no more partitioners to apply. At
this point, the code generator is responsible for testing any untested
predicates and following any unvisited traversals (there shouldn't be any
of the latter as the getVRegDef partitioner handles them all).

Note that the leaves don't always fit into partitions cleanly and the
partitions may overlap as a result. This is resolved by cloning the leaf
into every partition it belongs to. One example of this is a rule that can
match one of N opcodes. The leaf for this rule would end up in N partitions
when processed by the opcode partitioner. A similar example is the
getVRegDef partitioner where having rules (add $a, $b), and (add ($a, $b), $c)
will result in the former being in the partition for successfully
following the vreg-def and failing to do so as it doesn't care which
happens.

Depends on D69151

Reviewers: bogner, volkan

Reviewed By: volkan

Subscribers: lkail, mgorny, llvm-commits

Tags: #llvm

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

4 years agoAdd missing mlir-headers target and add tablegen'd deps to it.
Stella Laurenzo [Wed, 1 Jan 2020 00:32:41 +0000 (16:32 -0800)]
Add missing mlir-headers target and add tablegen'd deps to it.

Summary:
Prior to this, "ninja install-mlir-headers" failed with an error indicating
the missing target. Verified that from a clean build, the installed
headers include generated files.

Subscribers: mgorny, mehdi_amini, rriddle, jpienaar, burmako, shauheen, antiagainst, nicolasvasilache, llvm-commits

Tags: #llvm

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

4 years ago[fuchsia] Enable Clang Static Analyzer
Gabor Horvath [Fri, 3 Jan 2020 23:49:32 +0000 (15:49 -0800)]
[fuchsia] Enable Clang Static Analyzer

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

4 years ago[AMDGPU] Revert scheduling to reduce spilling
Stanislav Mekhanoshin [Fri, 3 Jan 2020 21:19:51 +0000 (13:19 -0800)]
[AMDGPU] Revert scheduling to reduce spilling

We can revert region schedule if new schedule decreases occupancy.
However, if we already have only one wave we would accept any new
schedule even if it blows up register pressure. Such schedule may
result in quite heavy spilling which can be avoided if we reject
this new schedule.

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

4 years ago[lldb/Utility] YAML validation should be orthogonal to packet semantics.
Jonas Devlieghere [Fri, 3 Jan 2020 22:17:25 +0000 (14:17 -0800)]
[lldb/Utility] YAML validation should be orthogonal to packet semantics.

It's not up to YAML to validate the semantics of the GDB remote packet
struct. This is especially wrong here as there's nothing that says that
the amount of bytes transmitted  matches the packet payload size.

4 years ago[lldb/Docs] Include the man page on the website
Jonas Devlieghere [Fri, 3 Jan 2020 21:59:08 +0000 (13:59 -0800)]
[lldb/Docs] Include the man page on the website

4 years ago[PowerPC][LoopVectorize] Add tests for fp128 and fp16
Jinsong Ji [Fri, 3 Jan 2020 20:56:06 +0000 (20:56 +0000)]
[PowerPC][LoopVectorize] Add tests for fp128 and fp16

Add two tests to reg-usage.ll

4 years ago[globalisel] Fix another mismatch between %d and the RuleID type
Daniel Sanders [Fri, 3 Jan 2020 21:35:56 +0000 (13:35 -0800)]
[globalisel] Fix another mismatch between %d and the RuleID type

4 years ago[lldb/Docs] Include how to generate the man page
Jonas Devlieghere [Fri, 3 Jan 2020 21:34:21 +0000 (13:34 -0800)]
[lldb/Docs] Include how to generate the man page

4 years ago[clang-tidy] fix linkage with clangSema for FixitHintUtils, undo previous wrong fix
Jonas Toth [Fri, 3 Jan 2020 21:31:23 +0000 (22:31 +0100)]
[clang-tidy] fix linkage with clangSema for FixitHintUtils, undo previous wrong fix

4 years ago[mlir] Compilation fix: use LLVM_ATTRIBUTE_UNUSED following 6656e961c08393c3949412ef9...
Alexandre Ganea [Fri, 3 Jan 2020 21:31:24 +0000 (16:31 -0500)]
[mlir] Compilation fix: use LLVM_ATTRIBUTE_UNUSED following 6656e961c08393c3949412ef945ade0272b66fca

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

4 years ago[mlir] Fix indexed_accessor_range to properly forward the derived class.
River Riddle [Fri, 3 Jan 2020 21:12:25 +0000 (13:12 -0800)]
[mlir] Fix indexed_accessor_range to properly forward the derived class.

Summary: This fixes the return value of helper methods on the base range class.

Reviewed By: jpienaar

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

4 years agoGlobalISel: Add type argument to getRegBankFromRegClass
Matt Arsenault [Sat, 9 Nov 2019 05:21:00 +0000 (21:21 -0800)]
GlobalISel: Add type argument to getRegBankFromRegClass

AMDGPU can't unambiguously go back from the selected instruction
register class to the register bank without knowing if this was used
in a boolean context.

4 years ago[bindings/go] Add Subprogram method
Ayke van Laethem [Fri, 3 Jan 2020 21:10:27 +0000 (22:10 +0100)]
[bindings/go] Add Subprogram method

This method allows getting the subprogram metadata object from a
function value.

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

4 years ago[amdgpu] Skip non-instruction values in CF user tracing.
Michael Liao [Wed, 27 Nov 2019 14:49:56 +0000 (09:49 -0500)]
[amdgpu] Skip non-instruction values in CF user tracing.

Summary:
- CF users won't be non-instruction values. Skip them to save the
  compilation time. It's especially true when there are multiple
  functions in that module, where, says, a constant may be used in most
  functions. The current CF user tracing adds significant overhead.

Reviewers: alex-t, rampitec

Subscribers: arsenm, kzhuravl, jvesely, wdng, nhaehnle, yaxunl, dstuttard, tpr, t-tye, hiraditya, llvm-commits

Tags: #llvm

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

4 years ago[clang-tidy] quickfix: add -fno-delayed-template-parsing as default argument for...
Jonas Toth [Fri, 3 Jan 2020 21:02:11 +0000 (22:02 +0100)]
[clang-tidy] quickfix: add -fno-delayed-template-parsing as default argument for runCheckOnCode unit-tests to unbreak windows

4 years ago[clang-tidy] fix broken linking for AddConstTest with adding clangSema as dependency...
Jonas Toth [Fri, 3 Jan 2020 20:55:40 +0000 (21:55 +0100)]
[clang-tidy] fix broken linking for AddConstTest with adding clangSema as dependency (DeclSpec)

4 years ago[NFC][ORC] Fix typos and whitespaces in comments
Stefan Gränitz [Fri, 3 Jan 2020 17:33:33 +0000 (18:33 +0100)]
[NFC][ORC] Fix typos and whitespaces in comments

4 years ago[gn build] Port 9861a8538c0
LLVM GN Syncbot [Fri, 3 Jan 2020 20:30:09 +0000 (20:30 +0000)]
[gn build] Port 9861a8538c0

4 years ago[SystemZ] Don't allow CL option -mpacked-stack with -mbackchain.
Jonas Paulsson [Mon, 30 Dec 2019 22:03:49 +0000 (23:03 +0100)]
[SystemZ]  Don't allow CL option -mpacked-stack with -mbackchain.

-mpacked-stack is currently not supported with -mbackchain, so this should
result in a compilation error message instead of being silently ignored.

Review: Ulrich Weigand

4 years agoAMDGPU: Add gfx9 run lines to a testcase
Matt Arsenault [Fri, 3 Jan 2020 19:47:59 +0000 (14:47 -0500)]
AMDGPU: Add gfx9 run lines to a testcase

4 years agoAMDGPU/GlobalISel: Add new utils file
Matt Arsenault [Fri, 3 Jan 2020 14:10:00 +0000 (09:10 -0500)]
AMDGPU/GlobalISel: Add new utils file

There are some things that are shareable between the legalizer,
regbankselect, and the selector that don't have an obvious place to
go.

4 years agoAMDGPU: Only allow regs for s_movrel_{b32|b64}
Matt Arsenault [Fri, 3 Jan 2020 01:59:29 +0000 (20:59 -0500)]
AMDGPU: Only allow regs for s_movrel_{b32|b64}

This would incorrectly allowing folding immediates. These currently
aren't selectable, but will be from GlobalISel soon.

4 years ago[mlir] Enhance classof() checks in StructsGen
Lei Zhang [Fri, 3 Jan 2020 20:08:54 +0000 (15:08 -0500)]
[mlir] Enhance classof() checks in StructsGen

Previously we only check that each field is of the correct
mlir::Attribute subclass. This commit enhances to also consider
the attribute's types, by leveraging the constraints already
encoded in TableGen attribute definitions.

Reviewed By: rsuderman

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

4 years ago[mlir][Linalg] NFC - Post-commit format fix
Nicolas Vasilache [Fri, 3 Jan 2020 20:10:24 +0000 (15:10 -0500)]
[mlir][Linalg] NFC - Post-commit format fix

4 years ago[mlir][Linalg] NFC - Hotfix GenericLoopNestBuilder compilation error on older gcc...
Nicolas Vasilache [Fri, 3 Jan 2020 20:05:39 +0000 (15:05 -0500)]
[mlir][Linalg] NFC - Hotfix GenericLoopNestBuilder compilation error on older gcc (-fpermissive)

This fixes the error:
```
  mlir/include/mlir/Dialect/Linalg/Utils/Utils.h:72:3: error:   from definition of 'template<class LoopTy> mlir::edsc::GenericLoopNestRangeBuilder<LoopTy>::GenericLoopNestRangeBuilder(llvm::ArrayRef<mlir::edsc::ValueHandle*>, llvm::ArrayRef<mlir::Value>)' [-fpermissive]
    GenericLoopNestRangeBuilder(ArrayRef<edsc::ValueHandle *> ivs,
```

This was tested independently on a Docker image with gcc-5 by jpienaar@

4 years ago[mlir][spirv] Fix ADDITIONAL_HEADER_DIRS for SPIR-V libraries
Lei Zhang [Fri, 3 Jan 2020 20:05:24 +0000 (15:05 -0500)]
[mlir][spirv] Fix ADDITIONAL_HEADER_DIRS for SPIR-V libraries

SPIRV/ headers live under mlir/Dialect/.

Reviewed By: rriddle

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

4 years ago[DAGCombiner] fix miscompile in translating (X & undef) to shuffle
Sanjay Patel [Fri, 3 Jan 2020 19:57:35 +0000 (14:57 -0500)]
[DAGCombiner] fix miscompile in translating (X & undef) to shuffle

See PR42982 for more context:
https://bugs.llvm.org/show_bug.cgi?id=42982

4 years ago[LegalizeVectorOps] Pass the post-UpdateNodeOperands version of Op to ExpandLoad...
Craig Topper [Fri, 3 Jan 2020 19:52:18 +0000 (11:52 -0800)]
[LegalizeVectorOps] Pass the post-UpdateNodeOperands version of Op to ExpandLoad/ExpandStore

UpdateNodeOperands might CSE to another existing node. So we should make sure we're legalizing that node otherwise we might fail to hook up the operands properly. I've moved the result registration up to the caller to avoid having to pass both Result and Op into the functions where it might be confusing which is which.

This address 2 other issues pointed out in D71861.

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

4 years ago[x86] add test for miscompile in XformToShuffleWithZero(); NFC
Sanjay Patel [Fri, 3 Jan 2020 19:48:45 +0000 (14:48 -0500)]
[x86] add test for miscompile in XformToShuffleWithZero(); NFC

4 years ago[gn build] Port cf48101200e
LLVM GN Syncbot [Fri, 3 Jan 2020 19:41:47 +0000 (19:41 +0000)]
[gn build] Port cf48101200e

4 years ago[X86] Improve for v2i32->v2f64 uint_to_fp
Craig Topper [Fri, 3 Jan 2020 18:56:09 +0000 (10:56 -0800)]
[X86] Improve for v2i32->v2f64 uint_to_fp

This uses an alternative implementation of this conversion derived
from our v2i32->v2f32 handling. We can zero extend the v2i32 to
v2i64, or it with the bit representation of 2.0^52 which will give
us 2.0^52 plus the 32-bit integer since double's mantissa is 52 bits.
Then we just need to subtract 2.0^52 as a double and let the floating
point unit normalize the remaining bits into a valid double.

This is less instructions then our previous code, but does require
a port 5 shuffle for the zero extend or unpack.

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

4 years ago[clang-tidy] implement utility-function to add 'const' to variables
Jonas Toth [Fri, 3 Jan 2020 19:36:49 +0000 (20:36 +0100)]
[clang-tidy] implement utility-function to add 'const' to variables

Summary:
This patch extends the already existing facility to add 'const' to variables
to be more flexible and correct. The previous version did not consider pointers
as value AND pointee. For future automatic introduction for const-correctness
this shortcoming needs to be fixed.
It always allows configuration where the 'const' token is inserted, either on
the left side (if possible) or the right side.
It adds many unit-tests to the utility-function that did not exist before, as
the function was implicitly tested through clang-tidy checks. These
tests were not changed, as the API is still compatible.

Reviewers: aaron.ballman, hokein, alexfh, shuaiwang, lebedev.ri

Reviewed By: aaron.ballman

Subscribers: jdoerfert, mgorny, xazax.hun, cfe-commits

Tags: #clang

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

4 years ago[mlir][Linalg] NFC - Hotfix GenericLoopNestBuilder compilation error (-fpermissive)
Nicolas Vasilache [Fri, 3 Jan 2020 19:28:32 +0000 (14:28 -0500)]
[mlir][Linalg] NFC - Hotfix GenericLoopNestBuilder compilation error (-fpermissive)

This should fix the error:
```
mlir/include/mlir/Dialect/Linalg/Utils/Utils.h:72:3: error:   from definition of 'template<class LoopTy> mlir::edsc::GenericLoopNestRangeBuilder<LoopTy>::GenericLoopNestRangeBuilder(llvm::ArrayRef<mlir::edsc::ValueHandle*>, llvm::ArrayRef<mlir::Value>)' [-fpermissive]
   GenericLoopNestRangeBuilder(ArrayRef<edsc::ValueHandle *> ivs,
```

4 years agoMove tail call disabling code to target independent code
Reid Kleckner [Tue, 3 Dec 2019 00:42:33 +0000 (16:42 -0800)]
Move tail call disabling code to target independent code

When the "disable-tail-calls" attribute was added, checks were added for
it in various backends. Now this code has proliferated, and it is
something the target is responsible for checking. Move that
responsibility back to the ISels (fast, global, and SD).

There's no major functionality change, except for targets that never
implemented this check.

This LLVM attribute was originally added in
d9699bc7bdf0362173fcd256690f61a4d47429c2 (2015).

Reviewers: echristo, MaskRay

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

4 years agoRemove outdated svn/git information from hacking page
Alexander Lanin [Fri, 3 Jan 2020 19:13:40 +0000 (14:13 -0500)]
Remove outdated svn/git information from hacking page

The patch files section is redundant to https://llvm.org/docs/GettingStarted.html.
There is nothing clang specific here. We are talking about a monorepo after all.
While it may seem nice to have one single clang page which explains everything,
it's not: It doesn't cover the topics in sufficient depth, it's redundant to
other pages and it's hard to keep it up to date as we see with the svn
instructions.

4 years ago[NFC][InstCombine] '(Op1 & С) - Op1' -> '-(Op1 & ~C)' fold (PR44427)
Roman Lebedev [Fri, 3 Jan 2020 18:10:51 +0000 (21:10 +0300)]
[NFC][InstCombine] '(Op1 & С) - Op1' -> '-(Op1 & ~C)' fold (PR44427)

This decreases use count of Op1, potentially allows
us to further hoist said 'neg' later on,
and results in marginally better X86 codegen.

Name: (Op1 & С) - Op1 -> -(Op1 & ~C)
  %o = and i64 %Op1, C1
  %r = sub i64 %o, %Op1
=>
  %n = and i64 %Op1, ~C1
  %r = sub i64 0, %n

https://rise4fun.com/Alive/rwgA

https://godbolt.org/z/R_RMfM

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

4 years ago[NFC][InstCombine] '(Op1 & С) - Op1' pattern tests (PR44427)
Roman Lebedev [Fri, 3 Jan 2020 18:05:34 +0000 (21:05 +0300)]
[NFC][InstCombine] '(Op1 & С) - Op1' pattern tests (PR44427)

4 years ago[NFC][InstCombine] Autogenerate and2.ll checklines
Roman Lebedev [Fri, 3 Jan 2020 17:54:31 +0000 (20:54 +0300)]
[NFC][InstCombine] Autogenerate and2.ll checklines

4 years ago[mlir][linalg] Lower linalg to affine loops
Ahmed Taei [Fri, 3 Jan 2020 18:20:43 +0000 (13:20 -0500)]
[mlir][linalg] Lower linalg to affine loops

Reviewers: nicolasvasilache

Reviewed By: nicolasvasilache

Subscribers: mgester, lucyrfox, merge_guards_bot, AlexEichenberger, mravishankar, ftynse, mehdi_amini, rriddle, jpienaar, burmako, shauheen, antiagainst, nicolasvasilache, arpith-jacob, llvm-commits

Tags: #llvm

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

4 years ago[mlir][Vector] NFC - Add documentation for the VectorOps dialect.
Nicolas Vasilache [Fri, 3 Jan 2020 18:05:44 +0000 (13:05 -0500)]
[mlir][Vector] NFC - Add documentation for the VectorOps dialect.

4 years ago[DWARF] Don't assume optional always has a value.
Jonas Devlieghere [Fri, 3 Jan 2020 17:30:20 +0000 (09:30 -0800)]
[DWARF] Don't assume optional always has a value.

When getting the file name form the line table prologue we assume that a
valid string form value can always be extracted as a string. If you look
at the implementation of DWARFormValue this is not necessarily true. I
hit this assertion from LLDB when I create a "dummy" DWARFContext that
was missing the string section.

4 years ago[NFC][InstCombine] '(X & (- Y)) - X' -> '- (X & (Y - 1))' fold (PR44448)
Roman Lebedev [Fri, 3 Jan 2020 16:53:29 +0000 (19:53 +0300)]
[NFC][InstCombine] '(X & (- Y)) - X' -> '- (X & (Y - 1))' fold (PR44448)

Name: (X & (- Y)) - X  ->  - (X & (Y - 1))  (PR44448)
  %negy = sub i8 0, %y
  %unbiasedx = and i8 %negy, %x
  %r = sub i8 %unbiasedx, %x
=>
  %ymask = add i8 %y, -1
  %xmasked = and i8 %ymask, %x
  %r = sub i8 0, %xmasked

https://rise4fun.com/Alive/OIpla

This decreases use count of %x, may allow us to
later hoist said negation even further,
and results in marginally nicer X86 codegen.

See
  https://bugs.llvm.org/show_bug.cgi?id=44448
  https://reviews.llvm.org/D71499

4 years ago[NFC][InstCombine] '(X & (- Y)) - X' pattern tests (PR44448)
Roman Lebedev [Fri, 3 Jan 2020 16:34:39 +0000 (19:34 +0300)]
[NFC][InstCombine] '(X & (- Y)) - X' pattern tests (PR44448)

As discussed in https://bugs.llvm.org/show_bug.cgi?id=44448,
we can hoist negation out of the pattern.

4 years ago[AArch64][test] Merge arm64-$i.ll Linux tests into $i.ll
Fangrui Song [Fri, 3 Jan 2020 17:15:52 +0000 (09:15 -0800)]
[AArch64][test] Merge arm64-$i.ll Linux tests into $i.ll

Reviewed By: dmgreen

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

4 years ago[clangd] targetDecl() returns only NamedDecls.
Sam McCall [Fri, 3 Jan 2020 16:26:33 +0000 (17:26 +0100)]
[clangd] targetDecl() returns only NamedDecls.

Summary:
While it's perfectly reasonable for non-named decls such as
static_assert to resolve to themselves:
 - nothing else ever resolves to them
 - features based on references (hover, highlight, find refs etc) tend
   to be uninteresting where only trivial references are possible
 - returning NamedDecl is a more convenient API (we cast to it in many places)
 - this aligns closer to findExplicitReferences/explicitReferenceTargets

This fixes a crash in explicitReferenceTargets: if the target is a
non-named decl then there's an invalid unchecked cast to NamedDecl.

In practice this means when hovering over e.g. a static_assert:
 - before ac3f9e4842, we would show a (boring) hover card
 - after ac3f9e4842, we would crash
 - after this patch, we will show nothing

Reviewers: kadircet, ilya-biryukov

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

Tags: #clang

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