platform/upstream/llvm.git
5 years agoRevert "[Tests] Add LFTR tests for multiple exit loops"
Dmitri Gribenko [Mon, 3 Jun 2019 16:58:11 +0000 (16:58 +0000)]
Revert "[Tests] Add LFTR tests for multiple exit loops"

This reverts commit r362417.  There's a syntax error in the RUN line.

llvm-svn: 362418

5 years ago[Tests] Add LFTR tests for multiple exit loops
Philip Reames [Mon, 3 Jun 2019 16:46:03 +0000 (16:46 +0000)]
[Tests] Add LFTR tests for multiple exit loops

This is preparation for D62625

llvm-svn: 362417

5 years agoInclude what you use in LanaiRegisterInfo.cpp
Dmitri Gribenko [Mon, 3 Jun 2019 16:31:37 +0000 (16:31 +0000)]
Include what you use in LanaiRegisterInfo.cpp

llvm-svn: 362416

5 years ago[LoopPred] Convert a second member function to a static helper [NFC]
Philip Reames [Mon, 3 Jun 2019 16:23:20 +0000 (16:23 +0000)]
[LoopPred] Convert a second member function to a static helper [NFC]

(And remember to actually mark the first one static.)

llvm-svn: 362415

5 years ago[WebAssembly] Remove fptosi(undef) and fptoui(undef) from reduced test case.
Simon Pilgrim [Mon, 3 Jun 2019 16:21:58 +0000 (16:21 +0000)]
[WebAssembly] Remove fptosi(undef) and fptoui(undef) from reduced test case.

Pre-commit for D62811 - which adds DAG fpto[us]i(undef) --> undef constant fold

llvm-svn: 362414

5 years agoRevert "[llvm-ar] Fix relative thin archive path handling"
Dmitri Gribenko [Mon, 3 Jun 2019 16:21:37 +0000 (16:21 +0000)]
Revert "[llvm-ar] Fix relative thin archive path handling"

This reverts commit r362407.  It broke compilation of
llvm/lib/Object/ArchiveWriter.cpp:

error: type 'llvm::sys::path::const_iterator' does not provide a call
operator

llvm-svn: 362413

5 years ago[PowerPC] Set PROT_READ flag for MF_EXEC to prevent segfaults on PPC machines
Nemanja Ivanovic [Mon, 3 Jun 2019 16:20:59 +0000 (16:20 +0000)]
[PowerPC] Set PROT_READ flag for MF_EXEC to prevent segfaults on PPC machines

The big endian PPC buildbots are all failing now due to calls to cache
invalidation in unit tests on data that has only the PROT_EXEC flag set.
This has been an issue all along on FreeBSD but it can affect Linux machines
depending on configuration.

This patch mitigates the issue the same way it is mitigated on FreeBSD.

Since this is needed to bring the buildbots back to green, I plan to commit this
and allow for post-commit review, but I thought I would also post it here for
ease of access/readability.

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

llvm-svn: 362412

5 years ago[LoopPred] Convert member function to free helper function [NFC]
Philip Reames [Mon, 3 Jun 2019 16:17:14 +0000 (16:17 +0000)]
[LoopPred] Convert member function to free helper function [NFC]

llvm-svn: 362411

5 years agoRe-check in clang support gun asm goto after fixing tests.
Jennifer Yu [Mon, 3 Jun 2019 15:57:25 +0000 (15:57 +0000)]
Re-check in clang support gun asm goto after fixing tests.

llvm-svn: 362410

5 years ago[PR41567][Sema] Fixed cast kind in addr space conversions
Anastasia Stulova [Mon, 3 Jun 2019 15:42:36 +0000 (15:42 +0000)]
[PR41567][Sema] Fixed cast kind in addr space conversions

This change sets missing cast kind correctly in the address
space conversion case.

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

llvm-svn: 362409

5 years agoInclude what you use in LanaiInstrInfo.cpp
Dmitri Gribenko [Mon, 3 Jun 2019 15:26:25 +0000 (15:26 +0000)]
Include what you use in LanaiInstrInfo.cpp

llvm-svn: 362408

5 years ago[llvm-ar] Fix relative thin archive path handling
Owen Reynolds [Mon, 3 Jun 2019 15:26:07 +0000 (15:26 +0000)]
[llvm-ar] Fix relative thin archive path handling

This fixes some thin archive relative path issues, paths are shortened where possible and paths are output correctly when using the display table command.

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

llvm-svn: 362407

5 years ago[lldb-server unittest] Add missing teardown logic
Antonio Afonso [Mon, 3 Jun 2019 15:18:15 +0000 (15:18 +0000)]
[lldb-server unittest] Add missing teardown logic

Summary:
This test base class is missing the teardown making the second set of tests extending it to fail in an assertion in the FileSystem::Initialize() (as it's being initialized twice).
Not sure why this isn't failing the build bots.. (unless they're running without asserts?).

With this fix `ninja LLDBServerTests && ./tools/lldb/unittests/tools/lldb-server/tests/LLDBServerTests` successfully runs and passes all tests.

Reviewers: clayborg, xiaobai, labath

Reviewed By: xiaobai, labath

Subscribers: lldb-commits

Tags: #lldb

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

llvm-svn: 362406

5 years agoInclude what you use in PPCInstrInfo.h
Dmitri Gribenko [Mon, 3 Jun 2019 15:04:05 +0000 (15:04 +0000)]
Include what you use in PPCInstrInfo.h

llvm-svn: 362405

5 years ago[llvm] [test] Remove non-portable EISDIR test from macho-disassemble-g-dsym.test
Michal Gorny [Mon, 3 Jun 2019 14:50:03 +0000 (14:50 +0000)]
[llvm] [test] Remove non-portable EISDIR test from macho-disassemble-g-dsym.test

Remove the test checking error message for 'is a directory'.  It does
not seem to serve any real purpose, and it relies on matching platform
error strings which are unpredictable and makes the test fragile.
Furthermore, it fails on NetBSD where read() works on directories,
and therefore does not return EISDIR at all.

Fixes r362141.

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

llvm-svn: 362404

5 years agoInclude what you use in NVPTX.h
Dmitri Gribenko [Mon, 3 Jun 2019 14:37:26 +0000 (14:37 +0000)]
Include what you use in NVPTX.h

Other files were not relying on these transitive includes, so I'm
submitting this change separately.

llvm-svn: 362403

5 years agoInclude what you use in NVPTX.h
Dmitri Gribenko [Mon, 3 Jun 2019 14:26:50 +0000 (14:26 +0000)]
Include what you use in NVPTX.h

I also fixed all other files that were including NVPTX.h and were
relying on transitive includes.

llvm-svn: 362402

5 years agoFixed build warning with -DLIBOMP_USE_HWLOC=1
Andrey Churbanov [Mon, 3 Jun 2019 14:21:59 +0000 (14:21 +0000)]
Fixed build warning with -DLIBOMP_USE_HWLOC=1

Made type of depth of hwloc object to correapond with
change from unsigned in hwloc 1,x to int in hwloc 2.x.
This eliminates the warning on signed-unsigned comparison.

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

llvm-svn: 362401

5 years ago[AMDGPU][MC] Added support of SCC, VCCZ and EXECZ operands
Dmitry Preobrazhensky [Mon, 3 Jun 2019 13:51:24 +0000 (13:51 +0000)]
[AMDGPU][MC] Added support of SCC, VCCZ and EXECZ operands

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

Reviewers: rampitec, arsenm

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

llvm-svn: 362400

5 years agoUnbreak non-PIC builds after r362390 / D62720
David Zarzycki [Mon, 3 Jun 2019 13:39:49 +0000 (13:39 +0000)]
Unbreak non-PIC builds after r362390 / D62720

llvm-svn: 362399

5 years ago[OpenCL] Undefine cl_intel_planar_yuv extension
Andrew Savonichev [Mon, 3 Jun 2019 13:02:43 +0000 (13:02 +0000)]
[OpenCL] Undefine cl_intel_planar_yuv extension

Summary:

Remove unnecessary definition (otherwise the extension will be defined
where it's not supposed to be defined).

Consider the code:

  #pragma OPENCL EXTENSION cl_intel_planar_yuv : begin
  // some declarations
  #pragma OPENCL EXTENSION cl_intel_planar_yuv : end

is enough for extension to become known for clang.

Patch by: Dmitry Sidorov <dmitry.sidorov@intel.com>

Reviewers: Anastasia, yaxunl

Reviewed By: Anastasia

Tags: #clang

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

llvm-svn: 362398

5 years ago[SelectionDAG] Add [us]itofp(undef) --> 0 constant fold (PR39205)
Simon Pilgrim [Mon, 3 Jun 2019 13:02:07 +0000 (13:02 +0000)]
[SelectionDAG] Add [us]itofp(undef) --> 0 constant fold (PR39205)

We were missing this fold in the DAG, which I've copied directly from llvm::ConstantFoldCastInstruction

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

llvm-svn: 362397

5 years ago[SystemZ] Remove sitofp(undef) from reduced test case.
Simon Pilgrim [Mon, 3 Jun 2019 12:58:36 +0000 (12:58 +0000)]
[SystemZ] Remove sitofp(undef) from reduced test case.

Pre-commit for D62807 - which adds DAG [us]itofp(undef) --> 0 constant fold

llvm-svn: 362396

5 years agoInclude what you use in LanaiInstPrinter.cpp
Dmitri Gribenko [Mon, 3 Jun 2019 12:53:05 +0000 (12:53 +0000)]
Include what you use in LanaiInstPrinter.cpp

llvm-svn: 362395

5 years agoInclude what you use in LanaiMCCodeEmitter.cpp
Dmitri Gribenko [Mon, 3 Jun 2019 12:42:48 +0000 (12:42 +0000)]
Include what you use in LanaiMCCodeEmitter.cpp

LanaiMCCodeEmitter.cpp was not using any APIs from Lanai.h, and was only
including it for transitive dependencies.  Doing so is problematic from
include-what-you-use perspective, but it is also a layering issue (it
creates a dependency cycle between the primary Lanai target library and
the MCTargetDesc library).

llvm-svn: 362394

5 years agoRe-land [LLD][COFF] Early load PDB type server files
Alexandre Ganea [Mon, 3 Jun 2019 12:39:47 +0000 (12:39 +0000)]
Re-land [LLD][COFF] Early load PDB type server files

We need to have all input files ready before doing debuginfo type merging.
This patch is moving the late PDB type server discovery much earlier in the process, when the explicit inputs (OBJs, LIBs) are loaded.
The short term goal is to parallelize type merging.

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

llvm-svn: 362393

5 years agoInclude what you use in LanaiDisassembler.cpp
Dmitri Gribenko [Mon, 3 Jun 2019 12:37:11 +0000 (12:37 +0000)]
Include what you use in LanaiDisassembler.cpp

llvm-svn: 362392

5 years ago[OpenCL] Use long instead of long long in x86 builtins
Andrew Savonichev [Mon, 3 Jun 2019 12:34:59 +0000 (12:34 +0000)]
[OpenCL] Use long instead of long long in x86 builtins

Summary: According to C99 standard long long is at least 64 bits in
size. However, OpenCL C defines long long as 128 bit signed
integer. This prevents one to use x86 builtins when compiling OpenCL C
code for x86 targets. The patch changes long long to long for OpenCL
only.

Patch by: Alexander Batashev <alexander.batashev@intel.com>

Reviewers: craig.topper, Ka-Ka, eandrews, erichkeane, Anastasia

Reviewed By: Ka-Ka, erichkeane, Anastasia

Subscribers: a.elovikov, yaxunl, Anastasia, cfe-commits, ivankara, etyurin, asavonic

Tags: #clang

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

llvm-svn: 362391

5 years agoAMDGPU/GFX10: V_CMPX_xxx instructions still have an omod operand
Nicolai Haehnle [Mon, 3 Jun 2019 12:07:41 +0000 (12:07 +0000)]
AMDGPU/GFX10: V_CMPX_xxx instructions still have an omod operand

Summary: Change-Id: If6ee98e4a723b643bc37254fc6ef8b3812db16da

Reviewers: rampitec

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

Tags: #llvm

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

Change-Id: Id547ef152b2f92b24dc1c0efbf7e4467c4fb4b6e
llvm-svn: 362390

5 years agoInclude what you use in HexagonInstPrinter.cpp
Dmitri Gribenko [Mon, 3 Jun 2019 11:41:22 +0000 (11:41 +0000)]
Include what you use in HexagonInstPrinter.cpp

HexagonInstPrinter.cpp was not using any APIs from HexagonAsmPrinter.h.
Doing so is problematic from include-what-you-use perspective, but it is
also a layering issue (it creates a dependency cycle between the primary
Hexagon target library and the MCTargetDesc library).

llvm-svn: 362389

5 years agoInclude what you use in HexagonAsmPrinter.h
Dmitri Gribenko [Mon, 3 Jun 2019 11:41:18 +0000 (11:41 +0000)]
Include what you use in HexagonAsmPrinter.h

llvm-svn: 362388

5 years agoInclude what you use in HexagonMCInstrInfo.cpp
Dmitri Gribenko [Mon, 3 Jun 2019 11:25:37 +0000 (11:25 +0000)]
Include what you use in HexagonMCInstrInfo.cpp

HexagonMCInstrInfo.cpp was not using any APIs from Hexagon.h.  Doing so
is problematic from include-what-you-use perspective, but it is also a
layering issue (it creates a dependency cycle between the primary
Hexagon target library and the MCTargetDesc library).

llvm-svn: 362387

5 years agoInclude what you use in HexagonMCCodeEmitter.cpp
Dmitri Gribenko [Mon, 3 Jun 2019 11:20:53 +0000 (11:20 +0000)]
Include what you use in HexagonMCCodeEmitter.cpp

HexagonMCCodeEmitter.cpp was not using any APIs from Hexagon.h.  Doing
so is problematic from include-what-you-use perspective, but it is also
a layering issue (it creates a dependency cycle between the primary
Hexagon target library and the MCTargetDesc library).

llvm-svn: 362386

5 years agoInclude what you use in HexagonMCCompound.cpp
Dmitri Gribenko [Mon, 3 Jun 2019 11:20:48 +0000 (11:20 +0000)]
Include what you use in HexagonMCCompound.cpp

HexagonMCCompound.cpp was not using any APIs from Hexagon.h.  Doing so
is problematic from include-what-you-use perspective, but it is also a
layering issue (it creates a dependency cycle between the primary
Hexagon target library and the MCTargetDesc library).

llvm-svn: 362385

5 years agoInclude what you use in HexagonShuffler.cpp
Dmitri Gribenko [Mon, 3 Jun 2019 11:14:20 +0000 (11:14 +0000)]
Include what you use in HexagonShuffler.cpp

HexagonShuffler.cpp was not using any APIs from Hexagon.h, and was only
including it for transitive dependencies.  Doing so is problematic from
include-what-you-use perspective, but it is also a layering issue (it
creates a dependency cycle between the primary Hexagon target library
and the MCTargetDesc library).

llvm-svn: 362384

5 years agoInclude what you use in HexagonMCChecker.cpp
Dmitri Gribenko [Mon, 3 Jun 2019 11:14:15 +0000 (11:14 +0000)]
Include what you use in HexagonMCChecker.cpp

HexagonMCChecker.cpp was not using any APIs from Hexagon.h.  Doing so is
problematic from include-what-you-use perspective, but it is also a
layering issue (it creates a dependency cycle between the primary
Hexagon target library and the MCTargetDesc library).

llvm-svn: 362383

5 years agoInclude what you use in HexagonMCTargetDesc.cpp
Dmitri Gribenko [Mon, 3 Jun 2019 11:14:10 +0000 (11:14 +0000)]
Include what you use in HexagonMCTargetDesc.cpp

HexagonMCTargetDesc.cpp was not using any APIs from Hexagon.h.  Doing so
is problematic from include-what-you-use perspective, but it is also a
layering issue (it creates a dependency cycle between the primary
Hexagon target library and the MCTargetDesc library).

llvm-svn: 362382

5 years agoInclude what you use in HexagonMCShuffler.cpp
Dmitri Gribenko [Mon, 3 Jun 2019 11:14:05 +0000 (11:14 +0000)]
Include what you use in HexagonMCShuffler.cpp

HexagonMCShuffler.cpp was not using any APIs from Hexagon.h.  Doing so
is problematic from include-what-you-use perspective, but it is also a
layering issue (it creates a dependency cycle between the primary
Hexagon target library and the MCTargetDesc library).

llvm-svn: 362381

5 years ago[ARM] Fix recent breakage of -mfpu=none.
Simon Tatham [Mon, 3 Jun 2019 11:02:53 +0000 (11:02 +0000)]
[ARM] Fix recent breakage of -mfpu=none.

The recent change D60691 introduced a bug in clang when handling
option combinations such as `-mcpu=cortex-m4 -mfpu=none`. Those
options together should select Cortex-M4 but disable all use of
hardware FP, but in fact, now hardware FP instructions can still be
generated in that mode.

The reason is because the handling of FPUVersion::NONE disables all
the same feature names it used to, of which the base one is `vfp2`.
But now there are further features below that, like `vfp2d16fp` and
(following D60694) `fpregs`, which also need to be turned off to
disable hardware FP completely.

Added a tiny test which double-checks that compiling a simple FP
function doesn't access the FP registers.

Reviewers: SjoerdMeijer, dmgreen

Reviewed By: dmgreen

Subscribers: lebedev.ri, javed.absar, kristof.beyls, hiraditya, cfe-commits, llvm-commits

Tags: #clang, #llvm

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

llvm-svn: 362380

5 years agoFix compilation warning about unused variable [NFC]
Mikael Holmen [Mon, 3 Jun 2019 10:50:41 +0000 (10:50 +0000)]
Fix compilation warning about unused variable [NFC]

llvm-svn: 362379

5 years ago[AArch64][SVE2] Add CPU and arch directive tests
Cullen Rhodes [Mon, 3 Jun 2019 10:42:02 +0000 (10:42 +0000)]
[AArch64][SVE2] Add CPU and arch directive tests

Summary:
This patch adds tests for directives .arch, .arch_extension and .cpu for
all features defined in Arm SVE2 architecture extension.

Reviewed By: chill

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

llvm-svn: 362378

5 years ago[llvm-readobj] - Convert gnu-sections.test to use YAML.
George Rimar [Mon, 3 Jun 2019 09:58:41 +0000 (09:58 +0000)]
[llvm-readobj] - Convert gnu-sections.test to use YAML.

gnu-sections.test currently use relocs.obj.elf-x86_64 and
relocs.obj.elf-i386 precompiled objects as an inputs.

These inputs actually initially were introduced to test the
dump of relocations and have almost nothing common with dumping
sections.

Patch converts the test to use yaml2obj. That allows to remove
relocs.obj.elf-i386 binary.
(relocs.obj.elf-x86_64 is still used by another test and can't be removed atm).

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

llvm-svn: 362377

5 years agoInclude what you use in HexagonELFObjectWriter.cpp
Dmitri Gribenko [Mon, 3 Jun 2019 09:56:40 +0000 (09:56 +0000)]
Include what you use in HexagonELFObjectWriter.cpp

HexagonELFObjectWriter.cpp was not using any APIs from Hexagon.h, and
was only including it for transitive dependencies.  Doing so is
problematic from include-what-you-use perspective, but it is also a
layering issue (it creates a dependency cycle between the primary
Hexagon target library and the MCTargetDesc library).

llvm-svn: 362376

5 years agoRevert rL362358 : PR42104: Support instantiations of lambdas that implicitly capture...
Simon Pilgrim [Mon, 3 Jun 2019 09:56:09 +0000 (09:56 +0000)]
Revert rL362358 : PR42104: Support instantiations of lambdas that implicitly capture packs.

Two changes:
 * Track odr-use via FunctionParmPackExprs to properly handle dependent
   odr-uses of packs in generic lambdas.
 * Do not instantiate implicit captures; instead, regenerate them by
   instantiating the body of the lambda. This is necessary to
   distinguish between cases where only one element of a pack is
   captured and cases where the entire pack is captured.
........
Fixes http://lab.llvm.org:8011/builders/llvm-clang-x86_64-expensive-checks-win buildbot failures

llvm-svn: 362375

5 years ago[llvm-readobj/llvm-readelf] - Remove gnu-relocations.test completely.
George Rimar [Mon, 3 Jun 2019 09:52:32 +0000 (09:52 +0000)]
[llvm-readobj/llvm-readelf] - Remove gnu-relocations.test completely.

rL362089 introduced a set of yaml based reloc-types-*.test test cases
(instead of huge reloc-types.test that used a lot of precompiled binaries)
These test cases checks LLVM-styled dumping of the relocations.

gnu-relocations.test was a test case to check GNU styled relocations dumping.
It did that only for elf-x86 and elf-x86_64 targets. It did not test all of the
relocations though.

Now, after rL362089, it does not make sence to keep it.
This patch updates reloc-types-elf-i386.test and reloc-types-elf-x64.test tests
with llvm-readelf calls to check GNU styled output in one place.
It removes gnu-relocations.test completely.

One of intentions of doing this is also to get rid of relocs.obj.elf-i386 and
relocs.obj.elf-x86_64 precompiled objects completely (they are used in other tests still).

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

llvm-svn: 362374

5 years ago[LiveDebugValues] Close range for previous variable's location when adding newly...
Nikola Prica [Mon, 3 Jun 2019 09:48:29 +0000 (09:48 +0000)]
[LiveDebugValues] Close range for previous variable's location when adding newly deduced location

When LiveDebugValues deduces new variable's location from spill, restore or
register copy instruction it should close old variable's location. Otherwise
we can have multiple block output locations for same variable. That could lead
to inserting two DBG_VALUEs for same variable to the beginning of the successor
block which results to ignoring of first DBG_VALUE.

Reviewers: aprantl, jmorse, wolfgangp, dstenb

Reviewed By: aprantl

Subscribers: probinson, asowda, ivanbaev, petarj, djtodoro

Tags: #debug-info

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

llvm-svn: 362373

5 years agoInclude what you use in HexagonAsmBackend.cpp
Dmitri Gribenko [Mon, 3 Jun 2019 09:43:05 +0000 (09:43 +0000)]
Include what you use in HexagonAsmBackend.cpp

HexagonAsmBackend.cpp was not using any APIs from Hexagon.h.  Doing so
is problematic from include-what-you-use perspective, but it is also a
layering issue (it creates a dependency cycle between the primary
Hexagon target library and the MCTargetDesc library).

llvm-svn: 362372

5 years ago[OpenCL] Declare builtin functions using TableGen
Sven van Haastregt [Mon, 3 Jun 2019 09:39:11 +0000 (09:39 +0000)]
[OpenCL] Declare builtin functions using TableGen

This patch adds a `-fdeclare-opencl-builtins` command line option to
the clang frontend.  This enables clang to verify OpenCL C builtin
function declarations using a fast StringMatcher lookup, instead of
including the opencl-c.h file with the `-finclude-default-header`
option.  This avoids the large parse time penalty of the header file.

This commit only adds the basic infrastructure and some of the OpenCL
builtins.  It does not cover all builtins defined by the various OpenCL
specifications.  As such, it is not a replacement for
`-finclude-default-header` yet.

RFC: http://lists.llvm.org/pipermail/cfe-dev/2018-November/060041.html

Co-authored-by: Pierre Gondois
Co-authored-by: Joey Gouly
Co-authored-by: Sven van Haastregt
Differential Revision: https://reviews.llvm.org/D60763

llvm-svn: 362371

5 years agoInclude what you use in HexagonAsmParser.cpp
Dmitri Gribenko [Mon, 3 Jun 2019 09:38:48 +0000 (09:38 +0000)]
Include what you use in HexagonAsmParser.cpp

HexagonAsmParser.cpp was not using any APIs from Hexagon.h.  Doing so is
problematic from include-what-you-use perspective, but it is also a
layering issue (it creates a dependency cycle between the primary
Hexagon target library and the AsmParser library).

llvm-svn: 362370

5 years agoInclude what you use in HexagonShuffler.h
Dmitri Gribenko [Mon, 3 Jun 2019 09:33:48 +0000 (09:33 +0000)]
Include what you use in HexagonShuffler.h

HexagonShuffler.h was not using any APIs from Hexagon.h, and was only
including it for transitive dependencies.  Doing so is problematic from
include-what-you-use perspective, but it is also a layering issue (it
creates a dependency cycle between the primary Hexagon target library
and the MCTargetDesc library).

llvm-svn: 362369

5 years agoInclude what you use in BPFMCTargetDesc.cpp
Dmitri Gribenko [Mon, 3 Jun 2019 09:29:51 +0000 (09:29 +0000)]
Include what you use in BPFMCTargetDesc.cpp

BPFMCTargetDesc.cpp was not using any APIs from BPF.h.  Doing so is
problematic from include-what-you-use perspective, but it is also a
layering issue (it creates a dependency cycle between the primary
BPF target library and the MCTargetDesc library).

llvm-svn: 362368

5 years ago[LLD][ELF] - Remove dead code. NFC.
George Rimar [Mon, 3 Jun 2019 09:23:01 +0000 (09:23 +0000)]
[LLD][ELF] - Remove dead code. NFC.

I believe this line was dead after r362356.

llvm-svn: 362367

5 years ago[ARM][FIX] Ran out of registers due tail recursion
Diogo N. Sampaio [Mon, 3 Jun 2019 08:58:05 +0000 (08:58 +0000)]
[ARM][FIX] Ran out of registers due tail recursion

Summary:
- pr42062
When compiling for MinSize,
ARMTargetLowering::LowerCall decides to indirect
multiple calls to a same function. However,
it disconsiders the limitation that thumb1
indirect calls require the callee to be in a
register from r0 to r3 (llvm limiation).
If all those registers are used by arguments, the
compiler dies with "error: run out of registers
during register allocation".
This patch tells the function
IsEligibleForTailCallOptimization if we intend to
perform indirect calls, as to avoid tail call
optimization.

Reviewers: dmgreen, efriedma

Reviewed By: efriedma

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

Tags: #llvm

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

llvm-svn: 362366

5 years ago[AArch64] Check for simple type in FPToUInt
Sam Parker [Mon, 3 Jun 2019 08:49:17 +0000 (08:49 +0000)]
[AArch64] Check for simple type in FPToUInt

DAGCombiner was hitting a SimpleType assertion when trying to combine
a v3f32 before type legalization.

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

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

llvm-svn: 362365

5 years ago[NFC][X86] extract-{low,}bits.ll: one more pattern c with truncation
Roman Lebedev [Mon, 3 Jun 2019 08:44:09 +0000 (08:44 +0000)]
[NFC][X86] extract-{low,}bits.ll: one more pattern c with truncation

llvm-svn: 362364

5 years ago[CodeComplete] Add a bit more whitespace to completed patterns
Ilya Biryukov [Mon, 3 Jun 2019 08:34:25 +0000 (08:34 +0000)]
[CodeComplete] Add a bit more whitespace to completed patterns

Summary:
E.g. we now turn `while(<#cond#>){` into `while (<#cond#>) {`

This slightly improves the final output. Should not affect clients that
format the result on their own.

Reviewers: gribozavr

Reviewed By: gribozavr

Subscribers: jkorous, arphaman, kadircet, cfe-commits

Tags: #clang

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

llvm-svn: 362363

5 years agoA test commit from Mikhail Dvorskiy (blank line, to pstl/trunk) according 'Obtaining...
Mikhail Dvorskiy [Mon, 3 Jun 2019 08:23:30 +0000 (08:23 +0000)]
A test commit from Mikhail Dvorskiy (blank line, to pstl/trunk) according 'Obtaining Commit Access' rules (https://llvm.org/docs/DeveloperPolicy.html#obtaining-commit-access)

llvm-svn: 362362

5 years ago[clang-tidy] Fix make-unique check to work in C++17 mode.
Haojian Wu [Mon, 3 Jun 2019 08:14:15 +0000 (08:14 +0000)]
[clang-tidy] Fix make-unique check to work in C++17 mode.

Summary:
Previously, we intended to omit the check fix to the case when constructor has
any braced-init-list argument. But the HasListInitializedArgument was not
correct to handle all cases (Foo(Bar{1, 2}) will return false in C++14
mode).

This patch fixes it, corrects the tests, and makes the check to run at C++17 mode.

Reviewers: gribozavr

Subscribers: xazax.hun, cfe-commits

Tags: #clang

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

llvm-svn: 362361

5 years ago[TableGen] Fix std::array initializer to avoid warnings with older tool chains. NFC
Mikael Holmen [Mon, 3 Jun 2019 06:38:01 +0000 (06:38 +0000)]
[TableGen] Fix std::array initializer to avoid warnings with older tool chains. NFC

A std::array is implemented as a template with an array inside a struct.
Older versions of clang, like 3.6, require an extra set of curly braces
around std::array initializations to avoid warnings.

The C++ language was changed regarding this by CWG 1270. So more modern
tool chains does not complain even if leaving out one level of braces.

llvm-svn: 362360

5 years ago[ELF][PPC64] Rename some PPC64 ELFv2 specific RelExpr from R_PPC_* to R_PPC64_*
Fangrui Song [Mon, 3 Jun 2019 06:21:33 +0000 (06:21 +0000)]
[ELF][PPC64] Rename some PPC64 ELFv2 specific RelExpr from R_PPC_* to R_PPC64_*

The following abstract relocation types (RelExpr) are PPC64 ELFv2 ABI specific,
not used by PPC32. So rename them to prevent confusion when the PPC32 port is improved.

* R_PPC_CALL R_PPC_CALL_PLT:
  R_PPC_CALL_PLT represents R_PPC64_REL14 and R_PPC64_REL24.
  If the function is not preemptable, R_PPC_CALL_PLT can be optimized to R_PPC_CALL:
  the formula adjusts the symbol VA from the global entry point to the local entry point.
* R_PPC_TOC: represents R_PPC64_TOC.  We don't have a test. Add one to ppc64-relocs.s
  Rename it to R_PPC64_TOCBASE because `@tocbase` is the assembly form.

Reviewed By: ruiu

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

llvm-svn: 362359

5 years agoPR42104: Support instantiations of lambdas that implicitly capture
Richard Smith [Mon, 3 Jun 2019 06:02:10 +0000 (06:02 +0000)]
PR42104: Support instantiations of lambdas that implicitly capture
packs.

Two changes:
 * Track odr-use via FunctionParmPackExprs to properly handle dependent
   odr-uses of packs in generic lambdas.
 * Do not instantiate implicit captures; instead, regenerate them by
   instantiating the body of the lambda. This is necessary to
   distinguish between cases where only one element of a pack is
   captured and cases where the entire pack is captured.

llvm-svn: 362358

5 years ago[ELF][PPC64] Don't apply LD->LE relaxation on R_PPC64_GOT_DTPREL16*
Fangrui Song [Mon, 3 Jun 2019 05:41:31 +0000 (05:41 +0000)]
[ELF][PPC64] Don't apply LD->LE relaxation on R_PPC64_GOT_DTPREL16*

In ELF v2 ABI, R_PPC64_GOT_DTPREL16* are not relaxed.

This family of relocation types are used for variables outside of 2GiB
of the TLS block. 2 instructions cannot materialize a DTPREL offset that
is not 32-bit.

Reviewed By: ruiu

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

llvm-svn: 362357

5 years ago[ELF] Don't create an output section named `/DISCARD/` if it is assigned to the speci...
Fangrui Song [Mon, 3 Jun 2019 05:34:25 +0000 (05:34 +0000)]
[ELF] Don't create an output section named `/DISCARD/` if it is assigned to the special phdr `NONE`

Fixes the remaining issue of PR41673 after D61186: with `/DISCARD/ { ... } :NONE`,
we may create an output section named `/DISCARD/`.

Note, if an input section is named `/DISCARD/`, ld.bfd discards it but
lld keeps it. It is probably not worth copying this behavior as it is unrealistic.

Reviewed By: ruiu

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

llvm-svn: 362356

5 years ago[ELF] Simplify the condition to create .interp
Fangrui Song [Mon, 3 Jun 2019 05:25:03 +0000 (05:25 +0000)]
[ELF] Simplify the condition to create .interp

(1) {gcc,clang} -fuse-ld=bfd -pie -fPIE -nostdlib a.c => .interp created
(2) {gcc,clang} -fuse-ld=lld -pie -fPIE -nostdlib a.c => .interp not created
(3) {gcc,clang} -fuse-ld=lld -pie -fPIE -nostdlib a.c a.so => .interp created

The inconsistency of (2) is due to the condition `!Config->SharedFiles.empty()`.
To make lld behave more like ld.bfd, we could change the condition to:

    Config->HasDynSymTab && !Config->DynamicLinker.empty() && Script->needsInterpSection();

However, that would bring another inconsistency as can be observed with:

(4) {gcc,clang} -fuse-ld=bfd -no-pie -nostdlib a.c => .interp not created

So instead, use `!Config->DynamicLinker.empty() && Script->needsInterpSection()`,
which is both simple and consistent in these cases.

The inconsistency of (4) likely originated from ld.bfd and gold's choice to have a default --dynamic-linker.
Their condition to create .interp is ANDed with (not -shared).
Since lld doesn't have a default --dynamic-linker,
compiler drivers (gcc/clang) don't pass --dynamic-linker for -shared,
and direct ld users are not supposed to specify --dynamic-linker for -shared,
we do not need the condition !Config->Shared.

Reviewed By: ruiu

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

llvm-svn: 362355

5 years agoAdd --sort-common to the man page.
Rui Ueyama [Mon, 3 Jun 2019 05:11:44 +0000 (05:11 +0000)]
Add --sort-common to the man page.

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

llvm-svn: 362354

5 years ago[clangd] Serialization support for RelationSlab
Nathan Ridge [Mon, 3 Jun 2019 05:07:52 +0000 (05:07 +0000)]
[clangd] Serialization support for RelationSlab

Summary: This builds on D59407 to provide YAML and RIFF serialization support.

Reviewers: kadircet

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

Tags: #clang

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

llvm-svn: 362353

5 years ago[clangd] Add RelationSlab
Nathan Ridge [Mon, 3 Jun 2019 04:55:46 +0000 (04:55 +0000)]
[clangd] Add RelationSlab

Summary:
RelationSlab is a new index data structure that stores relations between
symbols.

Reviewers: kadircet

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

Tags: #clang

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

llvm-svn: 362352

5 years ago[AVR] Fix incorrect source regclass of LDWRdPtr
Jim Lin [Mon, 3 Jun 2019 02:31:07 +0000 (02:31 +0000)]
[AVR] Fix incorrect source regclass of LDWRdPtr

Summary:
LDWRdPtr would be expanded to ld+ldd. ldd only accepts the pointer register is Y or Z.
So the register class of pointer of LDWRdPtr should be PTRDISPREGS instead of PTRREGS.

Reviewers: dylanmckay

Reviewed By: dylanmckay

Subscribers: dylanmckay, llvm-commits

Tags: #llvm

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

llvm-svn: 362351

5 years agoRecommit r360171: [DAGCombiner] Avoid creating large tokenfactors in visitTokenFactor.
Florian Hahn [Mon, 3 Jun 2019 01:30:19 +0000 (01:30 +0000)]
Recommit r360171: [DAGCombiner] Avoid creating large tokenfactors in visitTokenFactor.

If we hit the limit, we do expand the outstanding tokenfactors.
Otherwise, we might drop nodes with users in the unexpanded
tokenfactors. This fixes the crashes reported by Jordan Rupprecht.

Reviewers: niravd, spatel, craig.topper, rupprecht

Reviewed By: niravd

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

llvm-svn: 362350

5 years ago[COFF, ARM64] Fix CodeView API change for getRegisterNames
Tom Tan [Mon, 3 Jun 2019 00:48:16 +0000 (00:48 +0000)]
[COFF, ARM64] Fix CodeView API change for getRegisterNames

Change rL362280 changed CodeView API getRegisterNames() by adding an input
parameter in CPUType. It is called in LLDB and needs to be updated.

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

llvm-svn: 362349

5 years ago[coroutines][PR41909] Don't build dependent coroutine statements for generic lambda
Brian Gesiak [Mon, 3 Jun 2019 00:47:32 +0000 (00:47 +0000)]
[coroutines][PR41909] Don't build dependent coroutine statements for generic lambda

Summary:
https://bugs.llvm.org/show_bug.cgi?id=41909 describes an issue in which
a generic lambda that takes a dependent argument `auto set` causes the
template instantiation machinery for coroutine body statements to crash
with an ICE. The issue is two-fold:

1. The paths taken by the template instantiator contain several asserts
   that the coroutine promise must not have a dependent type.
2. The template instantiator unconditionally builds corotuine statements
   that depend on the promise type, which cannot be dependent.

To work around the issue, prevent the template instantiator from building
dependent coroutine statements if the coroutine promise type is dependent.
Since we only expect this to occur in the case of a generic lambda, limit
the workaround behavior to just that case.

Reviewers: GorNishanov, EricWF, lewissbaker, tks2103

Reviewed By: GorNishanov

Subscribers: cfe-commits

Tags: #clang

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

llvm-svn: 362348

5 years agoRevert "[analyzer] exploded-graph-rewriter: An attempt to fix Windows buildbots."
Artem Dergachev [Mon, 3 Jun 2019 00:21:00 +0000 (00:21 +0000)]
Revert "[analyzer] exploded-graph-rewriter: An attempt to fix Windows buildbots."

This reverts commit r362343.

Instead, disable tests on Windows for now.

llvm-svn: 362347

5 years agollvm-undname: Add coverage for some error paths
Nico Weber [Sun, 2 Jun 2019 23:48:28 +0000 (23:48 +0000)]
llvm-undname: Add coverage for some error paths

llvm-svn: 362346

5 years agoUpdate MSVC Visualizer to reflect new variadic PointerUnion
Mike Spertus [Sun, 2 Jun 2019 23:33:32 +0000 (23:33 +0000)]
Update MSVC Visualizer to reflect new variadic PointerUnion

This changed updates the MSVC Visualizer to work with the recent change
of PointerUnion into a variadic template. As an extra bonus, we
fix some bit rot in the SmallPtrSet visualizer as well

llvm-svn: 362345

5 years agollvm-undname; Add more test coverage for demangleFunctionClass()
Nico Weber [Sun, 2 Jun 2019 23:26:57 +0000 (23:26 +0000)]
llvm-undname; Add more test coverage for demangleFunctionClass()

Also add two FC_Far that seem to be missing, by symmetry from
the public and protected cases. (But FC_Far isn't really a thing
anymore, so this doesn't really have an observable effect.)

llvm-svn: 362344

5 years ago[analyzer] exploded-graph-rewriter: An attempt to fix Windows buildbots.
Artem Dergachev [Sun, 2 Jun 2019 23:17:56 +0000 (23:17 +0000)]
[analyzer] exploded-graph-rewriter: An attempt to fix Windows buildbots.

Breakage caused by r362340.

llvm-svn: 362343

5 years ago[DAGCombiner][X86] Fold away masked store and scatter with all zeroes mask.
Craig Topper [Sun, 2 Jun 2019 22:52:38 +0000 (22:52 +0000)]
[DAGCombiner][X86] Fold away masked store and scatter with all zeroes mask.

Similar to what was done for masked load and gather.

llvm-svn: 362342

5 years ago[X86] Add test cases for masked store and masked scatter with an all zeroes mask...
Craig Topper [Sun, 2 Jun 2019 22:52:34 +0000 (22:52 +0000)]
[X86] Add test cases for masked store and masked scatter with an all zeroes mask. Fix bug in ScalarizeMaskedMemIntrin

Need to cast only to Constant instead of ConstantVector to allow
ConstantAggregateZero.

llvm-svn: 362341

5 years ago[analyzer] exploded-graph-rewriter: Initial commit.
Artem Dergachev [Sun, 2 Jun 2019 21:40:53 +0000 (21:40 +0000)]
[analyzer] exploded-graph-rewriter: Initial commit.

This is a utility to improve readability and generally manipulate
GraphViz dumps of the analysis graph. Such dumps are often huge and
not only hard to read, but also often hang the viewer apps with their
mere size. Such script should significantly improve debugging experience.

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

llvm-svn: 362340

5 years ago[Commands] Remove unused header
Alex Langford [Sun, 2 Jun 2019 21:11:21 +0000 (21:11 +0000)]
[Commands] Remove unused header

llvm-svn: 362339

5 years ago[CostModel][X86] Improve masked load/store AVX1/AVX2 costs
Simon Pilgrim [Sun, 2 Jun 2019 20:37:02 +0000 (20:37 +0000)]
[CostModel][X86] Improve masked load/store AVX1/AVX2 costs

A mixture of internal tests and review of the scheduler models indicates we're overestimating the cost of a masked load, which we're estimating at 4x regular memory ops - more realistic values indicates that its closer to 2x. Masked stores costs are a lot more diverse but 8x is roughly in the middle of the range.

e.g. SandyBridge
defm : X86WriteRes<WriteFMaskedLoad, [SBPort23,SBPort05], 8, [1,2], 3>;
defm : X86WriteRes<WriteFMaskedLoadY, [SBPort23,SBPort05], 9, [1,2], 3>;
defm : X86WriteRes<WriteFMaskedStore, [SBPort4,SBPort01,SBPort23], 5, [1,1,1], 3>;
defm : X86WriteRes<WriteFMaskedStoreY, [SBPort4,SBPort01,SBPort23], 5, [1,1,1], 3>;

e.g. Btver2
defm : X86WriteRes<WriteFMaskedLoad, [JLAGU, JFPU01, JFPX], 6, [1, 2, 2], 1>;
defm : X86WriteRes<WriteFMaskedLoadY, [JLAGU, JFPU01, JFPX], 6, [2, 4, 4], 2>;
defm : X86WriteRes<WriteFMaskedStore, [JSAGU, JFPU01, JFPX], 6, [1, 1, 4], 1>;
defm : X86WriteRes<WriteFMaskedStoreY, [JSAGU, JFPU01, JFPX], 6, [2, 2, 4], 2>;

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

llvm-svn: 362338

5 years ago[DAGCombiner] Replace masked loads with a zero mask with the passthru value
Craig Topper [Sun, 2 Jun 2019 18:58:46 +0000 (18:58 +0000)]
[DAGCombiner] Replace masked loads with a zero mask with the passthru value

Similar to what was recently done for gathers in r362015.

llvm-svn: 362337

5 years agoTransform lambda expression captures when transforming an expression to
Richard Smith [Sun, 2 Jun 2019 18:53:44 +0000 (18:53 +0000)]
Transform lambda expression captures when transforming an expression to
potentially-evaluated.

This ensures that every potentially-evaluated expression is built in a
potentially-evaluated context. No functionality change intended.

llvm-svn: 362336

5 years ago[TTI][X86] Cleanup getMaskedMemoryOpCost. NFCI.
Simon Pilgrim [Sun, 2 Jun 2019 18:06:42 +0000 (18:06 +0000)]
[TTI][X86] Cleanup getMaskedMemoryOpCost. NFCI.

Prep work before resurrecting D61257.

llvm-svn: 362335

5 years agoFix bug in r362328 -- append to dependency list instead of overwrite it.
Don Hinton [Sun, 2 Jun 2019 17:56:26 +0000 (17:56 +0000)]
Fix bug in r362328 -- append to dependency list instead of overwrite it.

llvm-svn: 362334

5 years agoRemove code path that's dead after r358835
Nico Weber [Sun, 2 Jun 2019 17:41:07 +0000 (17:41 +0000)]
Remove code path that's dead after r358835

llvm-svn: 362333

5 years agoAdd demangling test coverage for unsigned short, unsigned long
Nico Weber [Sun, 2 Jun 2019 17:29:26 +0000 (17:29 +0000)]
Add demangling test coverage for unsigned short, unsigned long

llvm-svn: 362332

5 years agoAdd mangling test coverage for non-volatile const member pointers
Nico Weber [Sun, 2 Jun 2019 17:23:53 +0000 (17:23 +0000)]
Add mangling test coverage for non-volatile const member pointers

llvm-svn: 362331

5 years ago[NFC][X86] extract-{low,}bits.ll: one more pattern a with truncation
Roman Lebedev [Sun, 2 Jun 2019 17:11:21 +0000 (17:11 +0000)]
[NFC][X86] extract-{low,}bits.ll: one more pattern a with truncation

llvm-svn: 362330

5 years agoAdd test coverage for __pascal mangling
Nico Weber [Sun, 2 Jun 2019 16:47:07 +0000 (16:47 +0000)]
Add test coverage for __pascal mangling

llvm-svn: 362329

5 years ago[test] Fix plugin tests
Don Hinton [Sun, 2 Jun 2019 15:53:43 +0000 (15:53 +0000)]
[test] Fix plugin tests

Recommit of r361790 that was temporarily reverted in r361793 due to bot breakage.

Summary:
The following changes were required to fix these tests:

1) Change LLVM_ENABLE_PLUGINS to an option and move it to
   llvm/CMakeLists.txt with an appropriate default -- which matches
   the original default behavior.

2) Move the plugins directory from clang/test/Analysis
   clang/lib/Analysis.  It's not enough to add an exclude to the
   lit.local.cfg file because add_lit_testsuites recurses the tree and
   automatically adds the appropriate `check-` targets, which don't
   make sense for the plugins because they aren't tests and don't
   have `RUN` statements.

   Here's a list of the `clang-check-anlysis*` targets with this
   change:

```
  $ ninja -t targets all| sed -n "s/.*\/\(check[^:]*\):.*/\1/p" | sort -u | grep clang-analysis
  check-clang-analysis
  check-clang-analysis-checkers
  check-clang-analysis-copypaste
  check-clang-analysis-diagnostics
  check-clang-analysis-engine
  check-clang-analysis-exploration_order
  check-clang-analysis-html_diagnostics
  check-clang-analysis-html_diagnostics-relevant_lines
  check-clang-analysis-inlining
  check-clang-analysis-objc
  check-clang-analysis-unified-sources
  check-clang-analysis-z3
```

3) Simplify the logic and only include the subdirectories under
   clang/lib/Analysis/plugins if LLVM_ENABLE_PLUGINS is set.

Reviewed By: NoQ

Tags: #clang, #llvm

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

llvm-svn: 362328

5 years ago[X86] isHorizontalBinOp - add extract_subvector(shuffle(x)) handling (PR39921)
Simon Pilgrim [Sun, 2 Jun 2019 15:47:49 +0000 (15:47 +0000)]
[X86] isHorizontalBinOp - add extract_subvector(shuffle(x)) handling (PR39921)

Let's us match horizontal op patterns on fast-variable-shuffle targets (Haswell etc.)

llvm-svn: 362327

5 years ago[X86] Add AVX2 'fast-variable-shuffle' PHADD tests (PR39921)
Simon Pilgrim [Sun, 2 Jun 2019 15:33:28 +0000 (15:33 +0000)]
[X86] Add AVX2 'fast-variable-shuffle' PHADD tests (PR39921)

Haswell etc. will combine shuffles to a extract_subvector(permd(x)) before isHorizontalBinOp can match it.

llvm-svn: 362326

5 years ago[NFC][X86] extract-lowbits.ll: add one more pattern a with truncation
Roman Lebedev [Sun, 2 Jun 2019 15:07:49 +0000 (15:07 +0000)]
[NFC][X86] extract-lowbits.ll: add one more pattern a with truncation

We are also free to interpret this as 'BZHI'/'BEXTR'.
https://rise4fun.com/Alive/dD6

llvm-svn: 362325

5 years ago[DAGCombine] Fold insert_subvector(bitcast(x),bitcast(y),c1) -> bitcast(insert_subvec...
Simon Pilgrim [Sun, 2 Jun 2019 14:42:11 +0000 (14:42 +0000)]
[DAGCombine] Fold insert_subvector(bitcast(x),bitcast(y),c1) -> bitcast(insert_subvector(x,y),c2)

Move this combine from x86 into generic DAGCombine, which currently only manages cases where the bitcast is between types of the same scalarsize.

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

llvm-svn: 362324

5 years ago[DAG] isBitwiseNot / isConstOrConstSplat - add support for build vector undefs +...
Simon Pilgrim [Sun, 2 Jun 2019 11:56:39 +0000 (11:56 +0000)]
[DAG] isBitwiseNot / isConstOrConstSplat - add support for build vector undefs + truncation (PR41020)

Add (opt-in) support for implicit truncation to isConstOrConstSplat, which allows us to match truncated 'all ones' cases in isBitwiseNot.

PR41020 compares against using ISD::isBuildVectorAllOnes() instead, but that predicate silently accepts any UNDEF elements in the build vector which might not be what we want in isBitwiseNot - so I've added an opt-in 'AllowUndefs' flag that is set to false by default but will allow us to enable it on individual cases where its safe.

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

llvm-svn: 362323

5 years ago[TargetLowering] SimplifyDemandedBits - don't use OriginalDemanded variables in analysis.
Simon Pilgrim [Sun, 2 Jun 2019 10:12:55 +0000 (10:12 +0000)]
[TargetLowering] SimplifyDemandedBits - don't use OriginalDemanded variables in analysis.

These might have been replaced in multiple use cases.

llvm-svn: 362322

5 years ago[TargetLowering] SimplifyDemandedVectorElts - use same arg names as SimplifyDemandedB...
Simon Pilgrim [Sun, 2 Jun 2019 10:03:56 +0000 (10:03 +0000)]
[TargetLowering] SimplifyDemandedVectorElts - use same arg names as SimplifyDemandedBits. NFCI.

Helps with debugging as we recurse between them.

llvm-svn: 362321

5 years ago[IndVarSimplify] Add tests for saturating math on IV; NFC
Nikita Popov [Sun, 2 Jun 2019 08:49:35 +0000 (08:49 +0000)]
[IndVarSimplify] Add tests for saturating math on IV; NFC

These saturating math ops can be replaced with simple math.

llvm-svn: 362320

5 years ago[NFC][X86] extract-lowbits.ll: add patterns with truncation too
Roman Lebedev [Sun, 2 Jun 2019 08:05:24 +0000 (08:05 +0000)]
[NFC][X86] extract-lowbits.ll: add patterns with truncation too

If we look past truncations of X too eagerly (D62786), we may
end up with 64-bit 'BEXTR', even though 32-bit-one would suffice.

llvm-svn: 362319