OSDN Git Service

android-x86/external-llvm.git
5 years agoRevert "[ValueTracking] Improve isKnowNonZero for Ints"
Nikita Popov [Wed, 8 May 2019 14:50:01 +0000 (14:50 +0000)]
Revert "[ValueTracking] Improve isKnowNonZero for Ints"

This reverts commit 3b137a495686bd6018d115ea82fb8bb7718349fd.

As reported in https://reviews.llvm.org/D60846, this is causing
miscompiles.

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

5 years ago[Support] Fix unit test for fs::is_local
Petar Jovanovic [Wed, 8 May 2019 14:42:13 +0000 (14:42 +0000)]
[Support] Fix unit test for fs::is_local

Close the temporary file after the test is done using it.
If it is not closed and the file was created on NFS, it will cause the test
to fail. The problem happens in the cleanup process afterwards. It first
tries to delete the file but it is not really deleted. Afterwards, the
program fails to delete the directory containing the file, causing the whole
test to fail.

Patch by Milos Stojanovic.

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

5 years ago[ADT] SmallVector::set_size - fix Wdocumentation. NFCI.
Simon Pilgrim [Wed, 8 May 2019 13:47:17 +0000 (13:47 +0000)]
[ADT] SmallVector::set_size - fix Wdocumentation. NFCI.

Also fixes a Wshadow warning on MSVC.

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

5 years agogn build: Merge r360151
Nico Weber [Wed, 8 May 2019 13:41:01 +0000 (13:41 +0000)]
gn build: Merge r360151

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

5 years ago[NFC]Fix British English -> American English issues
James Henderson [Wed, 8 May 2019 13:30:48 +0000 (13:30 +0000)]
[NFC]Fix British English -> American English issues

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

5 years ago[llvm-objcopy] Improve error message for unrecognised archive member
James Henderson [Wed, 8 May 2019 13:28:58 +0000 (13:28 +0000)]
[llvm-objcopy] Improve error message for unrecognised archive member

Prior to this patch, llvm-objcopy's error messages for archives with
unsupported members only mentioned the archive name, not the member
name, making them unhelpful. This change improves it by approximately
following GNU objcopy's error message syntax of
"<archive name>(<member name>): <problem>".

Reviewed by: grimar

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

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

5 years agoFix whitespace mismatches. NFCI.
Simon Pilgrim [Wed, 8 May 2019 13:02:32 +0000 (13:02 +0000)]
Fix whitespace mismatches. NFCI.

Tabs are not our friends.

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

5 years ago[LegalizeDAG] Assert non-power-of-2 load/store op splits are in range. NFCI.
Simon Pilgrim [Wed, 8 May 2019 11:22:10 +0000 (11:22 +0000)]
[LegalizeDAG] Assert non-power-of-2 load/store op splits are in range. NFCI.

Fixes static analyzer undefined/out-of-range shift warnings.

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

5 years ago[Hexagon] Fix cppcheck reduce variable scope warnings. NFCI.
Simon Pilgrim [Wed, 8 May 2019 11:02:46 +0000 (11:02 +0000)]
[Hexagon] Fix cppcheck reduce variable scope warnings. NFCI.

Also fixes a static analyzer "Value stored to 'S2' during its initialization is never read" warning.

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

5 years ago[MCA] Don't add a name to the default code region.
Andrea Di Biagio [Wed, 8 May 2019 11:00:43 +0000 (11:00 +0000)]
[MCA] Don't add a name to the default code region.

This is done in preparation for a patch that fixes PR41523.

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

5 years agoARM: disallow SP as Rn for Thumb2 TST & TEQ instructions
Tim Northover [Wed, 8 May 2019 10:59:08 +0000 (10:59 +0000)]
ARM: disallow SP as Rn for Thumb2 TST & TEQ instructions

Using SP in this position is unpredictable in ARMv7. CMP and CMN are not
affected, and of course v8 relaxes this requirement, but that's handled
elsewhere.

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

5 years ago[VPlan] Fix "value never used" static analyzer warning. NFCI.
Simon Pilgrim [Wed, 8 May 2019 10:52:26 +0000 (10:52 +0000)]
[VPlan] Fix "value never used" static analyzer warning. NFCI.

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

5 years ago[MCA] Slightly refactor CodeRegion.h. NFCI
Andrea Di Biagio [Wed, 8 May 2019 10:44:05 +0000 (10:44 +0000)]
[MCA] Slightly refactor CodeRegion.h. NFCI

Also, use a SmallVector instead of a std::vector for the code region.

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

5 years agoR600InstrInfo.cpp - Add getTransSwizzle assert for the swizzle op index. NFCI.
Simon Pilgrim [Wed, 8 May 2019 10:39:56 +0000 (10:39 +0000)]
R600InstrInfo.cpp - Add getTransSwizzle assert for the swizzle op index. NFCI.

Fixes static analyzer undefined value warning.

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

5 years ago[MCA] Remove dead assignment. NFC
Andrea Di Biagio [Wed, 8 May 2019 10:28:56 +0000 (10:28 +0000)]
[MCA] Remove dead assignment. NFC

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

5 years ago[SIMode] Fix typo in Status constructor
Simon Pilgrim [Wed, 8 May 2019 10:24:22 +0000 (10:24 +0000)]
[SIMode] Fix typo in Status constructor

As noted in https://www.viva64.com/en/b/0629/ (Snippet No. 36) and the scan-build CI reports (https://llvm.org/reports/scan-build/report-SIModeRegister.cpp-Status-1-1.html#EndPath), rL348754 introduced a typo in the Status constructor due to argument variable names shadowing the member variable names.

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

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

5 years ago[DebugInfo] Fix use-after-move warning. NFCI.
Simon Pilgrim [Wed, 8 May 2019 10:09:57 +0000 (10:09 +0000)]
[DebugInfo] Fix use-after-move warning. NFCI.

Don't rely on DWARFAbbreviationDeclarationSet::extract cleaning the struct up for reuse - the analyzers don't like it.

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

5 years agoFix cppcheck operator precedence warning. NFCI.
Simon Pilgrim [Wed, 8 May 2019 10:07:34 +0000 (10:07 +0000)]
Fix cppcheck operator precedence warning. NFCI.

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

5 years ago[llvm-objcopy] Add --prefix-alloc-sections
James Henderson [Wed, 8 May 2019 09:49:35 +0000 (09:49 +0000)]
[llvm-objcopy] Add --prefix-alloc-sections

This patch adds support for --prefix-alloc-sections, which adds a prefix
to every allocated section names.

It adds a prefix after renaming section names by --rename-section as GNU
objcopy does.

Fixes PR41266: https://bugs.llvm.org/show_bug.cgi?id=41266

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

Patch by Seiya Nuta.

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

5 years ago[SCCP] Fix crash when trying to constant-fold terminators multiple times.
Florian Hahn [Wed, 8 May 2019 09:09:54 +0000 (09:09 +0000)]
[SCCP] Fix crash when trying to constant-fold terminators multiple times.

If we fold a branch/switch to an unconditional branch to another dead block we
replace the branch with unreachable, to avoid attempting to fold the
unconditional branch.

Reviewers: davide, efriedma, mssimpso, jdoerfert

Reviewed By: jdoerfert

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

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

5 years ago[CMake] Install import libraries
Martin Storsjo [Wed, 8 May 2019 08:37:34 +0000 (08:37 +0000)]
[CMake] Install import libraries

Simplify the cmake logic to install both runtime and import
libraries (treated as ARCHIVE), as the later are needed to link
against llvm.

Patch by Julien Schueller!

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

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

5 years ago[NFC][PowerPC] Add test for store combine optimization.
QingShan Zhang [Wed, 8 May 2019 07:56:59 +0000 (07:56 +0000)]
[NFC][PowerPC] Add test for store combine optimization.

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

5 years ago[CodeGenPrepare] Don't split the store if it is volatile
QingShan Zhang [Wed, 8 May 2019 07:32:12 +0000 (07:32 +0000)]
[CodeGenPrepare] Don't split the store if it is volatile
We shouldn't split the store when it is volatile.

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

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

5 years ago[llvm-objcopy] - Fix for "Bug 41775 - SymbolTableSection::addSymbol - shadow variable...
George Rimar [Wed, 8 May 2019 07:31:05 +0000 (07:31 +0000)]
[llvm-objcopy] - Fix for "Bug 41775 - SymbolTableSection::addSymbol - shadow variable names"

This is a fix for https://bugs.llvm.org/show_bug.cgi?id=41775,

Problem is in the final line:
Size += this->EntrySize;

I checked that we do not actually need it in this place,
since we always call removeSectionReferences which
calls removeSymbols which updates the Size.

But it worth to keep it, that allows to relax the dependencies.

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

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

5 years ago[NFC] Add a static function to do the endian check
QingShan Zhang [Wed, 8 May 2019 07:21:37 +0000 (07:21 +0000)]
[NFC] Add a static function to do the endian check
Add a new function to do the endian check, as I will commit another patch later, which will also need the endian check.

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

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

5 years ago[llvm] Avoid div by 0 when updating profile weights.
Mircea Trofin [Wed, 8 May 2019 03:57:25 +0000 (03:57 +0000)]
[llvm] Avoid div by 0 when updating profile weights.

Reviewers: davidxl

Reviewed By: davidxl

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

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

5 years ago[ValueTracking] Improve isKnowNonZero for Ints
Dan Robertson [Wed, 8 May 2019 02:25:08 +0000 (02:25 +0000)]
[ValueTracking] Improve isKnowNonZero for Ints

Improve isKnownNonZero for integers in order to improve cttz
optimizations.

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

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

5 years ago[Support] Add error handling to sys::Process::getPageSize().
Lang Hames [Wed, 8 May 2019 02:11:07 +0000 (02:11 +0000)]
[Support] Add error handling to sys::Process::getPageSize().

This patch changes the return type of sys::Process::getPageSize to
Expected<unsigned> to account for the fact that the underlying syscalls used to
obtain the page size may fail (see below).

For clients who use the page size as an optimization only this patch adds a new
method, getPageSizeEstimate, which calls through to getPageSize but discards
any error returned and substitues a "reasonable" page size estimate estimate
instead. All existing LLVM clients are updated to call getPageSizeEstimate
rather than getPageSize.

On Unix, sys::Process::getPageSize is implemented in terms of getpagesize or
sysconf, depending on which macros are set. The sysconf call is documented to
return -1 on failure. On Darwin getpagesize is implemented in terms of sysconf
and may also fail (though the manpage documentation does not mention this).
These failures have been observed in practice when highly restrictive sandbox
permissions have been applied. Without this patch, the result is that
getPageSize returns -1, which wreaks havoc on any subsequent code that was
assuming a sane page size value.

<rdar://problem/41654857>

Reviewers: dblaikie, echristo

Subscribers: kristina, llvm-commits

Tags: #llvm

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

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

5 years ago[Tests] Expand coverage of small memset zero idioms
Philip Reames [Tue, 7 May 2019 23:48:42 +0000 (23:48 +0000)]
[Tests] Expand coverage of small memset zero idioms

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

5 years ago[COFF] Use COFF stubs for extern_weak functions
Reid Kleckner [Tue, 7 May 2019 23:06:21 +0000 (23:06 +0000)]
[COFF] Use COFF stubs for extern_weak functions

Summary:
A COFF stub indirects the reference to a symbol through memory. A
.refptr.$sym global variable pointer is created to refer to $sym.
Typically mingw uses these for external global variable declarations,
but we can use them for weak function declarations as well.

Updates the dso_local classification to add a special case for
extern_weak symbols on COFF in both clang and LLVM.

Fixes PR37598

Reviewers: smeenai, mstorsjo

Subscribers: hiraditya, cfe-commits, llvm-commits

Tags: #clang, #llvm

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

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

5 years ago[ValueTracking] add logic for known-never-nan with minnum/maxnum
Sanjay Patel [Tue, 7 May 2019 22:58:31 +0000 (22:58 +0000)]
[ValueTracking] add logic for known-never-nan with minnum/maxnum

From the LangRef: "Returns NaN only if both operands are NaN."

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

5 years agoReapply r360194 "[JITLink] Add support for MachO .alt_entry atoms." with fixes.
Lang Hames [Tue, 7 May 2019 22:56:40 +0000 (22:56 +0000)]
Reapply r360194 "[JITLink] Add support for MachO .alt_entry atoms." with fixes.

This patch modifies MachOAtomGraphBuilder to use setLayoutNext rather than
addEdge, and fixes a bug in the section layout algorithm that could result in
atoms appearing more than once in the section ordering (which resulted in those
atoms being assigned invalid addresses during layout).

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

5 years agoRegenerate test case again after last revert
Reid Kleckner [Tue, 7 May 2019 22:40:40 +0000 (22:40 +0000)]
Regenerate test case again after last revert

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

5 years agoDelete test cases added in r360162 that should have been deleted in r360190
Reid Kleckner [Tue, 7 May 2019 22:35:56 +0000 (22:35 +0000)]
Delete test cases added in r360162 that should have been deleted in r360190

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

5 years ago[MemorySSA] Fix CHECKs in test. [NFC]
Alina Sbirlea [Tue, 7 May 2019 22:26:52 +0000 (22:26 +0000)]
[MemorySSA] Fix CHECKs in test. [NFC]

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

5 years agoRevert r360194 "[JITLink] Add support for MachO .alt_entry atoms."
Lang Hames [Tue, 7 May 2019 22:19:29 +0000 (22:19 +0000)]
Revert r360194 "[JITLink] Add support for MachO .alt_entry atoms."

The testcase is asserting on some bots - reverting while I investigate.

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

5 years ago[AMDGPU] Check MI bundles for hazards
Austin Kerbow [Tue, 7 May 2019 22:12:15 +0000 (22:12 +0000)]
[AMDGPU] Check MI bundles for hazards

Summary: GCNHazardRecognizer fails to identify hazards that are in and around bundles. This patch allows the hazard recognizer to consider bundled instructions in both scheduler and hazard recognizer mode. We ignore “bundledness” for the purpose of detecting hazards and examine the instructions individually.

Reviewers: arsenm, msearles, rampitec

Reviewed By: rampitec

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

Tags: #llvm

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

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

5 years ago[CodeGen] Rename DEBUG_TYPE for default hazard recognizer.
Austin Kerbow [Tue, 7 May 2019 22:09:04 +0000 (22:09 +0000)]
[CodeGen] Rename DEBUG_TYPE for default hazard recognizer.

Summary:
The DEBUG_TYPE of the default hazard recognizer should be updated to
match the DEBUG_TYPE of the machine-scheduler pass.

Reviewers: rampitec

Reviewed By: rampitec

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

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

5 years ago[InstSimplify] add tests for minnum/maxnum and NaN; NFC
Sanjay Patel [Tue, 7 May 2019 21:50:09 +0000 (21:50 +0000)]
[InstSimplify] add tests for minnum/maxnum and NaN; NFC

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

5 years ago[CMake] Detecting python modules should be cached
Chris Bieneman [Tue, 7 May 2019 21:46:55 +0000 (21:46 +0000)]
[CMake] Detecting python modules should be cached

Summary: This requres exec-ing python, which in a trace I ran of the CMake re-configure time took ~2% of the reconfigure time.

Reviewers: phosek, smeenai, compnerd

Subscribers: mgorny, llvm-commits

Tags: #llvm

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

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

5 years ago[JITLink] Add support for MachO .alt_entry atoms.
Lang Hames [Tue, 7 May 2019 21:35:14 +0000 (21:35 +0000)]
[JITLink] Add support for MachO .alt_entry atoms.

The MachO .alt_entry directive is applied to a symbol to indicate that it is
locked (in terms of address layout and liveness) to its predecessor atom. I.e.
it is an alternate entry point, at a fixed offset, for the previous atom.

This patch updates MachOAtomGraphBuilder to check for the .alt_entry flag on
symbols and add a corresponding LayoutNext edge to the atom-graph. It also
updates MachOAtomGraphBuilder_x86_64 to generalize handling of the
X86_64_RELOC_SUBTRACTOR relocation: previously either the minuend or
subtrahend of the subtraction had to be the same as the atom being fixed up,
now it is only necessary for the minuend or subtrahend to be locked (via any
chain of alt_entry directives) to the atom being fixed up.

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

5 years agoRevert "[OpenMP][Clang] Support for target math functions"
Jonas Devlieghere [Tue, 7 May 2019 21:08:15 +0000 (21:08 +0000)]
Revert "[OpenMP][Clang] Support for target math functions"

This commit appears to be breaking stage-2 builds on GreenDragon. The
OpenMP wrappers for cmath and math.h are copied into the root of the
resource directory and cause a cyclic dependency in module 'Darwin':
Darwin -> std -> Darwin. This blows up when CMake is testing for modules
support and breaks all stage 2 module builds, including the ThinLTO bot
and all LLDB bots.

CMake Error at cmake/modules/HandleLLVMOptions.cmake:497 (message):
  LLVM_ENABLE_MODULES is not supported by this compiler

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

5 years agorevert r360162 as it breaks most of the buildbots
Kostya Serebryany [Tue, 7 May 2019 20:57:11 +0000 (20:57 +0000)]
revert r360162 as it breaks most of the buildbots

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

5 years ago[ConstantRange] Simplify makeGNWR implementation; NFC
Nikita Popov [Tue, 7 May 2019 20:34:46 +0000 (20:34 +0000)]
[ConstantRange] Simplify makeGNWR implementation; NFC

Compute results in more direct ways, avoid subset intersect
operations. Extract the core code for computing mul nowrap ranges
into separate static functions, so they can be reused.

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

5 years ago[InstCombine] Add new combine to add folding
Robert Lougher [Tue, 7 May 2019 19:36:41 +0000 (19:36 +0000)]
[InstCombine] Add new combine to add folding

(X | C1) + C2 --> (X | C1) ^ C1 iff (C1 == -C2)

I verified the correctness using Alive:
https://rise4fun.com/Alive/YNV

This transform enables the following transform that already exists in
instcombine:

(X | Y) ^ Y --> X & ~Y

As a result, the full expected transform is:

(X | C1) + C2 --> X & ~C1 iff (C1 == -C2)

There already exists the transform in the sub case:

(X | Y) - Y --> X & ~Y

However this does not trigger in the case where Y is constant due to an earlier
transform:

X - (-C) --> X + C

With this new add fold, both the add and sub constant cases are handled.

Patch by Chris Dawson.

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

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

5 years agoMake sure that the DAG combiner doesn't merge stores that we explicitly
Eric Christopher [Tue, 7 May 2019 19:25:34 +0000 (19:25 +0000)]
Make sure that the DAG combiner doesn't merge stores that we explicitly
asked not be greater than preferred vector width for the vectorizer.
Test for both 128 and 256 with a skylake architecture.

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

5 years ago[InstCombine] allow sinking fneg operands through an FP min/max
Sanjay Patel [Tue, 7 May 2019 18:58:07 +0000 (18:58 +0000)]
[InstCombine] allow sinking fneg operands through an FP min/max

Fundamentally/generally, we should not have to rely on bailouts/crippling of
folds. In this particular case, I think we always recognize the inverted
predicate min/max pattern, so there should not be any loss of optimization.
Codegen looks better because we are eliminating an fneg.

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

5 years ago[CommandLine] Allow Options to specify multiple OptionCategory's.
Don Hinton [Tue, 7 May 2019 18:57:01 +0000 (18:57 +0000)]
[CommandLine] Allow Options to specify multiple OptionCategory's.

Summary:
It's not uncommon for separate components to share common
Options, e.g., it's common for related Passes to share Options in
addition to the Pass specific ones.

With this change, components can use OptionCategory's to simply help
output even if some of the options are shared.

Reviewed By: MaskRay

Tags: #llvm

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

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

5 years ago[Tests] Yet more combination of tests for unordered.atomic memset
Philip Reames [Tue, 7 May 2019 17:45:52 +0000 (17:45 +0000)]
[Tests] Yet more combination of tests for unordered.atomic memset

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

5 years agoDebug Info: Support address space attributes on rvalue references.
Adrian Prantl [Tue, 7 May 2019 17:42:38 +0000 (17:42 +0000)]
Debug Info: Support address space attributes on rvalue references.

DWARF5, 2.12 20ff says that

Any debugging information entry representing a pointer or reference
type [may have a DW_AT_address_class attribute].

The existing code (https://reviews.llvm.org/D29670) seems to take a
quite literal interpretation of that wording. I don't see a reason why
an rvalue reference isn't a reference type in the spirit of that
paragraph. This patch allows rvalue references to also have address
spaces.

rdar://problem/50511483

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

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

5 years ago[PowerPC][NFC] Update build-vector-tests.ll using utils/update_llc_test_checks.py
Jinsong Ji [Tue, 7 May 2019 17:29:44 +0000 (17:29 +0000)]
[PowerPC][NFC] Update build-vector-tests.ll using utils/update_llc_test_checks.py

build-vector-tests.ll is a huge testcase, it is hard to maintain: eg:
any fundamental changes might need to update hundreds of lines. We should
leverage the script to maintain it.

This patch simply run utils/update_llc_test_checks.py on it. There
should be no missing test points.

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

5 years agoGuard __builtin_available() with __has_builtin to support older host compilers.
Adrian Prantl [Tue, 7 May 2019 17:10:27 +0000 (17:10 +0000)]
Guard __builtin_available() with __has_builtin to support older host compilers.

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

5 years agoRegenerate test to try and fix buildbots
Simon Pilgrim [Tue, 7 May 2019 17:10:10 +0000 (17:10 +0000)]
Regenerate test to try and fix buildbots

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

5 years ago[DAGCombiner] Avoid creating large tokenfactors in visitTokenFactor
Florian Hahn [Tue, 7 May 2019 16:47:27 +0000 (16:47 +0000)]
[DAGCombiner] Avoid creating large tokenfactors in visitTokenFactor

When simplifying TokenFactors, we potentially iterate over all
operands of a large number of TokenFactors. This causes quadratic
compile times in some cases and the large token factors cause additional
scalability problems elsewhere.

This patch adds some limits to the number of nodes explored for the
cases mentioned above.

Reviewers: niravd, spatel, craig.topper

Reviewed By: niravd

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

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

5 years ago[InstCombine] add tests for FP min/max with negated operands; NFC
Sanjay Patel [Tue, 7 May 2019 16:25:43 +0000 (16:25 +0000)]
[InstCombine] add tests for FP min/max with negated operands; NFC

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

5 years agoAvoid use-after-move warnings by using swap instead. NFCI.
Simon Pilgrim [Tue, 7 May 2019 15:45:00 +0000 (15:45 +0000)]
Avoid use-after-move warnings by using swap instead. NFCI.

Swap should be as quick in these cases, and leaves the original variables in a known (empty) state.

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

5 years ago[DebugInfo@O2][LoopVectorize] pr39024: Vectorized code linenos step through loop...
Orlando Cazalet-Hyams [Tue, 7 May 2019 15:37:38 +0000 (15:37 +0000)]
[DebugInfo@O2][LoopVectorize] pr39024: Vectorized code linenos step through loop even after completion

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

The bug reports that a vectorized loop is stepped through 4 times and each step through the loop seemed to show a different path. I found two problems here:

A) An incorrect line number on a preheader block (for.body.preheader) instruction causes a step into the loop before it begins.
B) Instructions in the middle block have different line numbers which give the impression of another iteration.

In this patch I give all of the middle block instructions the line number of the scalar loop latch terminator branch. This seems to provide the smoothest debugging experience because the vectorized loops will always end on this line before dropping into the scalar loop. To solve problem A I have altered llvm::SplitBlockPredecessors to accommodate loop header blocks.

Reviewers: samsonov, vsk, aprantl, probinson, anemet, hfinkel

Reviewed By: hfinkel

Subscribers: bjope, jmellorcrummey, hfinkel, gbedwell, hiraditya, zzheng, llvm-commits

Tags: #llvm, #debug-info

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

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

5 years ago[JITLink] Fix some copy/paste related typos in a test case.
Lang Hames [Tue, 7 May 2019 15:35:43 +0000 (15:35 +0000)]
[JITLink] Fix some copy/paste related typos in a test case.

Several X86_64_RELOC_SUBTRACTOR tests for subtrahend handling were incorrectly
labeled as tests for kinds of minuend handling.

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

5 years ago[SCEV] Add explicit representations of umin/smin
Keno Fischer [Tue, 7 May 2019 15:28:47 +0000 (15:28 +0000)]
[SCEV] Add explicit representations of umin/smin

Summary:
Currently we express umin as `~umax(~x, ~y)`. However, this becomes
a problem for operands in non-integral pointer spaces, because `~x`
is not something we can compute for `x` non-integral. However, since
comparisons are generally still allowed, we are actually able to
express `umin(x, y)` directly as long as we don't try to express is
as a umax. Support this by adding an explicit umin/smin representation
to SCEV. We do this by factoring the existing getUMax/getSMax functions
into a new function that does all four. The previous two functions were
largely identical.

Reviewed By: sanjoy
Differential Revision: https://reviews.llvm.org/D50167

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

5 years agoFix local shadow variable warning. NFCI.
Simon Pilgrim [Tue, 7 May 2019 14:56:34 +0000 (14:56 +0000)]
Fix local shadow variable warning. NFCI.

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

5 years agoPrecommit tests for or/add transform. NFC.
Robert Lougher [Tue, 7 May 2019 14:14:29 +0000 (14:14 +0000)]
Precommit tests for or/add transform. NFC.

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

5 years ago[PowerPC] Use the two-constant NR algorithm for refining estimates
Nemanja Ivanovic [Tue, 7 May 2019 13:48:03 +0000 (13:48 +0000)]
[PowerPC] Use the two-constant NR algorithm for refining estimates

The single-constant algorithm produces infinities on a lot of denormal values.
The precision of the two-constant algorithm is actually sufficient across the
range of denormals. We will switch to that algorithm for now to avoid the
infinities on denormals. In the future, we will re-evaluate the algorithm to
find the optimal one for PowerPC.

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

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

5 years ago[llvm-objdump] - Print relocation record in a GNU format.
George Rimar [Tue, 7 May 2019 13:14:18 +0000 (13:14 +0000)]
[llvm-objdump] - Print relocation record in a GNU format.

This fixes the https://bugs.llvm.org/show_bug.cgi?id=41355.

Previously with -r we printed relocation section name instead of the target section name.
It was like this: "RELOCATION RECORDS FOR [.rel.text]"
Now it is: "RELOCATION RECORDS FOR [.text]"

Also when relocation target section has more than one relocation section,
we did not combine the output. Now we do.

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

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

5 years agogn build: Merge r360116
Nico Weber [Tue, 7 May 2019 13:07:23 +0000 (13:07 +0000)]
gn build: Merge r360116

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

5 years agogn build: Run `git ls-files '*.gn' '*.gni' | xargs llvm/utils/gn/gn.py format`
Nico Weber [Tue, 7 May 2019 13:02:18 +0000 (13:02 +0000)]
gn build: Run `git ls-files '*.gn' '*.gni' | xargs llvm/utils/gn/gn.py format`

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

5 years ago[llvm-exegesis] BenchmarkRunner::runConfiguration(): write small snippet to memory
Roman Lebedev [Tue, 7 May 2019 12:28:08 +0000 (12:28 +0000)]
[llvm-exegesis] BenchmarkRunner::runConfiguration(): write small snippet to memory

It was previously writing this temporary snippet to file,
then reading it back, but leaving the tmp file in place.
This is both unefficient, and results in huge garbage pileup
in /tmp.

One would have thought it would have been caught during D60317..

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

5 years ago[yaml2obj] - Allow setting st_value explicitly for Symbol.
George Rimar [Tue, 7 May 2019 12:10:51 +0000 (12:10 +0000)]
[yaml2obj] - Allow setting st_value explicitly for Symbol.

In some cases it is useful to explicitly set symbol's st_name value.
For example, I am using it in a patch for LLD to remove the broken
binary from a test case and replace it with a YAML test.

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

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

5 years agoRevert "[TableGen] Fix a typo"
Krasimir Georgiev [Tue, 7 May 2019 11:39:35 +0000 (11:39 +0000)]
Revert "[TableGen] Fix a typo"

Summary:
This reverts commit r360106.

The revisioin causes llvm-tblgen to hang while generating info for
RISCV.td. The root cause might be in the RISCV.td definition but I don't
know enough about this to investigate further.

Command that starts hangning after r360106:
`llvm-build/bin/llvm-tblgen -I llvm/include -I llvm/tools/clang/include -I llvm/lib/Target/RISCV -gen-instr-info llvm/lib/Target/RISCV/RISCV.td`

Reviewers: sammccall, yan_luo, craig.topper, gribozavr

Reviewed By: gribozavr

Subscribers: PkmX, llvm-commits

Tags: #llvm

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

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

5 years ago[ARM GlobalISel] Widen G_SELECT operands
Diana Picus [Tue, 7 May 2019 11:39:30 +0000 (11:39 +0000)]
[ARM GlobalISel] Widen G_SELECT operands

...except for the condition operand.

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

5 years ago[X86][AVX] Fold concat(packus(),packus()) -> packus(concat(),concat()) (PR34773)
Simon Pilgrim [Tue, 7 May 2019 11:17:39 +0000 (11:17 +0000)]
[X86][AVX] Fold concat(packus(),packus()) -> packus(concat(),concat()) (PR34773)

Basic "revectorization" combine, we can probably do more opcodes here but it can be a tricky cost-benefit depending on where the subvectors came from - but this case helps shuffle combining.

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

5 years agoFixed "Value stored to 'Opc' is never read" warning. NFCI.
Simon Pilgrim [Tue, 7 May 2019 11:09:16 +0000 (11:09 +0000)]
Fixed "Value stored to 'Opc' is never read" warning. NFCI.

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

5 years ago[X86] Reduce scope of variables where possible. NFCI.
Simon Pilgrim [Tue, 7 May 2019 10:50:11 +0000 (10:50 +0000)]
[X86] Reduce scope of variables where possible. NFCI.

Fixes cppcheck warnings.

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

5 years ago[ARM GlobalISel] Widen G_INTTOPTR/G_PTRTOINT
Diana Picus [Tue, 7 May 2019 10:48:01 +0000 (10:48 +0000)]
[ARM GlobalISel] Widen G_INTTOPTR/G_PTRTOINT

We actually have a couple of G_PTRTOINT to s8 when building clang, so
we should do something about them.

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

5 years agoFix uninitialized variable warning. NFCI.
Simon Pilgrim [Tue, 7 May 2019 10:30:22 +0000 (10:30 +0000)]
Fix uninitialized variable warning. NFCI.

This also fixes a scan-build "array subscript is undefined" warning.

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

5 years ago[ARM GlobalISel] Widen G_GEP index operand
Diana Picus [Tue, 7 May 2019 10:11:57 +0000 (10:11 +0000)]
[ARM GlobalISel] Widen G_GEP index operand

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

5 years agoTest commit access
Orlando Cazalet-Hyams [Tue, 7 May 2019 09:30:55 +0000 (09:30 +0000)]
Test commit access

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

5 years ago[llvm-exegesis] InstructionBenchmark::writeYamlTo(): don't forget to flush()
Roman Lebedev [Tue, 7 May 2019 09:21:13 +0000 (09:21 +0000)]
[llvm-exegesis] InstructionBenchmark::writeYamlTo(): don't forget to flush()

This *APPEARS* to fix a *very* infuriating issue of Yaml's being corrupted,
partially written, truncated. Or at least i'm not seeing the issue
on a new benchmark sweep.

The issue is somewhat rare, happens maybe once in 1000 benchmarks.
Which means there are up to hundreds of broken benchmarks
for a full x86 sweep in a single mode.

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

5 years agoAMDGPU: Verify that SOP2/SOPC instructions have at most one immediate operand
Nicolai Haehnle [Tue, 7 May 2019 09:19:09 +0000 (09:19 +0000)]
AMDGPU: Verify that SOP2/SOPC instructions have at most one immediate operand

Summary:
No test case because I don't know of a way to trigger this, but I
accidentally caused this to fail while working on a different change.

Change-Id: I8015aa447fe27163cc4e4902205a203bd44bf7e3

Reviewers: arsenm, rampitec

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

Tags: #llvm

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

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

5 years ago[FastISel][X86] If selectFNeg fails, fall back to SelectionDAG not treating it as...
Craig Topper [Tue, 7 May 2019 04:25:24 +0000 (04:25 +0000)]
[FastISel][X86] If selectFNeg fails, fall back to SelectionDAG not treating it as an fsub.

Summary:
If fneg lowering for fsub -0.0, x fails we currently fall back to treating it as an fsub. This has different behavior for nans than the xor with sign bit trick we normally try to do. On X86, the xor trick for double fails fast-isel in 32-bit mode with sse2 due to 64 bit integer types not being available. With -O2 we would always use an xorpd for this case. If we use subsd, this creates an observable behavior difference between -O0 and -O2. So fall back to SelectionDAG if we can't fast-isel it, that way SelectionDAG will use the xorpd.

I believe this patch is restoring the behavior prior to r345295 from last October. This was missed then because our fast isel case in 32-bit mode aborted fast-isel earlier for another reason. But I've added new tests to cover that.

Reviewers: andrew.w.kaylor, cameron.mcinally, spatel, efriedma

Reviewed By: cameron.mcinally

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

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

5 years ago[WebAssembly] Add more test coverage for reloctions against section symbols
Sam Clegg [Tue, 7 May 2019 03:53:16 +0000 (03:53 +0000)]
[WebAssembly] Add more test coverage for reloctions against section symbols

The only known user of this relocation type and symbol type is
the debug info sections, but we were not testing the `--relocatable`
output path.

This change adds a minimal test case to cover relocations against
section symbols includes `--relocatable` output.

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

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

5 years ago[DebugInfo] Delete TypedDINodeRef
Fangrui Song [Tue, 7 May 2019 02:06:37 +0000 (02:06 +0000)]
[DebugInfo] Delete TypedDINodeRef

TypedDINodeRef<T> is a redundant wrapper of Metadata * that is actually a T *.

Accordingly, change DI{Node,Scope,Type}Ref uses to DI{Node,Scope,Type} * or their const variants.
This allows us to delete many resolve() calls that clutter the code.

Reviewed By: rnk

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

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

5 years ago[SanitizerCoverage] Use different module ctor names for trace-pc-guard and inline...
Fangrui Song [Tue, 7 May 2019 01:39:37 +0000 (01:39 +0000)]
[SanitizerCoverage] Use different module ctor names for trace-pc-guard and inline-8bit-counters

Fixes the main issue in PR41693

When both modes are used, two functions are created:
`sancov.module_ctor`, `sancov.module_ctor.$LastUnique`, where
$LastUnique is the current LastUnique counter that may be different in
another module.

`sancov.module_ctor.$LastUnique` belongs to the comdat group of the same
name (due to the non-null third field of the ctor in llvm.global_ctors).

    COMDAT group section [    9] `.group' [sancov.module_ctor] contains 6 sections:
       [Index]    Name
       [   10]   .text.sancov.module_ctor
       [   11]   .rela.text.sancov.module_ctor
       [   12]   .text.sancov.module_ctor.6
       [   13]   .rela.text.sancov.module_ctor.6
       [   23]   .init_array.2
       [   24]   .rela.init_array.2

    # 2 problems:
    # 1) If sancov.module_ctor in this module is discarded, this group
    # has a relocation to a discarded section. ld.bfd and gold will
    # error. (Another issue: it is silently accepted by lld)
    # 2) The comdat group has an unstable name that may be different in
    # another translation unit. Even if the linker allows the dangling relocation
    # (with --noinhibit-exec), there will be many undesired .init_array entries
    COMDAT group section [   25] `.group' [sancov.module_ctor.6] contains 2 sections:
       [Index]    Name
       [   26]   .init_array.2
       [   27]   .rela.init_array.2

By using different module ctor names, the associated comdat group names
will also be different and thus stable across modules.

Reviewed By: morehouse, phosek

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

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

5 years ago[TableGen] Fix a typo
Yan Luo [Tue, 7 May 2019 01:07:46 +0000 (01:07 +0000)]
[TableGen] Fix a typo

Check "Big" instead of "Small" in the second condition.

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

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

5 years agoRefactor UnaryOperator class
Cameron McInally [Tue, 7 May 2019 00:10:12 +0000 (00:10 +0000)]
Refactor UnaryOperator class

The UnaryOperator class was originally placed in llvm/IR/Instructions.h, with the other UnaryInstructions. However, I'm now thinking that it makes more sense for it to live in llvm/IR/InstrTypes.h, with BinaryOperator. It is more similar to BinaryOperator than any of the other UnaryInstructions.

NFCI

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

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

5 years ago[X86] Use extended vector register classes in getRegForInlineAsmConstraint to support...
Craig Topper [Mon, 6 May 2019 23:57:42 +0000 (23:57 +0000)]
[X86] Use extended vector register classes in getRegForInlineAsmConstraint to support x/y/zmm16-31 when the type is mismatched.

The FR32/FR64/VR128/VR256 register classes don't contain the upper 16 registers. For most cases we use the default implementation which will find any register class that contains the register in question if the VT is legal for the register class. But if the VT is i32 or i64, we won't find a matching register class and will instead up in the code modified in this patch.

If the requested register is x/y/zmm16-31 we weren't returning a register class that contains those registers and will hit an assertion in the caller.

To fix this, I've changed to use the extended register class instead. I don't believe we need a subtarget check to see if avx512 is enabled. The default implementation just pick whatever register class it finds first. I checked and we currently pick FR32X for XMM0 with an f32 type using the default implementation regardless of whether avx512 is enabled. So I assume its it is ok to do the same for i32.

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

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

5 years agoFix bug in getCompleteTypeIndex in codeview debug info
Amy Huang [Mon, 6 May 2019 23:37:03 +0000 (23:37 +0000)]
Fix bug in getCompleteTypeIndex in codeview debug info

Summary:
When there are multiple instances of a forward decl record type, only the first one is emitted with a type index, because
the type is added to a map with a null type index. Avoid this by reordering so that forward decl types aren't added to the map.

Reviewers: rnk

Subscribers: aprantl, hiraditya, arphaman, llvm-commits

Tags: #llvm

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

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

5 years ago[ARM] Glue register copies to tail calls.
Eli Friedman [Mon, 6 May 2019 23:21:59 +0000 (23:21 +0000)]
[ARM] Glue register copies to tail calls.

This generally follows what other targets do. I don't completely
understand why the special case for tail calls existed in the first
place; even when the code was committed in r105413, call lowering didn't
work in the way described in the comments.

Stack protector lowering breaks if the register copies are not glued to
a tail call: we have to insert the stack protector check before the tail
call, and we choose the location based on the assumption that all
physical register dependencies of a tail call are adjacent to the tail
call. (See FindSplitPointForStackProtector.) This is sort of fragile,
but I don't see any reason to break that assumption.

I'm guessing nobody has seen this before just because it's hard to
convince the scheduler to actually schedule the code in a way that
breaks; even without the glue, the only computation that could actually
be scheduled after the register copies is the computation of the call
address, and the scheduler usually prefers to schedule that before the
copies anyway.

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

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

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

5 years ago[FastISel] Pass the fneg input operand to hasTrivialKill in FastISel::selectFNeg.
Craig Topper [Mon, 6 May 2019 23:09:09 +0000 (23:09 +0000)]
[FastISel] Pass the fneg input operand to hasTrivialKill in FastISel::selectFNeg.

We're trying to calculate the kill flag for OpReg which is the input so we need to pass the input here.

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

5 years ago[X86] Add test case to show that we don't set the kill flag properly for fast isel...
Craig Topper [Mon, 6 May 2019 23:08:17 +0000 (23:08 +0000)]
[X86] Add test case to show that we don't set the kill flag properly for fast isel handling of fneg.

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

5 years ago[AMDGPU] gfx1010 verifier changes
Stanislav Mekhanoshin [Mon, 6 May 2019 22:49:45 +0000 (22:49 +0000)]
[AMDGPU] gfx1010 verifier changes

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

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

5 years ago[AMDGPU] gfx1010: prefer V_MUL_LO_U32 over V_MUL_LO_I32
Stanislav Mekhanoshin [Mon, 6 May 2019 22:27:05 +0000 (22:27 +0000)]
[AMDGPU] gfx1010: prefer V_MUL_LO_U32 over V_MUL_LO_I32

GFX10 deprecates v_mul_lo_i32 instruction, so choose u32 form for
all targets.

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

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

5 years ago[Tests] Add tests for optimized lowerings of element.unordered.atomic memset/memcmove...
Philip Reames [Mon, 6 May 2019 22:25:59 +0000 (22:25 +0000)]
[Tests] Add tests for optimized lowerings of element.unordered.atomic memset/memcmove/memcopy

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

5 years ago[Tests] Rename tests before adding new ones
Philip Reames [Mon, 6 May 2019 22:16:55 +0000 (22:16 +0000)]
[Tests] Rename tests before adding new ones

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

5 years ago[Tests] Autogen a test in advance of updates
Philip Reames [Mon, 6 May 2019 22:12:07 +0000 (22:12 +0000)]
[Tests] Autogen a test in advance of updates

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

5 years agoFix pr33010, a 2 year old crashing regression
Philip Reames [Mon, 6 May 2019 22:09:31 +0000 (22:09 +0000)]
Fix pr33010, a 2 year old crashing regression

The problem was that we were creating a CMOV64rr <TargetFrameIndex>, <TargetFrameIndex>.  The entire point of a TFI is that address code is not generated, so there's no way to legalize/lower this.  Instead, simply prevent it's creation.

Arguably, we shouldn't be using *Target*FrameIndices in StatepointLowering at all, but that's a much deeper change.

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

5 years ago[X86] Add more test cases for fast-isel handling of fneg.
Craig Topper [Mon, 6 May 2019 22:04:26 +0000 (22:04 +0000)]
[X86] Add more test cases for fast-isel handling of fneg.

The fneg double case is falling back to a subsd in 32-bit mode if you write a test that doesn't trigger a fast-isel abort on the return value.

The subsd lowering has different behavior with respect to nans than using an xor. This is inconsisent with what we would do in SelectionDAG
and can lead to differences between -O0 and -O2.

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

5 years ago[AMDGPU] gfx1010 memory legalizer
Stanislav Mekhanoshin [Mon, 6 May 2019 21:57:02 +0000 (21:57 +0000)]
[AMDGPU] gfx1010 memory legalizer

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

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

5 years agoRevert "Re-commit r357452: SimplifyCFG SinkCommonCodeFromPredecessors: Also sink...
Jordan Rupprecht [Mon, 6 May 2019 21:55:05 +0000 (21:55 +0000)]
Revert "Re-commit r357452: SimplifyCFG SinkCommonCodeFromPredecessors: Also sink function calls without used results (PR41259)"

This reverts r357452 (git commit 21eb771dcb5c11d7500fa6ad551c97a921997f05).

This was causing strange optimization-related test failures on an internal test. Will followup with more details offline.

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

5 years ago[X86] Remove the suffix on vcvt[u]si2ss/sd register variants in assembly printing.
Craig Topper [Mon, 6 May 2019 21:39:51 +0000 (21:39 +0000)]
[X86] Remove the suffix on vcvt[u]si2ss/sd register variants in assembly printing.

We require d/q suffixes on the memory form of these instructions to disambiguate the memory size.
We don't require it on the register forms, but need to support parsing both with and without it.

Previously we always printed the d/q suffix on the register forms, but it's redundant and
inconsistent with gcc and objdump.

After this patch we should support the d/q for parsing, but not print it when its unneeded.

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

5 years ago[AArch64] Default to SEH exception handling on MinGW
Martin Storsjo [Mon, 6 May 2019 21:18:15 +0000 (21:18 +0000)]
[AArch64] Default to SEH exception handling on MinGW

The SEH implementation is pretty mature at this point.

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

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