]> granicus.if.org Git - llvm/log
llvm
5 years ago[AMDGPU] Avoid DAG combining assert with fneg(fadd(A,0))
Tim Renouf [Thu, 18 Apr 2019 05:27:01 +0000 (05:27 +0000)]
[AMDGPU] Avoid DAG combining assert with fneg(fadd(A,0))

fneg combining attempts to turn it into fadd(fneg(A), fneg(0)), but
creating the new fadd folds to just fneg(A). When A has multiple uses,
this confuses it and you get an assert. Fixed.

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

Change-Id: I0ddc9b7286abe78edc0cd8d734fdeb05ff09821c

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

5 years agoFix a typo in comments. [NFC]
Ali Tamur [Thu, 18 Apr 2019 02:39:37 +0000 (02:39 +0000)]
Fix a typo in comments. [NFC]

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

5 years ago[GISel]:IRTranslator: Prefer a buidInstr form that allows CSE of cast instructions
Aditya Nandakumar [Thu, 18 Apr 2019 02:19:29 +0000 (02:19 +0000)]
[GISel]:IRTranslator: Prefer a buidInstr form that allows CSE of cast instructions

https://reviews.llvm.org/D60844

Use the style of buildInstr that allows CSEing.

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

5 years agoFix bad compare function over FusionCandidate.
Richard Trieu [Thu, 18 Apr 2019 01:39:45 +0000 (01:39 +0000)]
Fix bad compare function over FusionCandidate.

Reverse the checking of the domiance order so that when a self compare happens,
it returns false.  This makes compare function have strict weak ordering.

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

5 years agoRevert Implement sys::fs::copy_file using the macOS copyfile(3) API to support APFS...
Adrian Prantl [Thu, 18 Apr 2019 01:21:10 +0000 (01:21 +0000)]
Revert Implement sys::fs::copy_file using the macOS copyfile(3) API to support APFS clones.

This reverts r358628 (git commit 91a06bee788262a294527b815354f380d99dfa9b)
while investigating a crash reproducer bot failure.

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

5 years agoImplement sys::fs::copy_file using the macOS copyfile(3) API
Adrian Prantl [Thu, 18 Apr 2019 00:01:05 +0000 (00:01 +0000)]
Implement sys::fs::copy_file using the macOS copyfile(3) API
to support APFS clones.

This patch adds a Darwin-specific implementation of
llvm::sys::fs::copy_file() that uses the macOS copyfile(3) API to
support APFS copy-on-write clones, which should be faster and much
more space efficient.

https://developer.apple.com/library/archive/documentation/FileManagement/Conceptual/APFS_Guide/ToolsandAPIs/ToolsandAPIs.html

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

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

5 years agoFix formatting. NFC
Akira Hatanaka [Wed, 17 Apr 2019 23:14:39 +0000 (23:14 +0000)]
Fix formatting. NFC

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

5 years ago[x86] try to widen 'shl' as part of LEA formation
Sanjay Patel [Wed, 17 Apr 2019 22:38:51 +0000 (22:38 +0000)]
[x86] try to widen 'shl' as part of LEA formation

The test file has pairs of tests that are logically equivalent:
https://rise4fun.com/Alive/2zQ

%t4 = and i8 %t1, 8
%t5 = zext i8 %t4 to i16
%sh = shl i16 %t5, 2
%t6 = add i16 %sh, %t0
=>
%t4 = and i8 %t1, 8
%sh2 = shl i8 %t4, 2
%z5 = zext i8 %sh2 to i16
%t6 = add i16 %z5, %t0

...so if we can fold the shift op into LEA in the 1st pattern, then we
should be able to do the same in the 2nd pattern (unnecessary 'movzbl'
is a separate bug I think).

We don't want to do this any sooner though because that would conflict
with generic transforms that try to narrow the width of the shift.

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

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

5 years agoTest commit by Denis Bakhvalov
Denis Bakhvalov [Wed, 17 Apr 2019 22:27:30 +0000 (22:27 +0000)]
Test commit by Denis Bakhvalov

Change-Id: I4d85123a157d957434902fb14ba50926b2d56212

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

5 years ago[AsmPrinter] hoist %a output template to base class for ARM+Aarch64
Nick Desaulniers [Wed, 17 Apr 2019 22:21:10 +0000 (22:21 +0000)]
[AsmPrinter] hoist %a output template to base class for ARM+Aarch64

Summary:
X86 is quite complicated; so I intend to leave it as is. ARM+Aarch64 do
basically the same thing (Aarch64 did not correctly handle immediates,
ARM has a test llvm/test/CodeGen/ARM/2009-04-06-AsmModifier.ll that uses
%a with an immediate) for a flag that should be target independent
anyways.

Reviewers: echristo, peter.smith

Reviewed By: echristo

Subscribers: javed.absar, eraman, kristof.beyls, hiraditya, llvm-commits, srhines

Tags: #llvm

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

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

5 years agoAdd a getSizeInBits() accessor to MachineMemOperand. NFC.
Amara Emerson [Wed, 17 Apr 2019 22:21:05 +0000 (22:21 +0000)]
Add a getSizeInBits() accessor to MachineMemOperand. NFC.

Cleans up a bunch of places where we do getSize() * 8.

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

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

5 years ago[GlobalISel] Add legalization support for non-power-2 loads and stores
Amara Emerson [Wed, 17 Apr 2019 21:30:07 +0000 (21:30 +0000)]
[GlobalISel] Add legalization support for non-power-2 loads and stores

Legalize things like i24 load/store by splitting them into smaller power of 2 operations.

This matches how SelectionDAG handles these operations.

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

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

5 years agoAdd basic loop fusion pass.
Kit Barton [Wed, 17 Apr 2019 18:53:27 +0000 (18:53 +0000)]
Add basic loop fusion pass.

This patch adds a basic loop fusion pass. It will fuse loops that conform to the
following 4 conditions:
  1. Adjacent (no code between them)
  2. Control flow equivalent (if one loop executes, the other loop executes)
  3. Identical bounds (both loops iterate the same number of iterations)
  4. No negative distance dependencies between the loop bodies.

The pass does not make any changes to the IR to create opportunities for fusion.
Instead, it checks if the necessary conditions are met and if so it fuses two
loops together.

The pass has not been added to the pass pipeline yet, and thus is not enabled by
default. It can be run stand alone using the -loop-fusion option.

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

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

5 years ago[AsmPrinter] defer %c to base class for ARM, PPC, and Hexagon. NFC
Nick Desaulniers [Wed, 17 Apr 2019 18:22:48 +0000 (18:22 +0000)]
[AsmPrinter] defer %c to base class for ARM, PPC, and Hexagon. NFC

Summary:
None of these derived classes do anything that the base class cannot.
If we remove these case statements, then the base class can handle them
just fine.

Reviewers: peter.smith, echristo

Reviewed By: echristo

Subscribers: nemanjai, javed.absar, eraman, kristof.beyls, hiraditya, kbarton, jsji, llvm-commits, srhines

Tags: #llvm

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

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

5 years ago[ThinLTO] Fix ThinLTOCodegenerator to export llvm.used symbols
Steven Wu [Wed, 17 Apr 2019 17:38:09 +0000 (17:38 +0000)]
[ThinLTO] Fix ThinLTOCodegenerator to export llvm.used symbols

Summary:
Reapply r357931 with fixes to ThinLTO testcases and llvm-lto tool.

ThinLTOCodeGenerator currently does not preserve llvm.used symbols and
it can internalize them. In order to pass the necessary information to the
legacy ThinLTOCodeGenerator, the input to the code generator is
rewritten to be based on lto::InputFile.

Now ThinLTO using the legacy LTO API will requires data layout in
Module.

"internalize" thinlto action in llvm-lto is updated to run both
"promote" and "internalize" with the same configuration as
ThinLTOCodeGenerator. The old "promote" + "internalize" option does not
produce the same output as ThinLTOCodeGenerator.

This fixes: PR41236
rdar://problem/49293439

Reviewers: tejohnson, pcc, kromanova, dexonsmith

Reviewed By: tejohnson

Subscribers: ormris, bd1976llvm, mehdi_amini, inglorion, eraman, hiraditya, jkorous, dexonsmith, arphaman, dang, llvm-commits

Tags: #llvm

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

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

5 years ago[InstCombine] Factor out unreachable inst idiom creation [NFC]
Philip Reames [Wed, 17 Apr 2019 17:37:58 +0000 (17:37 +0000)]
[InstCombine] Factor out unreachable inst idiom creation [NFC]

In InstCombine, we use an idiom of "store i1 true, i1 undef" to indicate we've found a path which we've proven unreachable.  We can't actually insert the unreachable instruction since that would require changing the CFG.  We leave that to simplifycfg later.

This just factors out that idiom creation so we don't duplicate the same mostly undocument idiom creation in multiple places.

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

5 years ago[LVI][CVP] Constrain values in with.overflow branches
Nikita Popov [Wed, 17 Apr 2019 16:57:42 +0000 (16:57 +0000)]
[LVI][CVP] Constrain values in with.overflow branches

If a branch is conditional on extractvalue(op.with.overflow(%x, C), 1)
then we can constrain the value of %x inside the branch based on
makeGuaranteedNoWrapRegion(). We do this by extending the edge-value
handling in LVI. This allows CVP to then fold comparisons against %x,
as illustrated in the tests.

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

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

5 years ago[AMDGPU][MC] Corrected handling of "-" before expressions
Dmitry Preobrazhensky [Wed, 17 Apr 2019 16:56:34 +0000 (16:56 +0000)]
[AMDGPU][MC] Corrected handling of "-" before expressions

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

Reviewers: artem.tamazov, arsenm

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

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

5 years ago[ARM] tighten test checks; NFC
Sanjay Patel [Wed, 17 Apr 2019 16:51:09 +0000 (16:51 +0000)]
[ARM] tighten test checks; NFC

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

5 years agoAMDGPU: Force skip over SMRD, VMEM and s_waitcnt instructions
Rhys Perry [Wed, 17 Apr 2019 16:31:52 +0000 (16:31 +0000)]
AMDGPU: Force skip over SMRD, VMEM and s_waitcnt instructions

Summary: This fixes a large Dawn of War 3 performance regression with RADV from Mesa 19.0 to master which was caused by creating less code in some branches.

Reviewers: arsen, nhaehnle

Reviewed By: nhaehnle

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

Tags: #llvm

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

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

5 years ago[ARM] make test checks more thorough; NFC
Sanjay Patel [Wed, 17 Apr 2019 16:02:07 +0000 (16:02 +0000)]
[ARM] make test checks more thorough; NFC

This will change with the proposal in D60214.
Unfortunately, the triple is not supported for auto-generation
via script, and the multiple RUN lines have diffs on this test,
but I can't tell exactly what is required by this test.
PR7162 was an assert/crash, so hopefully, this is good enough.

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

5 years ago[LoopUnroll] Allow unrolling if the unrolled size does not exceed loop size.
Florian Hahn [Wed, 17 Apr 2019 15:57:43 +0000 (15:57 +0000)]
[LoopUnroll] Allow unrolling if the unrolled size does not exceed loop size.

Summary:
In the following cases, unrolling can be beneficial, even when
optimizing for code size:
 1) very low trip counts
 2) potential to constant fold most instructions after fully unrolling.

We can unroll in those cases, by setting the unrolling threshold to the
loop size. This might highlight some cost modeling issues and fixing
them will have a positive impact in general.

Reviewers: vsk, efriedma, dmgreen, paquette

Reviewed By: paquette

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

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

5 years ago[DAGCombine] Add SimplifyDemandedBits helper that handles demanded elts mask as well
Simon Pilgrim [Wed, 17 Apr 2019 15:45:44 +0000 (15:45 +0000)]
[DAGCombine] Add SimplifyDemandedBits helper that handles demanded elts mask as well

The other SimplifyDemandedBits helpers become wrappers to this new demanded elts variant.

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

5 years ago[Support] Add LEB128 support to BinaryStreamReader/Writer.
Lang Hames [Wed, 17 Apr 2019 15:38:27 +0000 (15:38 +0000)]
[Support] Add LEB128 support to BinaryStreamReader/Writer.

Summary:
This patch adds support for ULEB128 and SLEB128 encoding and decoding to
BinaryStreamWriter and BinaryStreamReader respectively.

Support for ULEB128/SLEB128 will be used for eh-frame parsing in the JITLink
library currently under development (see https://reviews.llvm.org/D58704).

Reviewers: zturner, dblaikie

Subscribers: kristina, llvm-commits

Tags: #llvm

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

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

5 years ago[ScheduleDAGRRList] Recompute topological ordering on demand.
Florian Hahn [Wed, 17 Apr 2019 15:05:29 +0000 (15:05 +0000)]
[ScheduleDAGRRList] Recompute topological ordering on demand.

Currently there is a single point in ScheduleDAGRRList, where we
actually query the topological order (besides init code). Currently we
are recomputing the order after adding a node (which does not have
predecessors) and then we add predecessors edge-by-edge.

We can avoid adding edges one-by-one after we added a new node. In that case, we can
just rebuild the order from scratch after adding the edges to the DAG
and avoid all the updates to the ordering.

Also, we can delay updating the DAG until we query the DAG, if we keep a
list of added edges. Depending on the number of updates, we can either
apply them when needed or recompute the order from scratch.

This brings down the geomean compile time for of CTMark with -O1 down 0.3% on X86,
with no regressions.

Reviewers: MatzeB, atrick, efriedma, niravd, paquette

Reviewed By: efriedma

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

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

5 years ago[AMDGPU][MC] Corrected parsing of registers
Dmitry Preobrazhensky [Wed, 17 Apr 2019 14:44:01 +0000 (14:44 +0000)]
[AMDGPU][MC] Corrected parsing of registers

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

Reviewers: artem.tamazov, arsenm

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

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

5 years ago[AMDGPU] Flag new raw/struct atomic ops as source of divergence
Tim Renouf [Wed, 17 Apr 2019 14:04:31 +0000 (14:04 +0000)]
[AMDGPU] Flag new raw/struct atomic ops as source of divergence

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

Change-Id: I821d93dec8b9cdd247b8172d92fb5e15340a9e7d

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

5 years agogn build: Merge r358554
Nico Weber [Wed, 17 Apr 2019 13:40:57 +0000 (13:40 +0000)]
gn build: Merge r358554

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

5 years ago[LLVM-C] Add DIFile Field Accesssors
Robert Widmann [Wed, 17 Apr 2019 13:29:14 +0000 (13:29 +0000)]
[LLVM-C] Add DIFile Field Accesssors

Summary:
Add accessors for the file, directory, source file name (curiously, an `Optional` value?), of a DIFile.

This is intended to replace the LLVMValueRef-based accessors used in D52239

Reviewers: whitequark, jberdine, deadalnix

Reviewed By: whitequark, jberdine

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

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

5 years ago[CostModel][X86] Add bool anyof/allof reduction costs
Simon Pilgrim [Wed, 17 Apr 2019 10:58:19 +0000 (10:58 +0000)]
[CostModel][X86] Add bool anyof/allof reduction costs

On pre-AVX512 targets we can use MOVMSK to extract reduced boolean results. This is properly optimized, annoyingly AVX512 isn't and produces code that is almost as bad as the (unchanged) costs suggest......

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

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

5 years ago[DWARF] llvm::Error -> Error. NFC
Fangrui Song [Wed, 17 Apr 2019 09:11:08 +0000 (09:11 +0000)]
[DWARF] llvm::Error -> Error. NFC

The unqualified name is more common and is used in the file as well.

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

5 years agoChange some llvm::{lower,upper}_bound to llvm::bsearch. NFC
Fangrui Song [Wed, 17 Apr 2019 07:58:05 +0000 (07:58 +0000)]
Change some llvm::{lower,upper}_bound to llvm::bsearch. NFC

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

5 years ago[llvm-objcopy] Support full list of bfd targets that lld uses.
Jordan Rupprecht [Wed, 17 Apr 2019 07:42:31 +0000 (07:42 +0000)]
[llvm-objcopy] Support full list of bfd targets that lld uses.

Summary:
This change takes the full list of bfd targets that lld supports (see `ScriptParser.cpp`), including generic handling for `*-freebsd` targets (which uses the same settings but with a FreeBSD OSABI). In particular this adds mips support for `--output-target` (but not yet via `--binary-architecture`).

lld and llvm-objcopy use their own different custom data structures, so I'd prefer to check this in as-is (add support directly in llvm-objcopy, including all the test coverage) and do a separate NFC patch(s) that consolidate the two by putting this mapping into libobject.

See [[ https://bugs.llvm.org/show_bug.cgi?id=41462 | PR41462 ]].

Reviewers: jhenderson, jakehehrlich, espindola, alexshap, arichardson

Reviewed By: arichardson

Subscribers: fedor.sergeev, emaste, sdardis, krytarowski, atanasyan, llvm-commits, MaskRay, arichardson

Tags: #llvm

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

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

5 years ago[CVP] processOverflowIntrinsic(): don't crash if constant-holding happened
Roman Lebedev [Wed, 17 Apr 2019 06:35:07 +0000 (06:35 +0000)]
[CVP] processOverflowIntrinsic(): don't crash if constant-holding happened

As reported by Mikael Holmén in post-commit review in
https://reviews.llvm.org/D60791#1469765

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

5 years ago[DWARF] Pass ReferenceToDIEOffsets elements by reference
Fangrui Song [Wed, 17 Apr 2019 06:33:52 +0000 (06:33 +0000)]
[DWARF] Pass ReferenceToDIEOffsets elements by reference

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

5 years agoFixed error message printing in write_cmake_config.py
Dmitri Gribenko [Wed, 17 Apr 2019 06:11:27 +0000 (06:11 +0000)]
Fixed error message printing in write_cmake_config.py

Summary:
Previously, write_cmake_config.py would raise an error while printing
the error, because `leftovers` in "'\n'.join(leftovers)" is a tuple.

Subscribers: mgorny, llvm-commits

Tags: #llvm

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

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

5 years ago[X86] Autogenerate complete checks. NFC
Craig Topper [Wed, 17 Apr 2019 06:09:16 +0000 (06:09 +0000)]
[X86] Autogenerate complete checks. NFC

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

5 years ago[X86] In CopyToFromAsymmetricReg, use VR128 instead of FR32 instructions for GR32...
Craig Topper [Wed, 17 Apr 2019 06:09:11 +0000 (06:09 +0000)]
[X86] In CopyToFromAsymmetricReg, use VR128 instead of FR32 instructions for GR32<->XMM register copies.

We have two versions of some instructions, VR128 versions and FR32 versions that
are marked as CodeGenOnly.

This change switches to using the VR128 versions for these copies. It's after
register allocation so the class size no longer matters. This matches how GR64
works.

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

5 years ago[MCA] Moved the bottleneck analysis to its own file. NFCI
Andrea Di Biagio [Wed, 17 Apr 2019 06:02:05 +0000 (06:02 +0000)]
[MCA] Moved the bottleneck analysis to its own file. NFCI

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

5 years agoRevert "Add basic loop fusion pass." Per request.
Eric Christopher [Wed, 17 Apr 2019 04:55:24 +0000 (04:55 +0000)]
Revert "Add basic loop fusion pass." Per request.

This reverts commit r358543/ab70da07286e618016e78247e4a24fcb84077fda.

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

5 years agoRevert "Temporarily Revert "Add basic loop fusion pass.""
Eric Christopher [Wed, 17 Apr 2019 04:52:47 +0000 (04:52 +0000)]
Revert "Temporarily Revert "Add basic loop fusion pass.""

The reversion apparently deleted the test/Transforms directory.

Will be re-reverting again.

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

5 years agoRemove the run-slp-after-loop-vectorization option.
Eric Christopher [Wed, 17 Apr 2019 02:26:27 +0000 (02:26 +0000)]
Remove the run-slp-after-loop-vectorization option.

It's been on by default for 4 years and cleans up the pass
hierarchy.

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

5 years agoTemporarily Revert "Add basic loop fusion pass."
Eric Christopher [Wed, 17 Apr 2019 02:12:23 +0000 (02:12 +0000)]
Temporarily Revert "Add basic loop fusion pass."
As it's causing some bot failures (and per request from kbarton).

This reverts commit r358543/ab70da07286e618016e78247e4a24fcb84077fda.

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

5 years agoAdd basic loop fusion pass.
Kit Barton [Wed, 17 Apr 2019 01:37:00 +0000 (01:37 +0000)]
Add basic loop fusion pass.

This patch adds a basic loop fusion pass. It will fuse loops that conform to the
following 4 conditions:
  1. Adjacent (no code between them)
  2. Control flow equivalent (if one loop executes, the other loop executes)
  3. Identical bounds (both loops iterate the same number of iterations)
  4. No negative distance dependencies between the loop bodies.

The pass does not make any changes to the IR to create opportunities for fusion.
Instead, it checks if the necessary conditions are met and if so it fuses two
loops together.

The pass has not been added to the pass pipeline yet, and thus is not enabled by
default. It can be run stand alone using the -loop-fusion option.

Phabricator: https://reviews.llvm.org/D55851

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

5 years ago[ADT] llvm::bsearch, binary search for mere mortals
Sam McCall [Tue, 16 Apr 2019 23:53:28 +0000 (23:53 +0000)]
[ADT] llvm::bsearch, binary search for mere mortals

Summary:
Add to STLExtras a binary search function with a simple mental model:
You provide a range and a predicate which is true above a certain point.
bsearch() tells you that point.
Overloads are provided for integers, iterators, and containers.

This is more suitable than std:: alternatives in many cases:
 - std::binary_search only indicates presence/absence
 - upper_bound/lower_bound give you the opportunity to pick the wrong one
 - all of the options have confusing names and definitions when your predicate
   doesn't have simple "less than" semantics
 - all of the options require iterators
 - we plumb around a useless `value` parameter that should be a lambda capture

The API is inspired by Go's standard library, but we add an extra parameter as
well as some overloads and templates to show how clever C++ is.

Reviewers: ilya-biryukov, gribozavr

Subscribers: dexonsmith, kristina, llvm-commits

Tags: #llvm

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

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

5 years ago[x86] adjust LEA tests for better coverage; NFC
Sanjay Patel [Tue, 16 Apr 2019 23:10:41 +0000 (23:10 +0000)]
[x86] adjust LEA tests for better coverage; NFC

The scale can 1, 2, or 3.

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

5 years ago[LLVM-C] Add Accessors For Global Variable Metadata Properties
Robert Widmann [Tue, 16 Apr 2019 21:39:48 +0000 (21:39 +0000)]
[LLVM-C] Add Accessors For Global Variable Metadata Properties

Summary: Metadata for a global variable is really a  (GlobalVariable, Expression) tuple.  Allow access to these, then allow retrieving the file, scope, and line for a DIVariable, whether global or local.  This should be the last of the accessors required for uniform access to location and file information metadata.

Reviewers: jberdine, whitequark, deadalnix

Reviewed By: jberdine, whitequark

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

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

5 years agoFix a typo in comments. [NFC]
Ali Tamur [Tue, 16 Apr 2019 21:37:43 +0000 (21:37 +0000)]
Fix a typo in comments. [NFC]

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

5 years ago[NVPTXAsmPrinter] clean up dead code. NFC
Nick Desaulniers [Tue, 16 Apr 2019 21:04:34 +0000 (21:04 +0000)]
[NVPTXAsmPrinter] clean up dead code. NFC

Summary:
The printOperand function takes a default parameter, for which there are
zero call sites that explicitly pass such a parameter.  As such, there
is no case to support. This means that the method
printVecModifiedImmediate is purly dead code, and can be removed.

The eventual goal for some of these AsmPrinter refactoring is to have
printOperand be a virtual method; making it easier to print operands
from the base class for more generic Asm printing. It will help if all
printOperand methods have the same function signature (ie. no Modifier
argument when not needed).

Reviewers: echristo, tra

Reviewed By: echristo

Subscribers: jholewinski, hiraditya, llvm-commits, craig.topper, srhines

Tags: #llvm

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

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

5 years ago[TargetLowering] Rename preferShiftsToClearExtremeBits and shouldFoldShiftPairToMask...
Simon Pilgrim [Tue, 16 Apr 2019 20:57:28 +0000 (20:57 +0000)]
[TargetLowering] Rename preferShiftsToClearExtremeBits and shouldFoldShiftPairToMask (PR41359)

As discussed on PR41359, this patch renames the pair of shift-mask target feature functions to make their purposes more obvious.

shouldFoldShiftPairToMask -> shouldFoldConstantShiftPairToMask

preferShiftsToClearExtremeBits -> shouldFoldMaskToVariableShiftPair

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

5 years ago[EarlyCSE] detect equivalence of selects with inverse conditions and commuted operand...
Sanjay Patel [Tue, 16 Apr 2019 20:41:20 +0000 (20:41 +0000)]
[EarlyCSE] detect equivalence of selects with inverse conditions and commuted operands (PR41101)

This is 1 of the problems discussed in the post-commit thread for:
rL355741 / http://lists.llvm.org/pipermail/llvm-commits/Week-of-Mon-20190311/635516.html
and filed as:
https://bugs.llvm.org/show_bug.cgi?id=41101

Instcombine tries to canonicalize some of these cases (and there's room for improvement
there independently of this patch), but it can't always do that because of extra uses.
So we need to recognize these commuted operand patterns here in EarlyCSE. This is similar
to how we detect commuted compares and commuted min/max/abs.

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

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

5 years agoTime profiler: optimize json output time
Anton Afanasyev [Tue, 16 Apr 2019 20:36:56 +0000 (20:36 +0000)]
Time profiler: optimize json output time

Summary:
Use llvm::json::Array.reserve() to optimize json output time. Here is motivation:
https://reviews.llvm.org/D60609#1468941. In short: for the json array
with ~32K entries, pushing back each entry takes ~4% of whole time compared
to the method of preliminary memory reservation: (3995-3845)/3995 = 3.75%.

Reviewers: lebedev.ri

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

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

5 years ago[CVP] Simplify umulo and smulo that cannot overflow
Nikita Popov [Tue, 16 Apr 2019 20:31:41 +0000 (20:31 +0000)]
[CVP] Simplify umulo and smulo that cannot overflow

If a umul.with.overflow or smul.with.overflow operation cannot
overflow, simplify it to a simple mul nuw / mul nsw. After the
refactoring in D60668 this is just a matter of removing an
explicit check against multiplications.

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

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

5 years ago[Support][JSON] Add reserve() to json Array
Anton Afanasyev [Tue, 16 Apr 2019 19:43:18 +0000 (19:43 +0000)]
[Support][JSON] Add reserve() to json Array

Summary:
Space reservation increases json lib performance for the arrays with large number of entries.
Here is the example and discussion: https://reviews.llvm.org/D60609#1468941

Reviewers: lebedev.ri, sammccall

Subscribers: llvm-commits

Tags: #llvm

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

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

5 years ago[SLP] Refactoring of the operand reordering code.
Simon Pilgrim [Tue, 16 Apr 2019 19:27:00 +0000 (19:27 +0000)]
[SLP] Refactoring of the operand reordering code.

This is a refactoring patch which should have all the functionality of the current code. Its goal is twofold:
i. Cleanup and simplify the reordering code, and
ii. Generalize reordering so that it will work for an arbitrary number of operands, not just 2.

This is the second patch in a series of patches that will enable operand reordering across chains of operations. An example of this was presented in EuroLLVM'18 https://www.youtube.com/watch?v=gIEn34LvyNo .

Committed on behalf of @vporpo (Vasileios Porpodas)

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

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

5 years ago[CVP] Add tests for non-overflowing mulo; NFC
Nikita Popov [Tue, 16 Apr 2019 19:25:35 +0000 (19:25 +0000)]
[CVP] Add tests for non-overflowing mulo; NFC

Should be simplified to simple mul.

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

5 years ago[X86][AVX] X86ISD::PERMV/PERMV3 node types can never fold index ops
Simon Pilgrim [Tue, 16 Apr 2019 19:18:53 +0000 (19:18 +0000)]
[X86][AVX] X86ISD::PERMV/PERMV3 node types can never fold index ops

Improves codegen demonstrated by D60512 - instructions represented by X86ISD::PERMV/PERMV3 can never memory fold the operand used for their index register.

This patch updates the 'isUseOfShuffle' helper into the more capable 'isFoldableUseOfShuffle' that recognises that the op is used for a X86ISD::PERMV/PERMV3 index mask and can't be folded - allowing us to use broadcast/subvector-broadcast ops to reduce the size of the mask constant pool data.

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

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

5 years ago[InstCombine] Prune fshl/fshr with masked operands
Nikita Popov [Tue, 16 Apr 2019 19:05:49 +0000 (19:05 +0000)]
[InstCombine] Prune fshl/fshr with masked operands

If a constant shift amount is used, then only some of the LHS/RHS
operand bits are demanded and we may be able to simplify based on
that. InstCombineSimplifyDemanded already had the necessary support
for that, we just weren't calling it with fshl/fshr as root.

In particular, this allows us to relax some masked funnel shifts
into simple shifts, as shown in the tests.

Patch by Shawn Landden.

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

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

5 years ago[InstCombine] Add tests for fshl/fshr with masked operands; NFC
Nikita Popov [Tue, 16 Apr 2019 19:05:40 +0000 (19:05 +0000)]
[InstCombine] Add tests for fshl/fshr with masked operands; NFC

Baseline tests for D60660.

Patch by Shawn Landden.

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

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

5 years ago[x86] add more tests for LEA formation; NFC
Sanjay Patel [Tue, 16 Apr 2019 18:58:03 +0000 (18:58 +0000)]
[x86] add more tests for LEA formation; NFC

Promoting the shift to the wider type should allow LEA.

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

5 years ago[IR] Add WithOverflowInst class
Nikita Popov [Tue, 16 Apr 2019 18:55:16 +0000 (18:55 +0000)]
[IR] Add WithOverflowInst class

This adds a WithOverflowInst class with a few helper methods to get
the underlying binop, signedness and nowrap type and makes use of it
where sensible. There will be two more uses in D60650/D60656.

The refactorings are all NFC, though I left some TODOs where things
could be improved. In particular we have two places where add/sub are
handled but mul isn't.

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

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

5 years ago[Tests] Add branch_weights to latches so that test is not effected by future profitab...
Philip Reames [Tue, 16 Apr 2019 16:32:59 +0000 (16:32 +0000)]
[Tests] Add branch_weights to latches so that test is not effected by future profitability patch to LoopPredication

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

5 years ago[Hexagon] Remove indeterministic traversal order
Krzysztof Parzyszek [Tue, 16 Apr 2019 16:05:07 +0000 (16:05 +0000)]
[Hexagon] Remove indeterministic traversal order

Patch by Sergei Larin.

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

5 years ago[llvm-objdump] Test tabs in disassemble-align.s with a more visible character
Fangrui Song [Tue, 16 Apr 2019 15:58:42 +0000 (15:58 +0000)]
[llvm-objdump] Test tabs in disassemble-align.s with a more visible character

Summary: Apply rupprecht's suggestion in D60376

Reviewers: rupprecht

Reviewed By: rupprecht

Subscribers: llvm-commits

Tags: #llvm

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

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

5 years ago[DAGCombiner] Add missing flag to addressing mode check
Luis Marques [Tue, 16 Apr 2019 15:09:18 +0000 (15:09 +0000)]
[DAGCombiner] Add missing flag to addressing mode check

The checks in `canFoldInAddressingMode` tested for addressing modes that have a
base register but didn't set the `HasBaseReg` flag to true (it's false by
default). This patch fixes that. Although the omission of the flag was
technically incorrect it had no known observable impact, so no tests were
changed by this patch.

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

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

5 years ago[OCaml] Update api to account for FNeg and CallBr instructions
whitequark [Tue, 16 Apr 2019 15:00:19 +0000 (15:00 +0000)]
[OCaml] Update api to account for FNeg and CallBr instructions

Summary:
This diff adds minimal support for the recent FNeg and CallBr
instructions to the OCaml bindings.

Reviewers: whitequark

Reviewed By: whitequark

Subscribers: llvm-commits

Tags: #llvm

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

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

5 years ago[RISCV] Custom lower SHL_PARTS, SRA_PARTS, SRL_PARTS
Luis Marques [Tue, 16 Apr 2019 14:38:32 +0000 (14:38 +0000)]
[RISCV] Custom lower SHL_PARTS, SRA_PARTS, SRL_PARTS

When not optimizing for minimum size (-Oz) we custom lower wide shifts
(SHL_PARTS, SRA_PARTS, SRL_PARTS) instead of expanding to a libcall.

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

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

5 years ago[SystemZ] Add missing intrinsics to intrinsics-immarg.ll
Ulrich Weigand [Tue, 16 Apr 2019 14:35:18 +0000 (14:35 +0000)]
[SystemZ] Add missing intrinsics to intrinsics-immarg.ll

As of r356091, support for the ImmArg intrinsics was added,
including a SystemZ test case.  However, that test case doesn't
actually verify all SystemZ intrinsics with immediate arguments,
only a subset.  The rest of them actually works correctly, there's
just no test for them.  This patch add all missing intrinsics.

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

5 years ago[llvm][Support] Provide interface to set thread priorities
Kadir Cetinkaya [Tue, 16 Apr 2019 14:32:43 +0000 (14:32 +0000)]
[llvm][Support] Provide interface to set thread priorities

Summary:
We have a multi-platform thread priority setting function(last piece
landed with D58683), I wanted to make this available to all llvm community,
there seem to be other users of such functionality with portability fixmes:
lib/Support/CrashRecoveryContext.cpp
tools/clang/tools/libclang/CIndex.cpp

Reviewers: gribozavr, ioeric

Subscribers: krytarowski, jfb, kristina, llvm-commits

Tags: #llvm

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

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

5 years agollvm-undname: Consistently use "return nullptr" in functions returning pointers
Nico Weber [Tue, 16 Apr 2019 14:24:42 +0000 (14:24 +0000)]
llvm-undname: Consistently use "return nullptr" in functions returning pointers

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

5 years agollvm-undname: Fix nullptr deref on invalid structor names in template args
Nico Weber [Tue, 16 Apr 2019 14:10:34 +0000 (14:10 +0000)]
llvm-undname: Fix nullptr deref on invalid structor names in template args

Similar to r358421: A StructorIndentifierNode has a Class field which
is read when printing it, but if the StructorIndentifierNode appears in
a template argument then demangleFullyQualifiedSymbolName() which sets
Class isn't called. Since StructorIndentifierNodes are always leaf
names, we can just reject them as well.

Found by oss-fuzz.

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

5 years agollvm-undname: Tweak arena allocator
Nico Weber [Tue, 16 Apr 2019 13:52:30 +0000 (13:52 +0000)]
llvm-undname: Tweak arena allocator

- Make `allocUnalignedBuffer` look more like `allocArray` and `alloc`.
  No behavior change.
- Change `Head->Used < Head->Capacity` to `Head->Used <= Head->Capacity`
  in `allocArray` and `alloc`. No intended behavior change, might be a
  minuscule memory usage improvement. Noticed this since it was the logic
  used in `allocUnalignedBuffer`.
- Don't let `allocArray` alloc too small buffers for names that have
  more than 512 levels of nesting (in 64-bit builds). Fixes a heap
  buffer overflow found by oss-fuzz.

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

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

5 years agollvm-undname: add a missing CHECK: to a passing test
Nico Weber [Tue, 16 Apr 2019 13:30:50 +0000 (13:30 +0000)]
llvm-undname: add a missing CHECK: to a passing test

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

5 years agoFix llvm-undname tests after r358485
Nico Weber [Tue, 16 Apr 2019 13:18:51 +0000 (13:18 +0000)]
Fix llvm-undname tests after r358485

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

5 years agogn build: Merge r358422
Nico Weber [Tue, 16 Apr 2019 12:54:43 +0000 (12:54 +0000)]
gn build: Merge r358422

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

5 years agollvm-undname: Add a -raw-file flag to pass a raw buffer to microsoftDemangle
Nico Weber [Tue, 16 Apr 2019 12:51:40 +0000 (12:51 +0000)]
llvm-undname: Add a -raw-file flag to pass a raw buffer to microsoftDemangle

The default handling splits input into lines. Since
llvm-microsoft-demangle-fuzzer doesn't do this, oss-fuzz produces inputs
that only trigger crashes if the input isn't split into lines. This adds
a hidden flag -raw-file which passes file contents to microsoftDemangle() in
the same way the fuzzer does, for reproducing oss-fuzz reports.

Also change llvm-undname to have a non-0 exit code for invalid symbols.

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

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

5 years agoRe-commit r357452: SimplifyCFG SinkCommonCodeFromPredecessors: Also sink function...
Hans Wennborg [Tue, 16 Apr 2019 12:13:25 +0000 (12:13 +0000)]
Re-commit r357452: SimplifyCFG SinkCommonCodeFromPredecessors: Also sink function calls without used results (PR41259)

The original commit caused false positives from AddressSanitizer's
use-after-scope checks, which have now been fixed in r358478.

> The code was previously checking that candidates for sinking had exactly
> one use or were a store instruction (which can't have uses). This meant
> we could sink call instructions only if they had a use.
>
> That limitation seemed a bit arbitrary, so this patch changes it to
> "instruction has zero or one use" which seems more natural and removes
> the need to special-case stores.
>
> Differential revision: https://reviews.llvm.org/D59936

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

5 years agoRemoved CMake cache upgrade code from 2011
Dmitri Gribenko [Tue, 16 Apr 2019 09:46:02 +0000 (09:46 +0000)]
Removed CMake cache upgrade code from 2011

Summary:
This code was added in r141266 to make a breaking change to CMake, but
still be compatible with existing cache files.  The cache files from
2011 are irrelevant today in 2019.

Subscribers: mgorny, llvm-commits

Tags: #llvm

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

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

5 years agoAsan use-after-scope: don't poison allocas if there were untraced lifetime intrinsics...
Hans Wennborg [Tue, 16 Apr 2019 07:54:20 +0000 (07:54 +0000)]
Asan use-after-scope: don't poison allocas if there were untraced lifetime intrinsics in the function (PR41481)

If there are any intrinsics that cannot be traced back to an alloca, we
might have missed the start of a variable's scope, leading to false
error reports if the variable is poisoned at function entry. Instead, if
there are some intrinsics that can't be traced, fail safe and don't
poison the variables in that function.

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

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

5 years agoUse native llvm JSON library for time profiler output
Anton Afanasyev [Tue, 16 Apr 2019 06:35:07 +0000 (06:35 +0000)]
Use native llvm JSON library for time profiler output

Summary: Replace plain json text output with llvm JSON library wrapper using.

Reviewers: takuto.ikuta, lebedev.ri

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

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

5 years ago[llvm-objdump] Align instructions to a tab stop in disassembly output
Fangrui Song [Tue, 16 Apr 2019 03:56:55 +0000 (03:56 +0000)]
[llvm-objdump] Align instructions to a tab stop in disassembly output

This relands D60376/rL358405, with the difference: sed 'y/\t/ /' -> tr '\t' ' '
BSD sed doesn't support escape characters for the 'y' command.
I didn't use it in rL358405 because it was not listed at
https://llvm.org/docs/GettingStarted.html#software but it
should be available.

Original description:

In GNU objdump, -w/--wide aligns instructions in the disassembly output.
This patch does the same to llvm-objdump. However, we always use the
wide format (-w/--wide is ignored), because the narrow format
(instructions are misaligned) is probably not very useful.

In llvm-readobj, we made a similar decision: always use the wide format,
accept but ignore -W/--wide.

To save some columns, we change the tab before hex bytes (controlled by
--[no-]show-raw-insn) to a space.

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

5 years ago[llvm-objdump] Simplify PrintHelpMessage() logic
Fangrui Song [Tue, 16 Apr 2019 02:37:29 +0000 (02:37 +0000)]
[llvm-objdump] Simplify PrintHelpMessage() logic

This relands rL358418. It missed one test that should also use -macho
Note, all the other -private-header -exports-trie tests are used
together with -macho.

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

5 years ago[CodeExtractor] Add a few debug lines to understand why a region is not extracted
Quentin Colombet [Tue, 16 Apr 2019 02:12:05 +0000 (02:12 +0000)]
[CodeExtractor] Add a few debug lines to understand why a region is not extracted

The CodeExtractor is not smart enough to compute which basic block is
the entry of a region. Instead it relies on the order of the list
of basic blocks that is handed to it and assumes that the entry
is the first block in the list.

Without the additional debug information, it is hard to understand
why a valid region does not get extracted, because we would miss
that the order of in the list just doesn't match what the CodeExtractor
wants.

NFC

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

5 years agoRemove some more unused headers from MachineFunction.h and friends.
Eric Christopher [Tue, 16 Apr 2019 01:06:03 +0000 (01:06 +0000)]
Remove some more unused headers from MachineFunction.h and friends.

Most of these headers are still included via transitive includes and
so won't likely show any problems or improvements in incremental
rebuild time.

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

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

5 years agoReapply [Support] Fix recursive response file expansion guard
Shoaib Meenai [Tue, 16 Apr 2019 00:18:50 +0000 (00:18 +0000)]
Reapply [Support] Fix recursive response file expansion guard

The test in the dependent revision has been fixed for Windows.

Original commit message:

Response file expansion limits the amount of expansion to prevent
potential infinite recursion. However, the current logic assumes that
any argument beginning with @ is a response file, which is not true for
e.g. `-Xlinker -rpath -Xlinker @executable_path/../lib` on Darwin.
Having too many of these non-response file arguments beginning with @
prevents actual response files from being expanded. Instead, limit based
on the number of successful response file expansions, which should still
prevent infinite recursion but also avoid false positives.

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

llvm-svn: 358452

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

5 years agoReapply [Support] Add a test for recursive response file expansion
Shoaib Meenai [Tue, 16 Apr 2019 00:18:47 +0000 (00:18 +0000)]
Reapply [Support] Add a test for recursive response file expansion

Use the appropriate tokenizer to fix the test on Windows.

Original commit message:

I'm going to be modifying the logic to avoid infinitely recursing on
self-referential response files, so add a unit test to verify the
expected behavior.

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

llvm-svn: 358451

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

5 years agoRevert [Support] Add a test for recursive response file expansion
Shoaib Meenai [Mon, 15 Apr 2019 22:51:54 +0000 (22:51 +0000)]
Revert [Support] Add a test for recursive response file expansion

This reverts r358451 (git commit c8497467edc5766ae81ffbde58159f8c6af50803)

The test breaks a Windows buildbot:
http://lab.llvm.org:8011/builders/llvm-clang-x86_64-expensive-checks-win/builds/17016/steps/test-check-all/logs/stdio

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

5 years agoRevert [Support] Fix recursive response file expansion guard
Shoaib Meenai [Mon, 15 Apr 2019 22:51:53 +0000 (22:51 +0000)]
Revert [Support] Fix recursive response file expansion guard

This reverts r358452 (git commit c8df4fb9c3865eac52a99602c26bbc070098c3d4)

A dependent commit breaks the Windows buildbots.

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

5 years agoRevert r358405: "[llvm-objdump] Align instructions to a tab stop in disassembly output"
Alex Lorenz [Mon, 15 Apr 2019 22:36:12 +0000 (22:36 +0000)]
Revert r358405: "[llvm-objdump] Align instructions to a tab stop in disassembly output"

The test fails on darwin due to a sed error:

sed: 1: "y/\t/ /": transform strings are not the same length

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

5 years ago[AArch64][GlobalISel] Don't do extending loads combine for non-pow-2 types.
Amara Emerson [Mon, 15 Apr 2019 22:34:08 +0000 (22:34 +0000)]
[AArch64][GlobalISel] Don't do extending loads combine for non-pow-2 types.

Since non-pow-2 types are going to get split up into multiple loads anyway,
don't do the [SZ]EXTLOAD combine for those and save us trouble later in
legalization.

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

5 years ago[LSR] Rewrite misses some fixup locations if it splits critical edge
Quentin Colombet [Mon, 15 Apr 2019 22:23:46 +0000 (22:23 +0000)]
[LSR] Rewrite misses some fixup locations if it splits critical edge

If LSR split critical edge during rewriting phi operands and
phi node has other pending fixup operands, we need to
update those pending fixups. Otherwise formulae will not be
implemented completely and some instructions will not be eliminated.

llvm.org/PR41445

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

Patch by: Denis Bakhvalov <denis.bakhvalov@intel.com>

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

5 years agoOnly use argv[0] as the main executable name if it exists.
Sean Silva [Mon, 15 Apr 2019 22:07:56 +0000 (22:07 +0000)]
Only use argv[0] as the main executable name if it exists.

Under some environments, argv[0] doesn't hold a valid file name, but
sys::fs::getMainExecutable will find the main executable properly.

This patch tweaks the logic to fall back to sys::fs::getMainExecutable
in more situations.

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

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

5 years ago[EarlyCSE] add more tests for double-negated select condition; NFC
Sanjay Patel [Mon, 15 Apr 2019 21:51:51 +0000 (21:51 +0000)]
[EarlyCSE] add more tests for double-negated select condition; NFC

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

5 years ago[Support] Fix recursive response file expansion guard
Shoaib Meenai [Mon, 15 Apr 2019 21:31:28 +0000 (21:31 +0000)]
[Support] Fix recursive response file expansion guard

Response file expansion limits the amount of expansion to prevent
potential infinite recursion. However, the current logic assumes that
any argument beginning with @ is a response file, which is not true for
e.g. `-Xlinker -rpath -Xlinker @executable_path/../lib` on Darwin.
Having too many of these non-response file arguments beginning with @
prevents actual response files from being expanded. Instead, limit based
on the number of successful response file expansions, which should still
prevent infinite recursion but also avoid false positives.

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

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

5 years ago[Support] Add a test for recursive response file expansion
Shoaib Meenai [Mon, 15 Apr 2019 21:31:25 +0000 (21:31 +0000)]
[Support] Add a test for recursive response file expansion

I'm going to be modifying the logic to avoid infinitely recursing on
self-referential response files, so add a unit test to verify the
expected behavior.

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

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

5 years ago[X86] Limit the 'x' inline assembly constraint to zmm0-15 when used for a 512 type.
Craig Topper [Mon, 15 Apr 2019 21:06:32 +0000 (21:06 +0000)]
[X86] Limit the 'x' inline assembly constraint to zmm0-15 when used for a 512 type.

The 'v' constraint is used to select zmm0-31. This makes 512 bit consistent with 128/256-bit.a

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

5 years ago[X86] Fix a stack folding test to have a full xmm2-31 clobber list instead of stoppin...
Craig Topper [Mon, 15 Apr 2019 21:06:23 +0000 (21:06 +0000)]
[X86] Fix a stack folding test to have a full xmm2-31 clobber list instead of stopping at xmm15. Add an additional dependency to keep instruction below inline asm block.

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

5 years agoTime profiler: small fixes and optimizations
Anton Afanasyev [Mon, 15 Apr 2019 21:02:47 +0000 (21:02 +0000)]
Time profiler: small fixes and optimizations

Summary: Fixes from Roman's review here: https://reviews.llvm.org/D58675#1465336

Reviewers: lebedev.ri

Subscribers: hiraditya, mgrang, cfe-commits, llvm-commits

Tags: #clang, #llvm

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

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

5 years agoAMDGPU: Fix unreachable when counting register usage of SGPR96
Matt Arsenault [Mon, 15 Apr 2019 20:51:12 +0000 (20:51 +0000)]
AMDGPU: Fix unreachable when counting register usage of SGPR96

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

5 years agoAMDGPU: Fix printed format of SReg_96
Matt Arsenault [Mon, 15 Apr 2019 20:42:18 +0000 (20:42 +0000)]
AMDGPU: Fix printed format of SReg_96

These are artificial, so I think this should only come up with inline
asm comments.

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