OSDN Git Service

android-x86/external-llvm.git
5 years ago[llvm-objdump] Delete unused forward declarations
Fangrui Song [Mon, 15 Apr 2019 15:08:01 +0000 (15:08 +0000)]
[llvm-objdump] Delete unused forward declarations

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

5 years ago[llvm-objdump] Reorganize cl::opt variables and move Mach-O specifics to MachODump.cpp
Fangrui Song [Mon, 15 Apr 2019 15:00:10 +0000 (15:00 +0000)]
[llvm-objdump] Reorganize cl::opt variables and move Mach-O specifics to MachODump.cpp

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

5 years agoRevert r358337: "[CommandLineParser] Add DefaultOption flag"
Ilya Biryukov [Mon, 15 Apr 2019 14:43:50 +0000 (14:43 +0000)]
Revert r358337: "[CommandLineParser] Add DefaultOption flag"

The change causes test failures under asan. Reverting to unbreak our
integrate.

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

5 years ago[EarlyCSE] regenerate test checks; NFC
Sanjay Patel [Mon, 15 Apr 2019 14:02:37 +0000 (14:02 +0000)]
[EarlyCSE] regenerate test checks; NFC

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

5 years ago[llvm-objdump] Align instructions to a tab stop in disassembly output
Fangrui Song [Mon, 15 Apr 2019 13:32:41 +0000 (13:32 +0000)]
[llvm-objdump] Align instructions to a tab stop in disassembly output

Summary:
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.

Reviewers: rupprecht, jhenderson, grimar

Reviewed By: jhenderson

Subscribers: llvm-commits

Tags: #llvm

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

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

5 years ago[InstCombine] canonicalize fdiv after fmul if reassociation is allowed
Sanjay Patel [Mon, 15 Apr 2019 13:23:38 +0000 (13:23 +0000)]
[InstCombine] canonicalize fdiv after fmul if reassociation is allowed

  (X / Y) * Z --> (X * Z) / Y

This can allow other optimizations/reassociations as shown in the test diffs.

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

5 years agoDAG: propagate ConsecutiveRegs flags to returns too.
Tim Northover [Mon, 15 Apr 2019 12:04:10 +0000 (12:04 +0000)]
DAG: propagate ConsecutiveRegs flags to returns too.

Arguments already have a flag to inform backends when they have been split up.
The AArch64 arm64_32 ABI makes use of these on return types too, so that code
emitted for armv7k can be ABI-compliant.

There should be no CodeGen changes yet, just making more information available.

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

5 years agoDAG: propagate whether an arg is a pointer for CallingConv decisions.
Tim Northover [Mon, 15 Apr 2019 12:03:54 +0000 (12:03 +0000)]
DAG: propagate whether an arg is a pointer for CallingConv decisions.

The arm64_32 ABI specifies that pointers (despite being 32-bits) should be
zero-extended to 64-bits when passed in registers for efficiency reasons. This
means that the SelectionDAG needs to be able to tell the backend that an
argument was originally a pointer, which is implmented here.

Additionally, some memory intrinsics need to be declared as taking an i8*
instead of an iPTR.

There should be no CodeGen change yet, but it will be triggered when AArch64
backend support for ILP32 is added.

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

5 years agogn build: Merge r358390
Nico Weber [Mon, 15 Apr 2019 11:25:23 +0000 (11:25 +0000)]
gn build: Merge r358390

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

5 years ago[llvm-readelf] Correctly dump symbols whose section id is SHN_XINDEX
Eugene Leviant [Mon, 15 Apr 2019 11:21:47 +0000 (11:21 +0000)]
[llvm-readelf] Correctly dump symbols whose section id is SHN_XINDEX

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

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

5 years ago[llvm-readobj] Reapply: Improve error message for --string-dump
Stephen Tozer [Mon, 15 Apr 2019 11:17:48 +0000 (11:17 +0000)]
[llvm-readobj] Reapply: Improve error message for --string-dump

This is a resubmission of a previous patch that caused test failures,
with the fixes for the relevant tests included.

Fixes bug 40630: https://bugs.llvm.org/show_bug.cgi?id=40630

This patch changes the error message when the section specified by
--string-dump cannot be found by including the name of the section in
the error message and changing the prefix text to not imply that the
file itself was invalid. As part of this change some uses of
std::error_code have been replaced with the llvm Error class to better
encapsulate the error info (rather than passing File strings around),
and the WithColor class replaces string literal error prefixes.

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

5 years ago[AMDGPU] Fixed incorrect test in vcnd/vcmp optimization
Tim Renouf [Mon, 15 Apr 2019 10:36:24 +0000 (10:36 +0000)]
[AMDGPU] Fixed incorrect test in vcnd/vcmp optimization

This fixes a test I introduced in change D59191 (that added src0 and
src1 modifiers to the v_cndmask instruction for disassembly purposes).

Spotted by David Binderman in bug 41488.

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

Change-Id: I6ac95e66cd84e812ed3359ad57bcd0e13198ba0c

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

5 years ago[Docs] Switch a code block from LLVM to text
Jeremy Morse [Mon, 15 Apr 2019 10:23:22 +0000 (10:23 +0000)]
[Docs] Switch a code block from LLVM to text

While I can't replicate this locally, it looks like the buildbots don't
recognize the IR block in r358385 l764 as IR. Downgrade it to being just
text while I look into it.

http://lab.llvm.org:8011/builders/llvm-sphinx-docs/builds/30132

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

5 years agoFileCheck [1/12]: Move variable table in new object
Thomas Preud'homme [Mon, 15 Apr 2019 10:10:11 +0000 (10:10 +0000)]
FileCheck [1/12]: Move variable table in new object

Summary:
This patch is part of a patch series to add support for FileCheck
numeric expressions. This specific patch adds a new class to hold
pattern matching global state.

The table holding the values of FileCheck variable constitutes some sort
of global state for the matching phase, yet is passed as parameters of
all functions using it. This commit create a new FileCheckPatternContext
class pointed at from FileCheckPattern. While it increases the line
count, it separates local data from global state. Later commits build
on that to add numeric expression global state to that class.

Copyright:
    - Linaro (changes up to diff 183612 of revision D55940)
    - GraphCore (changes in later versions of revision D55940 and
                 in new revision created off D55940)

Reviewers: jhenderson, chandlerc, jdenny, probinson, grimar, arichardson, rnk

Subscribers: hiraditya, llvm-commits, probinson, dblaikie, grimar, arichardson, tra, rnk, kristina, hfinkel, rogfer01, JonChesterfield

Tags: #llvm

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

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

5 years ago[TableGen] Include schedule model name in diagnostic.
Simon Tatham [Mon, 15 Apr 2019 10:06:26 +0000 (10:06 +0000)]
[TableGen] Include schedule model name in diagnostic.

If you have more than one schedule model in your TableGen target
definitions, then the diagnostic "No schedule information for
instruction 'foo'" is rather unhelpful, because it doesn't tell you
_which_ schedule model is missing the necessary information (or, as it
might be, missing the UnsupportedFeatures definition that would stop
it thinking it needed it).

Extended the message to include the name of the schedule model that
it's complaining about.

Reviewers: nhaehnle, hfinkel, javedabsar, efriedma, javed.absar

Reviewed By: javed.absar

Subscribers: javed.absar, llvm-commits

Tags: #llvm

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

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

5 years ago[Docs] Correct some indentation muppetry that trips buildbots
Jeremy Morse [Mon, 15 Apr 2019 10:04:52 +0000 (10:04 +0000)]
[Docs] Correct some indentation muppetry that trips buildbots

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

5 years ago[DWARF] Fix DWARFVerifier::DieRangeInfo::contains
Fangrui Song [Mon, 15 Apr 2019 10:02:36 +0000 (10:02 +0000)]
[DWARF] Fix DWARFVerifier::DieRangeInfo::contains

It didn't handle empty LHS correctly. If two ranges of LHS were
contiguous and jointly contained one range of RHS, it could also be incorrect.

DWARFAddressRange::contains can be removed and its tests can be merged into DWARFVerifier::DieRangeInfo::contains

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

5 years ago[DebugInfo][Docs] Document variable location metadata transformations
Jeremy Morse [Mon, 15 Apr 2019 09:42:38 +0000 (09:42 +0000)]
[DebugInfo][Docs] Document variable location metadata transformations

This patch adds documentation explaining how variable location information is
compiled from the IR representation down to the end of the codegen pipeline,
but avoiding discussion of file formats and encoding.

This should make it clearer how the dbg.value / dbg.declare etc intrinsics
are transformed and arranged into DBG_VALUE instructions, and their meaning.

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

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

5 years agoCodegen: Fixed perf branch_weights in couple of tests. NFC.
Yevgeny Rouban [Mon, 15 Apr 2019 09:30:31 +0000 (09:30 +0000)]
Codegen: Fixed perf branch_weights in couple of tests. NFC.

This is need to pass future checks of perf branch_weights metadata.

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

5 years agoRevert "[DWARF] Delete redundant check in DWARFAddressRange::intersects"
Fangrui Song [Mon, 15 Apr 2019 09:01:10 +0000 (09:01 +0000)]
Revert "[DWARF] Delete redundant check in DWARFAddressRange::intersects"

This reverts rL358377. It isn't redundant, though the semantic seems weird.

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

5 years ago[Transforms][ASan] Move findAllocaForValue() to Utils/Local.cpp. NFC
Alexander Potapenko [Mon, 15 Apr 2019 08:59:56 +0000 (08:59 +0000)]
[Transforms][ASan] Move findAllocaForValue() to Utils/Local.cpp. NFC

Summary:
Factor out findAllocaForValue() from ASan so that we can use it in
MSan to handle lifetime intrinsics.

Reviewers: eugenis, pcc

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

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

5 years ago[NewPM] Add Option handling for SimplifyCFG
Serguei Katkov [Mon, 15 Apr 2019 08:57:53 +0000 (08:57 +0000)]
[NewPM] Add Option handling for SimplifyCFG

This patch enables passing options to SimplifyCFGPass via the passes pipeline.

Reviewers: chandlerc, fedor.sergeev, leonardchan, philip.pfaffe
Reviewed By: fedor.sergeev
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D60675

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

5 years ago[DWARF] Delete redundant check in DWARFAddressRange::intersects
Fangrui Song [Mon, 15 Apr 2019 08:36:21 +0000 (08:36 +0000)]
[DWARF] Delete redundant check in DWARFAddressRange::intersects

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

5 years ago[DWARF] Fix DWARFVerifier::DieRangeInfo::intersects
Fangrui Song [Mon, 15 Apr 2019 08:30:10 +0000 (08:30 +0000)]
[DWARF] Fix DWARFVerifier::DieRangeInfo::intersects

It was incorrect if RHS had more than 1 ranges and one of the ranges interacted with *this

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

5 years ago[DWARF] Make DWARFDebugLine::ParsingState::RowNumber a local variable
Fangrui Song [Mon, 15 Apr 2019 07:40:30 +0000 (07:40 +0000)]
[DWARF] Make DWARFDebugLine::ParsingState::RowNumber a local variable

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

5 years ago[SelectionDAG] Use KnownBits::computeForAddSub/computeForAddCarry
Bjorn Pettersson [Mon, 15 Apr 2019 07:19:11 +0000 (07:19 +0000)]
[SelectionDAG] Use KnownBits::computeForAddSub/computeForAddCarry

Summary:
Use KnownBits::computeForAddSub/computeForAddCarry
in SelectionDAG::computeKnownBits when doing value
tracking for addition/subtraction.

This should improve the precision of the known bits,
as we only used to make a simple estimate of known
zeroes. The KnownBits support functions are also
able to deduce bits that are known to be one in the
result.

Reviewers: spatel, RKSimon, nikic, lebedev.ri

Reviewed By: nikic

Subscribers: nikic, javed.absar, lebedev.ri, hiraditya, llvm-commits

Tags: #llvm

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

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

5 years ago[X86] Regenerate checks for domain-reassignment.mir
Craig Topper [Mon, 15 Apr 2019 05:22:47 +0000 (05:22 +0000)]
[X86] Regenerate checks for domain-reassignment.mir

Apparently there are some stray IMPLICIT_DEF operations that weren't in the
checks. Not sure if they've always been there or something changed at some
point.

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

5 years ago[Sparc] Fix typo. NFC.
Jim Lin [Mon, 15 Apr 2019 05:16:46 +0000 (05:16 +0000)]
[Sparc] Fix typo. NFC.

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

5 years ago[GlobalISel] Enable CSE in the IRTranslator & legalizer for -O0 with constants only.
Amara Emerson [Mon, 15 Apr 2019 05:04:20 +0000 (05:04 +0000)]
[GlobalISel] Enable CSE in the IRTranslator & legalizer for -O0 with constants only.

Other opcodes shouldn't be CSE'd until we can be sure debug info quality won't
be degraded.

This change also improves the IRTranslator so that in most places, but not all,
it creates constants using the MIRBuilder directly instead of first creating a
new destination vreg and then creating a constant. By doing this, the
buildConstant() method can just return the vreg of an existing G_CONSTANT
instead of having to create a COPY from it.

I measured a 0.2% improvement in compile time and a 0.9% improvement in code
size at -O0 ARM64.

Compile time:
Program                                        base   cse    diff
test-suite...ark/tramp3d-v4/tramp3d-v4.test     9.04   9.12  0.8%
test-suite...Mark/mafft/pairlocalalign.test     2.68   2.66 -0.7%
test-suite...-typeset/consumer-typeset.test     5.53   5.51 -0.4%
test-suite :: CTMark/lencod/lencod.test         5.30   5.28 -0.3%
test-suite :: CTMark/Bullet/bullet.test        25.82  25.76 -0.2%
test-suite...:: CTMark/ClamAV/clamscan.test     6.92   6.90 -0.2%
test-suite...TMark/7zip/7zip-benchmark.test    34.24  34.17 -0.2%
test-suite :: CTMark/SPASS/SPASS.test           6.25   6.24 -0.1%
test-suite...:: CTMark/sqlite3/sqlite3.test     1.66   1.66 -0.1%
test-suite :: CTMark/kimwitu++/kc.test         13.61  13.60 -0.0%
Geomean difference                                          -0.2%

Code size:
Program                                        base     cse      diff
test-suite...-typeset/consumer-typeset.test    1315632  1266480 -3.7%
test-suite...:: CTMark/ClamAV/clamscan.test    1313892  1297508 -1.2%
test-suite :: CTMark/lencod/lencod.test        1439504  1423112 -1.1%
test-suite...TMark/7zip/7zip-benchmark.test    2936980  2904172 -1.1%
test-suite :: CTMark/Bullet/bullet.test        3478276  3445460 -0.9%
test-suite...ark/tramp3d-v4/tramp3d-v4.test    8082868  8033492 -0.6%
test-suite :: CTMark/kimwitu++/kc.test         3870380  3853972 -0.4%
test-suite :: CTMark/SPASS/SPASS.test          1434904  1434896 -0.0%
test-suite...Mark/mafft/pairlocalalign.test    764528   764528   0.0%
test-suite...:: CTMark/sqlite3/sqlite3.test    782092   782092   0.0%
Geomean difference                                              -0.9%

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

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

5 years ago[GlobalISel] Introduce a CSEConfigBase class to allow targets to define their own...
Amara Emerson [Mon, 15 Apr 2019 04:53:46 +0000 (04:53 +0000)]
[GlobalISel] Introduce a CSEConfigBase class to allow targets to define their own CSE configs.

Because CodeGen can't depend on GlobalISel, we need a way to encapsulate the CSE
configs that can be passed between TargetPassConfig and the targets' custom
pass configs. This CSEConfigBase allows targets to create custom CSE configs
which is then used by the GISel passes for the CSEMIRBuilder.

This support will be used in a follow up commit to allow constant-only CSE for
-O0 compiles in D60580.

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

5 years agollvm-undname: Fix oss-fuzz-foudn crash-on-invalid with incomplete special table nodes
Nico Weber [Sun, 14 Apr 2019 23:32:37 +0000 (23:32 +0000)]
llvm-undname: Fix oss-fuzz-foudn crash-on-invalid with incomplete special table nodes

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

5 years agogn build: Merge r358297
Nico Weber [Sun, 14 Apr 2019 23:23:14 +0000 (23:23 +0000)]
gn build: Merge r358297

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

5 years agogn build: Merge r358243
Nico Weber [Sun, 14 Apr 2019 23:21:58 +0000 (23:21 +0000)]
gn build: Merge r358243

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

5 years agogn build: Merge r358272
Nico Weber [Sun, 14 Apr 2019 23:19:32 +0000 (23:19 +0000)]
gn build: Merge r358272

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

5 years agollvm-undname: Fix another crash-on-invalid found by oss-fuzz
Nico Weber [Sun, 14 Apr 2019 23:08:12 +0000 (23:08 +0000)]
llvm-undname: Fix another crash-on-invalid found by oss-fuzz

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

5 years ago[X86] Redefine KUNPCK instructions to take a narrower source register class than...
Craig Topper [Sun, 14 Apr 2019 20:52:42 +0000 (20:52 +0000)]
[X86] Redefine KUNPCK instructions to take a narrower source register class than destination register class. Remove copies from the isel output pattern.

There's no reason for the inputs to be the destination register class. This just
forces an unnecessary copy in the output patterns.

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

5 years ago[X86] Put the locked mi8 instrutions above the locked mi/mi32 so they will be prefered.
Craig Topper [Sun, 14 Apr 2019 19:00:00 +0000 (19:00 +0000)]
[X86] Put the locked mi8 instrutions above the locked mi/mi32 so they will be prefered.

We want 64mi8 to be prefered over 64mi32. The order for 16mi/32mi doesn't
really matter.

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

5 years ago[X86] Change IMUL with immediate instruction order to ri8 instructions come before...
Craig Topper [Sun, 14 Apr 2019 18:59:57 +0000 (18:59 +0000)]
[X86] Change IMUL with immediate instruction order to ri8 instructions come before ri/ri32 instructions.

This will ensure IMUL64ri8 is tried before IMUL64ri32. For IMUL32 and IMUL16 the
order doesn't really matter because only the ri8 versions use a predicate. That
automatically gives them priority.

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

5 years ago[X86] Move VPTESTM matching from the isel table to custom code in X86ISelDAGToDAG.
Craig Topper [Sun, 14 Apr 2019 18:26:11 +0000 (18:26 +0000)]
[X86] Move VPTESTM matching from the isel table to custom code in X86ISelDAGToDAG.

We had many tablegen patterns for these instructions. And due to the
commutability of the patterns, tablegen expands them to even more patterns. All
together VPTESTMD patterns accounted for more the 50K of the 610K isel table.
This had gotten bad when we stopped canonicalizing AND to vXi64. This required
a pattern for every combination of bitcast input type.

This change moves the matching to custom code where it is easier to look through
the bitcasts without being concerned with the specific types.

The test changes are because we are now stricter with one use checks as its
required to make load folding legal. We now require the AND and any BITCAST to
only have a single use. This prevents forming VPTESTM and a VPAND with the same
inputs.

We now support broadcast loads for 128/256 patterns without VLX. We'll widen to
512-bit like and still fold the broadcast since the amount of memory read
doesn't change.

There are a few tests that got slightly longer because are now prefering
load + VPTESTM over XOR+VPCMPEQ for (seteq (load), allzeros). Previously we were
able to share the XOR with multiple VPTESTM instructions.

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

5 years ago[X86] Don't form masked vpcmp/vcmp/vptestm operations if the setcc node has more...
Craig Topper [Sun, 14 Apr 2019 18:26:06 +0000 (18:26 +0000)]
[X86] Don't form masked vpcmp/vcmp/vptestm operations if the setcc node has more than one use.

We're better of emitting a single compare + kand rather than a compare for the
other use and a masked compare.

I'm looking into using custom instruction selection for VPTESTM to reduce the
ridiculous number of permutations of patterns in the isel table. Putting a one
use check on all masked compare folding makes load fold matching in the custom
code easier.

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

5 years ago[ConstantRange] Simplify unittests after getSetSize was removed
Fangrui Song [Sun, 14 Apr 2019 09:19:15 +0000 (09:19 +0000)]
[ConstantRange] Simplify unittests after getSetSize was removed

Reviewers: lebedev.ri, nikic

Reviewed By: nikic

Subscribers: llvm-commits

Tags: #llvm

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

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

5 years ago[Mem2Reg] Delete unused PointerAllocaValues
Fangrui Song [Sun, 14 Apr 2019 07:28:29 +0000 (07:28 +0000)]
[Mem2Reg] Delete unused PointerAllocaValues

It is unused after AliasSetTracker support was removed.

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

5 years ago[Mem2Reg] Simplify and micro optimize
Fangrui Song [Sun, 14 Apr 2019 07:20:03 +0000 (07:20 +0000)]
[Mem2Reg] Simplify and micro optimize

* Rearrange continu/break
* BBNumbers.lookup(A) -> BBNumbers.find(A)->second
  BBNumbers has been computed, thus we can assume the value exists in the predicate.

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

5 years ago[Mem2Reg] Don't call LBI.deleteValue on AllocInst/DbgVariableIntrinsic
Fangrui Song [Sun, 14 Apr 2019 06:27:07 +0000 (06:27 +0000)]
[Mem2Reg] Don't call LBI.deleteValue on AllocInst/DbgVariableIntrinsic

Only StoreInst/LoadInst are assigned numbers. Other types of instructions are not in LBI.

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

5 years ago[Mem2Reg] Simplify rewriteSingleStoreAlloca
Fangrui Song [Sun, 14 Apr 2019 05:48:13 +0000 (05:48 +0000)]
[Mem2Reg] Simplify rewriteSingleStoreAlloca

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

5 years ago[ConstantRange] Fix unittest after rL358347
Fangrui Song [Sun, 14 Apr 2019 05:19:15 +0000 (05:19 +0000)]
[ConstantRange] Fix unittest after rL358347

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

5 years ago[ConstantRange] Delete unused getSetSize
Fangrui Song [Sun, 14 Apr 2019 04:45:04 +0000 (04:45 +0000)]
[ConstantRange] Delete unused getSetSize

getSetSize returns an APInt that is 1 bit wider. The APInt is typically 65-bit and requires memory allocation. isSizeStrictlySmallerThan and isSizeLargerThan are preferred. The last use of this helper method was removed by rL302385.

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

5 years ago[X86] Update bool_reduction_v8f32 test cases from vector-compare-any_of.ll and vector...
Craig Topper [Sun, 14 Apr 2019 04:20:42 +0000 (04:20 +0000)]
[X86] Update bool_reduction_v8f32 test cases from vector-compare-any_of.ll and vector-compare-all_of.ll to be proper reductions.

One of the shuffles was used twice. While the intended shuffle wasn't connected.

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

5 years ago[X86] Remove some unused tablegen multiclasses. NFC
Craig Topper [Sun, 14 Apr 2019 04:20:38 +0000 (04:20 +0000)]
[X86] Remove some unused tablegen multiclasses. NFC

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

5 years ago[Tests] Add tests for D60659, and make adjustments to others to make diff clear
Philip Reames [Sat, 13 Apr 2019 22:12:56 +0000 (22:12 +0000)]
[Tests] Add tests for D60659, and make adjustments to others to make diff clear

Three related changes:
1) auto-gen several test files
2) Add the new tests at the bottom of said files
3) Adjust a couple of other test files not to use stores to constants when trying to test constexpr address handling

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

5 years ago[X86] Use PC-relative mode for the kernel code model
Bill Wendling [Sat, 13 Apr 2019 21:39:28 +0000 (21:39 +0000)]
[X86] Use PC-relative mode for the kernel code model

Summary:
The Linux kernel uses PC-relative mode, so allow that when the code model is
"kernel".

Reviewers: craig.topper

Reviewed By: craig.topper

Subscribers: llvm-commits, kees, nickdesaulniers

Tags: #llvm

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

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

5 years ago[CVP] Add tests for range of with.overflow result; NFC
Nikita Popov [Sat, 13 Apr 2019 19:43:51 +0000 (19:43 +0000)]
[CVP] Add tests for range of with.overflow result; NFC

Test range of with.overflow result in the no-overflow branch.

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

5 years ago[ConstantRange] Disallow NUW | NSW in makeGuaranteedNoWrapRegion()
Nikita Popov [Sat, 13 Apr 2019 19:43:45 +0000 (19:43 +0000)]
[ConstantRange] Disallow NUW | NSW in makeGuaranteedNoWrapRegion()

As motivated in D60598, this drops support for specifying both NUW and
NSW in makeGuaranteedNoWrapRegion(). None of the users of this function
currently make use of this.

When both NUW and NSW are specified, the exact nowrap region has two
disjoint parts and makeGNWR() returns one of them. This result doesn't
seem to be useful for anything, but makes the semantics of the function
fuzzier.

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

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

5 years ago[InstCombine] Remove redundant/bogus mul_with_overflow combines
Nikita Popov [Sat, 13 Apr 2019 19:43:35 +0000 (19:43 +0000)]
[InstCombine] Remove redundant/bogus mul_with_overflow combines

As pointed out in D60518 folding mulo(%x, undef) to {undef, undef}
isn't correct. As a correct version of this already exists in
InstructionSimplify (https://github.com/llvm-mirror/llvm/blob/bd8056ef326e075cc500f3f0cfcd1193bc200594/lib/Analysis/InstructionSimplify.cpp#L4750-L4757) this is just
dead code though. Drop it together with the mul(%x, 0) -> {0, false}
fold that is also already handled by InstSimplify.

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

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

5 years ago[X86] Use int64_t and isInt<N> instead of APInt operations in foldLoadStoreIntoMemOpe...
Craig Topper [Sat, 13 Apr 2019 18:57:41 +0000 (18:57 +0000)]
[X86] Use int64_t and isInt<N> instead of APInt operations in foldLoadStoreIntoMemOperand. NFC

We know all our values are limited to 64 bits here so we don't need an APInt.

This should save some generated code checking between large and small size.

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

5 years ago[CommandLineParser] Add DefaultOption flag
Don Hinton [Sat, 13 Apr 2019 16:55:28 +0000 (16:55 +0000)]
[CommandLineParser] Add DefaultOption flag

Summary: Add DefaultOption flag to CommandLineParser which provides a
default option or alias, but allows users to override it for some
other purpose as needed.

Also, add `-h` as a default alias to `-help`, which can be seamlessly
overridden by applications like llvm-objdump and llvm-readobj which
use `-h` as an alias for other options.

Reviewers: alexfh, klimek

Reviewed By: klimek

Subscribers: MaskRay, mehdi_amini, inglorion, dexonsmith, hiraditya, llvm-commits, jhenderson, arphaman, cfe-commits

Tags: #clang, #llvm

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

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

5 years ago[WebAssembly] Use Function::hasOptSize() (NFC)
Heejin Ahn [Sat, 13 Apr 2019 16:54:39 +0000 (16:54 +0000)]
[WebAssembly] Use Function::hasOptSize() (NFC)

Summary: Use member function.

Reviewers: aheejin

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

Tags: #llvm

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

Patch by Hideto Ueno (uenoku)

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

5 years ago[CallingConvLower] Use SmallVectorImpl::swap
Fangrui Song [Sat, 13 Apr 2019 15:58:48 +0000 (15:58 +0000)]
[CallingConvLower] Use SmallVectorImpl::swap

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

5 years ago[Mem2Reg] Delete unused AllocaPointerVal
Fangrui Song [Sat, 13 Apr 2019 15:41:42 +0000 (15:41 +0000)]
[Mem2Reg] Delete unused AllocaPointerVal

It is no longer used after the AliasSetTracker updating logic was removed.

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

5 years ago[ADT] Fix OwningArrayRef's move ctor
Fangrui Song [Sat, 13 Apr 2019 13:52:11 +0000 (13:52 +0000)]
[ADT] Fix OwningArrayRef's move ctor

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

5 years ago[CVP] Fix inverted predicates in test; NFC
Nikita Popov [Sat, 13 Apr 2019 11:47:36 +0000 (11:47 +0000)]
[CVP] Fix inverted predicates in test; NFC

Checked the wrong direction in the umul tests... fix predicated to
line up with the test name.

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

5 years ago[CVP] Add tests for with.overflow used as condition; NFC
Nikita Popov [Sat, 13 Apr 2019 11:40:16 +0000 (11:40 +0000)]
[CVP] Add tests for with.overflow used as condition; NFC

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

5 years ago[InstCombine] Canonicalize (-X srem Y) to -(X srem Y).
Chen Zheng [Sat, 13 Apr 2019 09:21:22 +0000 (09:21 +0000)]
[InstCombine] Canonicalize (-X srem Y) to -(X srem Y).

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

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

5 years ago[InstCombine] [NFC] add testcases for canonicalizing (-X srem Y) to -(X srem Y).
Chen Zheng [Sat, 13 Apr 2019 07:34:55 +0000 (07:34 +0000)]
[InstCombine] [NFC] add testcases for canonicalizing (-X srem Y) to -(X srem Y).

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

5 years ago[StackMaps] Update llvm-readobj to parse V3 Stackmaps
Philip Reames [Sat, 13 Apr 2019 03:55:13 +0000 (03:55 +0000)]
[StackMaps] Update llvm-readobj to parse V3 Stackmaps

This updates the StackMap parser in the llvm-readobj tool to parse version 3 StackMaps, which were bumped in https://reviews.llvm.org/D32629.

Version 3 StackMaps differ in that they have a uint16 sized "location size" field which was added to the Location block in a StackMap record. The record has additional padding for alignment. This was a backwards incompatible change resulting in a StackMap version bump.

Patch By: jacob.hughes@kcl.ac.uk (with a rewrite of tests by me)
Differential Revision: https://reviews.llvm.org/D59020

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

5 years ago[StackMaps] Add location size to llvm-readobj -stackmap output
Philip Reames [Sat, 13 Apr 2019 03:08:45 +0000 (03:08 +0000)]
[StackMaps] Add location size to llvm-readobj -stackmap output

The size field of a location can be different for each entry, so it is useful to have this displayed in the output of llvm-readobj -stackmap. Below is an example of how the output would look:

Record ID: 2882400000, instruction offset: 16
   3 locations:
     #1: Constant 1, size: 8
     #2: Constant 2, size: 8
     #3: Constant 3, size: 8
   0 live-outs: [ ]

Patch By: jacob.hughes@kcl.ac.uk (with heavy modification by me)
Differential Revision: https://reviews.llvm.org/D59169

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

5 years ago[llvm-readobj] Minor style tweak for consistency sake [NFC]
Philip Reames [Sat, 13 Apr 2019 02:23:08 +0000 (02:23 +0000)]
[llvm-readobj] Minor style tweak for consistency sake [NFC]

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

5 years ago[StackMaps] Remove format version from the class name [NFC]
Philip Reames [Sat, 13 Apr 2019 02:02:56 +0000 (02:02 +0000)]
[StackMaps] Remove format version from the class name [NFC]

Motivation is to reduce silly diffs when we change the format.  For instance, this causes most of D59020 to disappear.

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

5 years ago[StackMaps] Add explicit location size accessor to the stackmap parser
Philip Reames [Sat, 13 Apr 2019 01:50:50 +0000 (01:50 +0000)]
[StackMaps] Add explicit location size accessor to the stackmap parser

The reserved uint8 field in the location block of the stackmap record is used to denote the size of the location.

Patch By: jacob.hughes@kcl.ac.uk
Differential Revision: https://reviews.llvm.org/D59167

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

5 years ago[AArch64][GlobalISel] Enable copy elision in the pre-legalizer combine and fix a...
Amara Emerson [Sat, 13 Apr 2019 00:33:25 +0000 (00:33 +0000)]
[AArch64][GlobalISel] Enable copy elision in the pre-legalizer combine and fix a crash.

This enables the simple copy combine that already exists in the CombinerHelper.
However, it exposed a bug in the GISelChangeObserver where it wouldn't clear a
set of MIs to process, and so would end up causing a crash when deleted MIs were
being added to the combiner worklist again.

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

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

5 years ago[WebAssembly] Add DataCount section to object files
Thomas Lively [Fri, 12 Apr 2019 22:27:48 +0000 (22:27 +0000)]
[WebAssembly] Add DataCount section to object files

Summary:
This ensures that object files will continue to validate as
WebAssembly modules in the presence of bulk memory operations. Engines
that don't support bulk memory operations will not recognize the
DataCount section and will report validation errors, but that's ok
because object files aren't supposed to be run directly anyway.

Reviewers: aheejin, dschuff, sbc100

Subscribers: jgravelle-google, hiraditya, sunfish, rupprecht, llvm-commits

Tags: #llvm

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

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

5 years ago[GlobalISel] Fix a crash when handling an invalid MVT during call lowering.
Amara Emerson [Fri, 12 Apr 2019 22:05:46 +0000 (22:05 +0000)]
[GlobalISel] Fix a crash when handling an invalid MVT during call lowering.

This crash was introduced in r358032 as we try to construct an EVT from an MVT
in order to find the register type for the calling conv. Fall back instead of
trying to do this with an invalid MVT coming from i256.

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

5 years ago[MemorySSA] Add previous def to cache when found, even if trivial.
Alina Sbirlea [Fri, 12 Apr 2019 21:58:52 +0000 (21:58 +0000)]
[MemorySSA] Add previous def to cache when found, even if trivial.

Summary:
When inserting a new Def, MemorySSA may be have non-minimal number of Phis.
While inserting, the walk to find the previous definition may cleanup minimal Phis.
When the last definition is trivial to obtain, we do not cache it.

It is possible while getting the previous definition for a Def to get two different answers:
- one that was straight-forward to find when walking the first path (a trivial phi in this case), and
- another that follows a cleanup of the trivial phi, it determines it may need additional Phi nodes, it inserts them and returns a new phi in the same position as the former trivial one.
While the Phis added for the second path are all redundant, they are not complete (the walk is only done upwards), and they are not properly cleaned up afterwards.

A way to fix this problem is to cache the straight-forward answer we got on the first walk.
The caching is only kept for the duration of a getPreviousDef call, and for Phis we use TrackingVH, so removing the trivial phi will lead to replacing it with the next dominating phi in the cache.
Resolves PR40749.

Reviewers: george.burgess.iv

Subscribers: jlebar, Prazek, llvm-commits

Tags: #llvm

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

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

5 years ago[AArch64][GlobalISel] Fix a crash when selecting shufflevectors with an undef mask...
Amara Emerson [Fri, 12 Apr 2019 21:31:21 +0000 (21:31 +0000)]
[AArch64][GlobalISel] Fix a crash when selecting shufflevectors with an undef mask element.

If a shufflevector's mask vector has an element with "undef" then the generic
instruction defining that element register is a G_IMPLICT_DEF instead of G_CONSTANT.
This fixes the selector to handle this case, and for now assumes that undef just means
zero. In future we'll optimize this case properly.

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

5 years ago[WebAssembly] Add mutable-globals to bleeding-edge CPU
Thomas Lively [Fri, 12 Apr 2019 20:39:53 +0000 (20:39 +0000)]
[WebAssembly] Add mutable-globals to bleeding-edge CPU

Summary: This brings the backend in line with Clang.

Reviewers: aheejin, dschuff

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

Tags: #llvm

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

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

5 years ago[ConstantRange] Clarify makeGuaranteedNoWrapRegion() guarantees; NFC
Nikita Popov [Fri, 12 Apr 2019 19:36:47 +0000 (19:36 +0000)]
[ConstantRange] Clarify makeGuaranteedNoWrapRegion() guarantees; NFC

makeGuaranteedNoWrapRegion() is actually makeExactNoWrapRegion() as
long as only one of NUW or NSW is specified. This is not obvious from
the current documentation, and some code seems to think that it is
only exact for single-element ranges. Clarify docs and add tests to
be more confident this really holds.

There are currently no users of makeGuaranteedNoWrapRegion() that
pass both NUW and NSW. I think it would be best to drop support for
this entirely and then rename the function to makeExactNoWrapRegion().

Knowing that the no-wrap region is exact is useful, because we can
backwards-constrain values. What I have in mind in particular is
that LVI should be able to constrain values on edges where the
with.overflow overflow flag is false.

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

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

5 years ago[SCEV] Add option to forget everything in SCEV.
Alina Sbirlea [Fri, 12 Apr 2019 19:16:07 +0000 (19:16 +0000)]
[SCEV] Add option to forget everything in SCEV.

Summary:
Create a method to forget everything in SCEV.
Add a cl::opt and PassManagerBuilder option to use this in LoopUnroll.

Motivation: Certain Halide applications spend a very long time compiling in forgetLoop, and prefer to forget everything and rebuild SCEV from scratch.
Sample difference in compile time reduction: 21.04 to 14.78 using current ToT release build.
Testcase showcasing this cannot be opensourced and is fairly large.

The option disabled by default, but it may be desirable to enable by
default. Evidence in favor (two difference runs on different days/ToT state):

File Before (s) After (s)
clang-9.bc 7267.91 6639.14
llvm-as.bc 194.12 194.12
llvm-dis.bc 62.50 62.50
opt.bc 1855.85 1857.53

File Before (s) After (s)
clang-9.bc 8588.70 7812.83
llvm-as.bc 196.20 194.78
llvm-dis.bc 61.55 61.97
opt.bc 1739.78 1886.26

Reviewers: sanjoy

Subscribers: mehdi_amini, jlebar, zzheng, javed.absar, dmgreen, jdoerfert, llvm-commits

Tags: #llvm

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

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

5 years ago[MemorySSA] Small fix for the clobber limit.
Alina Sbirlea [Fri, 12 Apr 2019 18:48:46 +0000 (18:48 +0000)]
[MemorySSA] Small fix for the clobber limit.

Summary:
After introducing the limit for clobber walking, `walkToPhiOrClobber` would assert that the limit is at least 1 on entry.
The test included triggered that assert.

The callsite in `tryOptimizePhi` making the calls to `walkToPhiOrClobber` is structured like this:
```
while (true) {
   if (getBlockingAccess()) { // calls walkToPhiOrClobber
   }
   for (...) {
     walkToPhiOrClobber();
   }
}
```

The cleanest fix is to check if the limit was reached inside `walkToPhiOrClobber`, and give an allowence of 1.
This approach not make any alias() calls (no calls to instructionClobbersQuery), so the performance condition is enforced.
The limit is set back to 0 if not used, as this provides info on the fact that we stopped before reaching a true clobber.

Reviewers: george.burgess.iv

Subscribers: jlebar, Prazek, llvm-commits

Tags: #llvm

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

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

5 years ago[InstCombine] Fix a nasty miscompile introduced w/masked.gather demanded elts
Philip Reames [Fri, 12 Apr 2019 18:26:56 +0000 (18:26 +0000)]
[InstCombine] Fix a nasty miscompile introduced w/masked.gather demanded elts

This fixes a miscompile which was introduced in r356510 (https://reviews.llvm.org/D57372).

The problem is that the original patch removed pointer operands where the load results we're demanded, but without considering the legality of the load itself.  If the masked.gather had active, but undemanded, lanes, then we could end up creating a load which loaded from an undef address.  The result could be a segfault, or, in theory, an arbitrary read from a random memory location into an used register.

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

5 years ago[CVP] Set NSW/NUW flags when simplifying with.overflow
Nikita Popov [Fri, 12 Apr 2019 18:18:17 +0000 (18:18 +0000)]
[CVP] Set NSW/NUW flags when simplifying with.overflow

When CVP determines that a with.overflow intrinsic cannot overflow,
it currently inserts a simple add/sub. As we already determined that
there can be no overflow, we should add the appropriate NUW/NSW flag.

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

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

5 years ago[KnownBits] Add computeForAddCarry()
Nikita Popov [Fri, 12 Apr 2019 18:18:08 +0000 (18:18 +0000)]
[KnownBits] Add computeForAddCarry()

This is for D60460. computeForAddSub() essentially already supports
carries because it has to deal with subtractions. This revision
extracts a lower-level computeForAddCarry() function, which allows
computing the known bits for add (carry known zero), sub (carry known
one) and addcarry (carry unknown).

As we don't seem to have any yet, I've added a unit test file for
KnownBits and exhaustive tests for the new computeForAddCarry()
functionality, as well the existing computeForAddSub() function.

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

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

5 years ago[Tests] Checkin a test demonstrating a miscompile so that patch which fixes it shows...
Philip Reames [Fri, 12 Apr 2019 18:11:58 +0000 (18:11 +0000)]
[Tests] Checkin a test demonstrating a miscompile so that patch which fixes it shows a clear diff

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

5 years agoSimplify decoupling between RuntimeDyld/RuntimeDyldChecker, add 'got_addr' util.
Lang Hames [Fri, 12 Apr 2019 18:07:28 +0000 (18:07 +0000)]
Simplify decoupling between RuntimeDyld/RuntimeDyldChecker, add 'got_addr' util.

This patch reduces the number of functions in the interface between RuntimeDyld
and RuntimeDyldChecker by combining "GetXAddress" and "GetXContent" functions
into "GetXInfo" functions that return a struct describing both the address and
content. The GetStubOffset function is also replaced with a pair of utilities,
GetStubInfo and GetGOTInfo, that fit the new scheme. For RuntimeDyld both of
these functions will return the same result, but for the new JITLink linker
(https://reviews.llvm.org/D58704) these will provide the addresses of PLT stubs
and GOT entries respectively.

For JITLink's use, a 'got_addr' utility has been added to the rtdyld-check
language, and the syntax of 'got_addr' and 'stub_addr' has been changed: both
functions now take two arguments, a 'stub container name' and a target symbol
name. For llvm-rtdyld/RuntimeDyld the stub container name is the object file
name and section name, separated by a slash. E.g.:

rtdyld-check: *{8}(stub_addr(foo.o/__text, y)) = y

For the upcoming llvm-jitlink utility, which creates stubs on a per-file basis
rather than a per-section basis, the container name is just the file name. E.g.:

jitlink-check: *{8}(got_addr(foo.o, y)) = y

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

5 years ago[Hexagon] Fix reuse bug in Vector Loop Carried Reuse pass
Brendon Cahoon [Fri, 12 Apr 2019 16:37:12 +0000 (16:37 +0000)]
[Hexagon] Fix reuse bug in Vector Loop Carried Reuse pass

The Hexagon Vector Loop Carried Reuse pass was allowing reuse between
two shufflevectors with different masks. The reason is that the masks
are not instruction objects, so the code that checks each operand
just skipped over the operands.

This patch fixes the bug by checking if the operands are the same
when they are not instruction objects. If the objects are not the
same, then the code assumes that reuse cannot occur.

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

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

5 years ago[DAGCombiner] narrow shuffle of concatenated vectors
Sanjay Patel [Fri, 12 Apr 2019 16:31:56 +0000 (16:31 +0000)]
[DAGCombiner] narrow shuffle of concatenated vectors

// shuffle (concat X, undef), (concat Y, undef), Mask -->
// concat (shuffle X, Y, Mask0), (shuffle X, Y, Mask1)

The ARM changes with 'vtrn' and narrowed 'vuzp' are improvements.

The x86 changes look neutral or better. There's one test with an
extra instruction, but that could be reversed for a subtarget with
the right attributes. But by default, we want to avoid the 256-bit
op when possible (in my motivating benchmark, a handful of ymm ops
sprinkled into a sequence of xmm ops are triggering frequency
throttling on Haswell resulting in significantly worse perf).

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

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

5 years ago[PDB Docs] Add some prose describing public and global symbols.
Zachary Turner [Fri, 12 Apr 2019 15:51:40 +0000 (15:51 +0000)]
[PDB Docs] Add some prose describing public and global symbols.

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

5 years agoAdd options for MaxLoadsPerMemcmp(OptSize).
Hiroshi Yamauchi [Fri, 12 Apr 2019 15:05:46 +0000 (15:05 +0000)]
Add options for MaxLoadsPerMemcmp(OptSize).

Reviewers: davidxl

Reviewed By: davidxl

Subscribers: llvm-commits

Tags: #llvm

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

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

5 years ago[X86][SSE] Recognise vXi1 boolean anyof/allof reduction patterns
Simon Pilgrim [Fri, 12 Apr 2019 14:22:57 +0000 (14:22 +0000)]
[X86][SSE] Recognise vXi1 boolean anyof/allof reduction patterns

Currently combineHorizontalPredicateResult only handles anyof/allof reduction patterns of legal types, which can be tricky to match as type legalization of bools can introduce bitcasts/truncs/extensions.

This patch extends combineHorizontalPredicateResult to recognise vXi1 bool reductions as well and uses the existing combineBitcastvxi1 helper to create the MOVMSK necessary to then compare the signmask result.

This ensures the accuracy of the reduction costs added in D60403 which assume the MOVMSK generation.

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

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

5 years agoRevert r358268 "[DebugInfo] DW_OP_deref_size in PrologEpilogInserter."
Hans Wennborg [Fri, 12 Apr 2019 12:54:52 +0000 (12:54 +0000)]
Revert r358268 "[DebugInfo] DW_OP_deref_size in PrologEpilogInserter."

It causes clang to crash while building Chromium. See https://crbug.com/952230
for reproducer.

> The PrologEpilogInserter need to insert a DW_OP_deref_size before
> prepending a memory location expression to an already implicit
> expression to avoid having the existing expression act on the memory
> address instead of the value behind it.
>
> The reason for using DW_OP_deref_size and not plain DW_OP_deref is that
> big-endian targets need to read the right size as simply truncating a
> larger read would yield the wrong result (LSB bytes are not at the lower
> address).
>
> Differential Revision: https://reviews.llvm.org/D59687

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

5 years ago[llvm-objcopy] Fill .symtab_shndx section correctly
Eugene Leviant [Fri, 12 Apr 2019 11:59:30 +0000 (11:59 +0000)]
[llvm-objcopy] Fill .symtab_shndx section correctly

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

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

5 years agoUse llvm::upper_bound. NFC
Fangrui Song [Fri, 12 Apr 2019 11:31:16 +0000 (11:31 +0000)]
Use llvm::upper_bound. NFC

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

5 years ago[PowerPC] Add initialization for some ppc passes
Kang Zhang [Fri, 12 Apr 2019 09:59:40 +0000 (09:59 +0000)]
[PowerPC] Add initialization for some ppc passes

Summary:

Some llc debug options need pass-name as the parameters.
But if we use the pass-name ppc-early-ret, we will get below error:
llc test.ll -stop-after ppc-early-ret
LLVM ERROR: "ppc-early-ret" pass is not registered.
Below pass-names have the pass is not registered error:
ppc-ctr-loops
ppc-ctr-loops-verify
ppc-loop-preinc-prep
ppc-toc-reg-deps
ppc-vsx-copy
ppc-early-ret
ppc-vsx-fma-mutate
ppc-vsx-swaps
ppc-reduce-cr-ops
ppc-qpx-load-splat
ppc-branch-coalescing
ppc-branch-select

Reviewed By: jsji

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

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

5 years ago[DebugInfo] Fix pr41175 Dead Store Elimination missing debug loc
Jeremy Morse [Fri, 12 Apr 2019 09:47:35 +0000 (09:47 +0000)]
[DebugInfo] Fix pr41175 Dead Store Elimination missing debug loc

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

In the bug test case the DSE pass is shortening the range of memory that a
memset is working on. A getelementptr is generated so that the new
starting address can be passed to memset. This instruction was not given
a DebugLoc.

To fix the bug, copy the DebugLoc from the memset instruction.

Patch by Orlando Cazalet-Hyams!

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

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

5 years ago[DebugInfo] DW_OP_deref_size in PrologEpilogInserter.
Markus Lavin [Fri, 12 Apr 2019 08:23:55 +0000 (08:23 +0000)]
[DebugInfo] DW_OP_deref_size in PrologEpilogInserter.

The PrologEpilogInserter need to insert a DW_OP_deref_size before
prepending a memory location expression to an already implicit
expression to avoid having the existing expression act on the memory
address instead of the value behind it.

The reason for using DW_OP_deref_size and not plain DW_OP_deref is that
big-endian targets need to read the right size as simply truncating a
larger read would yield the wrong result (LSB bytes are not at the lower
address).

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

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

5 years agoFix missing arguments in tutorial
Hans Wennborg [Fri, 12 Apr 2019 08:23:28 +0000 (08:23 +0000)]
Fix missing arguments in tutorial

In tutorial "8. Kaleidoscope: Compiling to Object Code" a call to
TargetMachine->addPassesToEmitFile(pass, dest, FileType) is missing
nullptr as its 3rd value.

Patch by Sajjad Heydari!

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

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

5 years agoMove getNumFrameInfos and getDwarfFrameInfos out of line and remove
Eric Christopher [Fri, 12 Apr 2019 07:42:35 +0000 (07:42 +0000)]
Move getNumFrameInfos and getDwarfFrameInfos out of line and remove
the MCDwarf.h include.

This removes 50 transitive dependencies for a modification of
MCDwarf.h in a build of llc for a pair of out of line functions
and reduces the build overhead of 'touch MCDwarf.h" by 15% without
impacting test time of check-llvm.

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

5 years agoAdd explicit dependencies on MCSection.h and MCDwarf.h to the .cpp
Eric Christopher [Fri, 12 Apr 2019 07:40:01 +0000 (07:40 +0000)]
Add explicit dependencies on MCSection.h and MCDwarf.h to the .cpp
files rather than rely on transitive includes from MCStreamer.h.

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

5 years ago[ConstantFold] Don't evaluate FP or FP vector casts or truncations when simplifying...
Fangrui Song [Fri, 12 Apr 2019 07:34:30 +0000 (07:34 +0000)]
[ConstantFold] Don't evaluate FP or FP vector casts or truncations when simplifying icmp

Fix PR41476

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

5 years agoRevert "[PowerPC] Add initialization for some ppc passes"
Eric Christopher [Fri, 12 Apr 2019 07:16:58 +0000 (07:16 +0000)]
Revert "[PowerPC] Add initialization for some ppc passes"

This reverts commit 6f8f98ce8de7c0e4ebd7fa2e1fd9507fe8d1c317 as it
is breaking nearly every bot.

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

5 years ago[llvm-readobj] Change variables' name to match LLVM-style. NFC.
Xing GUO [Fri, 12 Apr 2019 07:09:41 +0000 (07:09 +0000)]
[llvm-readobj] Change variables' name to match LLVM-style. NFC.

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