OSDN Git Service

android-x86/external-llvm.git
5 years ago[ObjC][ARC] Convert the retainRV marker that is passed as a named
Akira Hatanaka [Wed, 10 Apr 2019 06:20:20 +0000 (06:20 +0000)]
[ObjC][ARC] Convert the retainRV marker that is passed as a named
metadata into a module flag in the auto-upgrader and make the ARC
contract pass read the marker as a module flag.

This is needed to fix a bug where ARC contract wasn't inserting the
retainRV marker when LTO was enabled, which caused objects returned
from a function to be auto-released.

rdar://problem/49464214

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

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

5 years ago[X86] Move the 2 byte VEX optimization for MOV instructions back to the X86AsmParser...
Craig Topper [Wed, 10 Apr 2019 05:43:20 +0000 (05:43 +0000)]
[X86] Move the 2 byte VEX optimization for MOV instructions back to the X86AsmParser::processInstruction where it used to be. Block when {vex3} prefix is present.

Years ago I moved this to an InstAlias using VR128H/VR128L. But now that we support {vex3} pseudo prefix, we need to block the optimization when it is set to match gas behavior.

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

5 years ago[llvm-objdump] Don't print trailing space in dumpBytes
Fangrui Song [Wed, 10 Apr 2019 05:31:21 +0000 (05:31 +0000)]
[llvm-objdump] Don't print trailing space in dumpBytes

In disassembly output, dumpBytes prints a space, followed by a tab
printed by printInstr. Remove the extra space.

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

5 years ago[llvm-objdump] Accept and ignore --wide/-w
Fangrui Song [Wed, 10 Apr 2019 04:46:01 +0000 (04:46 +0000)]
[llvm-objdump] Accept and ignore --wide/-w

This is similar to what we do for llvm-readobj (--wide/-W is for GNU
readelf compatibility).

The test will be added in D60376.

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

5 years ago[Sparc] Fix incorrect MI insertion position for spilling f128.
Jim Lin [Wed, 10 Apr 2019 01:56:32 +0000 (01:56 +0000)]
[Sparc] Fix incorrect MI insertion position for spilling f128.

Summary:
Obviously, new built MI (sethi+add or sethi+xor+add) for constructing large offset
should be inserted before new created MI for storing even register into memory.
So the insertion position should be *StMI instead of II.

before fixed:

std %f0, [%g1+80]
sethi 4, %g1        <<<
add %g1, %sp, %g1   <<< this two instructions should be put before "std %f0, [%g1+80]".
sethi 4, %g1
add %g1, %sp, %g1
std %f2, [%g1+88]

after fixed:

sethi 4, %g1
add %g1, %sp, %g1
std %f0, [%g1+80]
sethi 4, %g1
add %g1, %sp, %g1
std %f2, [%g1+88]

Reviewers: venkatra, jyknight

Reviewed By: jyknight

Subscribers: jyknight, fedor.sergeev, jrtc27, llvm-commits

Tags: #llvm

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

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

5 years ago[X86] Support the EVEX versions vcvt(t)ss2si and vcvt(t)sd2si with the {evex} pseudo...
Craig Topper [Wed, 10 Apr 2019 01:29:59 +0000 (01:29 +0000)]
[X86] Support the EVEX versions vcvt(t)ss2si and vcvt(t)sd2si with the {evex} pseudo prefix in the assembler.

The EVEX versions are ambiguous with the VEX versions based on operands alone so we had explicitly dropped
them from the AsmMatcher table. Unfortunately, when we add them they incorrectly show in the table before
their VEX counterparts. This is different how the prioritization normally works.

To fix this we have to explicitly reject the instructions unless the {evex} prefix has been seen.

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

5 years ago[X86] Add VEX_LIG to scalar VEX/EVEX instructions that were missing it.
Craig Topper [Tue, 9 Apr 2019 23:30:36 +0000 (23:30 +0000)]
[X86] Add VEX_LIG to scalar VEX/EVEX instructions that were missing it.

Scalar VEX/EVEX instructions don't use the L bit and don't look at it for decoding either.
So we should ignore it in our disassembler.

The missing instructions here were found by grepping the raw tablegen class definitions in
the tablegen debug output.

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

5 years ago[LLVM-C] Correct The Current Debug Location Accessors
Robert Widmann [Tue, 9 Apr 2019 22:31:56 +0000 (22:31 +0000)]
[LLVM-C] Correct The Current Debug Location Accessors

Summary: Deprecate the existing accessors for the "current debug location" of an IRBuilder.  The setter could not handle being reset to NULL, and the getter would create bogus metadata if the NULL location was returned.  Provide direct metadata-based accessors instead.

Reviewers: whitequark, deadalnix

Reviewed By: whitequark

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

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

5 years ago[LLVM-C] Add Bindings to Access an Instruction's DebugLoc
Robert Widmann [Tue, 9 Apr 2019 22:27:51 +0000 (22:27 +0000)]
[LLVM-C] Add Bindings to Access an Instruction's DebugLoc

Summary: Provide direct accessors to supplement LLVMSetInstDebugLocation.  In addition, properly accept and return the NULL location.  The old accessors provided no way to do this, so the current debug location cannot currently be cleared.

Reviewers: whitequark, deadalnix

Reviewed By: whitequark

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

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

5 years ago[LLVM-C] Add Section and Symbol Iterator Accessors for Object File Binaries
Robert Widmann [Tue, 9 Apr 2019 21:53:31 +0000 (21:53 +0000)]
[LLVM-C] Add Section and Symbol Iterator Accessors for Object File Binaries

Summary: This brings us to full feature parity with the old API, so I've deprecated it and updated the tests.  I'll do a follow-up patch to do some more cleanup and documentation work in this header.

Reviewers: whitequark, deadalnix

Reviewed By: whitequark

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

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

5 years ago[X86] Fix a dangling StringRef issue introduced in r358029.
Craig Topper [Tue, 9 Apr 2019 21:37:21 +0000 (21:37 +0000)]
[X86] Fix a dangling StringRef issue introduced in r358029.

I was attempting to convert mnemonics to lower case after processing a pseudo prefix. But the ParseOperands just hold a StringRef for tokens so there is no where to allocate the memory.

Add FIXMEs for the lower case issue which also exists in the prefix parsing code.

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

5 years ago[AArch64][GlobalISel] Add isel support for vector G_ICMP and G_ASHR & G_SHL
Amara Emerson [Tue, 9 Apr 2019 21:22:43 +0000 (21:22 +0000)]
[AArch64][GlobalISel] Add isel support for vector G_ICMP and G_ASHR & G_SHL

The selection for G_ICMP is unfortunately not currently importable from SDAG
due to the use of custom SDNodes. To support this, this selection method has an
opcode table which has been generated by a script, indexed by various
instruction properties. Ideally in future we will have a GISel native selection
patterns that we can write in tablegen to improve on this.

For selection of some types we also need support for G_ASHR and G_SHL which are
generated as a result of legalization. This patch also adds support for them,
generating the same code as SelectionDAG currently does.

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

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

5 years ago[AArch64][GlobalISel] Legalize vector G_ICMP.
Amara Emerson [Tue, 9 Apr 2019 21:22:40 +0000 (21:22 +0000)]
[AArch64][GlobalISel] Legalize vector G_ICMP.

Selection support will be coming in a later patch.

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

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

5 years ago[AArch64][GlobalISel] Add legalization for some vector G_SHL and G_ASHR.
Amara Emerson [Tue, 9 Apr 2019 21:22:37 +0000 (21:22 +0000)]
[AArch64][GlobalISel] Add legalization for some vector G_SHL and G_ASHR.

This is needed for some future support for vector ICMP.

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

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

5 years ago[GlobalISel][AArch64] Allow CallLowering to handle types which are normally
Amara Emerson [Tue, 9 Apr 2019 21:22:33 +0000 (21:22 +0000)]
[GlobalISel][AArch64] Allow CallLowering to handle types which are normally
required to be passed as different register types. E.g. <2 x i16> may need to
be passed as a larger <2 x i32> type, so formal arg lowering needs to be able
truncate it back. Likewise, when dealing with returns of these types, they need
to be widened in the appropriate way back.

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

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

5 years ago[InstCombine] Add with.overflow always overflow tests; NFC
Nikita Popov [Tue, 9 Apr 2019 20:02:23 +0000 (20:02 +0000)]
[InstCombine] Add with.overflow always overflow tests; NFC

The uadd and umul cases are currently handled, the usub, sadd, ssub
and smul cases are not. usub, sadd and ssub already have the
necessary ValueTracking support, smul doesn't.

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

5 years ago[AArch64] Add test case to show missed opportunity to remove a shift before tbnz...
Craig Topper [Tue, 9 Apr 2019 19:23:37 +0000 (19:23 +0000)]
[AArch64] Add test case to show missed opportunity to remove a shift before tbnz when the shift has been zero extended from i32 to i64. NFC

This pattern showed up in D60358 and it was suggested I had a test and fix that separately.

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

5 years ago[X86] Add support for {vex2}, {vex3}, and {evex} to the assembler to match gas. Use...
Craig Topper [Tue, 9 Apr 2019 18:45:15 +0000 (18:45 +0000)]
[X86] Add support for {vex2}, {vex3}, and {evex} to the assembler to match gas. Use {evex} to improve the one our 32-bit AVX512 tests.

These can be used to force the encoding used for instructions.

{vex2} will fail if the instruction is not VEX encoded, but otherwise won't do anything since we prefer vex2 when possible. Might need to skip use of the _REV MOV instructions for this too, but I haven't done that yet.

{vex3} will force the instruction to use the 3 byte VEX encoding or fail if there is no VEX form.

{evex} will force the instruction to use the EVEX version or fail if there is no EVEX version.

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

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

5 years ago[DAGCombiner][X86][SystemZ] Canonicalize SSUBO with immediate RHS to SADDO by negatin...
Craig Topper [Tue, 9 Apr 2019 18:33:56 +0000 (18:33 +0000)]
[DAGCombiner][X86][SystemZ] Canonicalize SSUBO with immediate RHS to SADDO by negating the immediate.

This lines up with what we do for regular subtract and it matches up better with X86 assumptions in isel patterns that add with immediate is more canonical than sub with immediate.

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

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

5 years agoRevert "[InstCombine] [InstCombine] Canonicalize (-X s/ Y) to -(X s/ Y)."
Nikita Popov [Tue, 9 Apr 2019 18:32:38 +0000 (18:32 +0000)]
Revert "[InstCombine] [InstCombine] Canonicalize (-X s/ Y) to -(X s/ Y)."

This reverts commit 1383a9168948aabfd827220c9445ce0ce5765800.

sdiv-canonicalize.ll fails after this revision. The fold needs to be
moved outside the branch handling constant operands. However when this
is done there are further test changes, so I'm reverting this in the
meantime.

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

5 years ago[InstCombine] Restructure OptimizeOverflowCheck; NFC
Nikita Popov [Tue, 9 Apr 2019 18:32:28 +0000 (18:32 +0000)]
[InstCombine] Restructure OptimizeOverflowCheck; NFC

Change the code to always handle the unsigned+signed cases together
with the same basic structure for add/sub/mul. The simple folds are
always handled first and then the ValueTracking overflow checks are
used.

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

5 years agoRemove the unit at a time option
Eric Christopher [Tue, 9 Apr 2019 18:29:22 +0000 (18:29 +0000)]
Remove the unit at a time option
Removes the code from opt and the pass manager builder.
The code was unused - even by the C library code that was supposed to set
it and had been removed previously.

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

5 years ago[PDB Docs] Clarifications and fixes for DBI Stream.
Zachary Turner [Tue, 9 Apr 2019 17:38:34 +0000 (17:38 +0000)]
[PDB Docs] Clarifications and fixes for DBI Stream.

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

5 years agoUpdate modulemaps for Analysis/VecFuncs.def.
Kristina Brooks [Tue, 9 Apr 2019 17:05:36 +0000 (17:05 +0000)]
Update modulemaps for Analysis/VecFuncs.def.

Avoid a warning while building modular LLVM due to a new
textual header missing in the modulemap:

TargetLibraryInfo.cpp:1485:6: warning: missing submodule
  'LLVM_Analysis.VecFuncs' [-Wincomplete-umbrella]

Added VecFuncs.def as a textual header in LLVM_Analysis.

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

5 years ago[ValueTracking] Use computeConstantRange() for signed sub overflow determination
Nikita Popov [Tue, 9 Apr 2019 17:01:49 +0000 (17:01 +0000)]
[ValueTracking] Use computeConstantRange() for signed sub overflow determination

This is the same change as D60420 but for signed sub rather than
signed add: Range information is intersected into the known bits
result, allows to detect more no/always overflow conditions.

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

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

5 years ago[TargetLowering] SimplifyDemandedBits - add ISD::INSERT_SUBVECTOR support
Simon Pilgrim [Tue, 9 Apr 2019 16:52:21 +0000 (16:52 +0000)]
[TargetLowering] SimplifyDemandedBits - add ISD::INSERT_SUBVECTOR support

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

5 years ago[InstCombine] [InstCombine] Canonicalize (-X s/ Y) to -(X s/ Y).
Chen Zheng [Tue, 9 Apr 2019 16:34:31 +0000 (16:34 +0000)]
[InstCombine] [InstCombine] Canonicalize (-X s/ Y) to -(X s/ Y).

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

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

5 years agoRevert LIS handling in MachineDCE
Stanislav Mekhanoshin [Tue, 9 Apr 2019 16:13:53 +0000 (16:13 +0000)]
Revert LIS handling in MachineDCE

One of out of tree targets has regressed with this patch. Reverting
it for now and let liveness to be fully reconstructed in case pass
was used after the LIS is created to resolve the regression.

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

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

5 years ago[ValueTracking] Use computeConstantRange() in signed add overflow determination
Nikita Popov [Tue, 9 Apr 2019 16:12:59 +0000 (16:12 +0000)]
[ValueTracking] Use computeConstantRange() in signed add overflow determination

This is D59386 for the signed add case. The computeConstantRange()
result is now intersected into the existing known bits information,
allowing to detect additional no-overflow/always-overflow conditions
(though the latter isn't used yet).

This (finally...) covers the motivating case from D59071.

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

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

5 years ago[InstCombine] prevent possible miscompile with sdiv+negate of vector op
Sanjay Patel [Tue, 9 Apr 2019 15:13:03 +0000 (15:13 +0000)]
[InstCombine] prevent possible miscompile with sdiv+negate of vector op

Similar to:
rL358005

Forego folding arbitrary vector constants to fix a possible miscompile bug.
We can enhance the transform if we do want to handle the more complicated
vector case.

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

5 years ago[DWARF] DWARFDebugLine: replace Sequence::orderByLowPC with orderByHighPC
Fangrui Song [Tue, 9 Apr 2019 15:08:32 +0000 (15:08 +0000)]
[DWARF] DWARFDebugLine: replace Sequence::orderByLowPC with orderByHighPC

In a sorted list of non-overlapping [LowPC,HighPC) ranges, locating an address with
upper_bound on HighPC is simpler than lower_bound on LowPC.

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

5 years ago[InstCombine] add tests for sdiv with negated dividend and constant divisor; NFC
Sanjay Patel [Tue, 9 Apr 2019 14:48:44 +0000 (14:48 +0000)]
[InstCombine] add tests for sdiv with negated dividend and constant divisor; NFC

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

5 years ago[InstCombine] add tests for sdiv-by-int-min; NFC
Sanjay Patel [Tue, 9 Apr 2019 14:27:07 +0000 (14:27 +0000)]
[InstCombine] add tests for sdiv-by-int-min; NFC

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

5 years ago[InstCombine] auto-generate complete test checks; NFC
Sanjay Patel [Tue, 9 Apr 2019 14:27:03 +0000 (14:27 +0000)]
[InstCombine] auto-generate complete test checks; NFC

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

5 years ago[InstCombine] prevent possible miscompile with negate+sdiv of vector op
Sanjay Patel [Tue, 9 Apr 2019 14:09:06 +0000 (14:09 +0000)]
[InstCombine] prevent possible miscompile with negate+sdiv of vector op

// 0 - (X sdiv C)  -> (X sdiv -C)  provided the negation doesn't overflow.

This fold has been around for many years and nobody noticed the potential
vector miscompile from overflow until recently...
So it seems unlikely that there's much demand for a vector sdiv optimization
on arbitrary vector constants, so just limit the matching to splat constants
to avoid the possible bug.

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

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

5 years agogn build: Fix Windows builds after r357797
Nico Weber [Tue, 9 Apr 2019 14:02:02 +0000 (14:02 +0000)]
gn build: Fix Windows builds after r357797

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

5 years ago[InstCombine] add tests/comments for negate+sdiv; NFC
Sanjay Patel [Tue, 9 Apr 2019 13:41:29 +0000 (13:41 +0000)]
[InstCombine] add tests/comments for negate+sdiv; NFC

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

5 years agoNFC: Refactor library-specific mappings of scalar maths functions to their vector...
Nemanja Ivanovic [Tue, 9 Apr 2019 13:21:11 +0000 (13:21 +0000)]
NFC: Refactor library-specific mappings of scalar maths functions to their vector counterparts

This patch factors out mappings of scalar maths functions to their vector
counterparts from TargetLibraryInfo.cpp to a separate VecFuncs.def file. Such
mappings are currently available for Accelerate framework, and SVML library.

This is in support of the follow-up: https://reviews.llvm.org/D59881

Patch by pjeeva01

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

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

5 years ago[InstCombine] add more testcases for canonicalize (-X s/ Y) to -(X s/ Y).
Chen Zheng [Tue, 9 Apr 2019 12:47:29 +0000 (12:47 +0000)]
[InstCombine] add more testcases for canonicalize (-X s/ Y) to -(X s/ Y).

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

5 years ago[TargetLowering] SimplifyDemandedBits - Remove GetDemandedSrcMask lambda. NFCI.
Simon Pilgrim [Tue, 9 Apr 2019 12:29:26 +0000 (12:29 +0000)]
[TargetLowering] SimplifyDemandedBits - Remove GetDemandedSrcMask lambda. NFCI.

An older version of this could return false but now that this always succeeds we can just inline and simplify it.

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

5 years agoImprove hashing for time profiler
Anton Afanasyev [Tue, 9 Apr 2019 12:18:44 +0000 (12:18 +0000)]
Improve hashing for time profiler

Summary:
Use optimized hashing while writing time trace by join two hashes to one.
Used for -ftime-trace option.

Reviewers: rnk, takuto.ikuta

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

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

5 years ago[TargetLowering] SimplifyDemandedBits - call SimplifyDemandedBits in bitcast handling
Simon Pilgrim [Tue, 9 Apr 2019 10:27:59 +0000 (10:27 +0000)]
[TargetLowering] SimplifyDemandedBits - call SimplifyDemandedBits in bitcast handling

When bitcasting from a source op to a larger bitwidth op, split the demanded bits and OR them on top of one another and demand those merged bits in the SimplifyDemandedBits call on the source op.

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

5 years ago[llvm-rtdyld] Fix missing include on MSVC builds.
Simon Pilgrim [Tue, 9 Apr 2019 10:15:10 +0000 (10:15 +0000)]
[llvm-rtdyld] Fix missing include on MSVC builds.

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

5 years ago[DebugInfo] Pass all values in DebugLocEntry's constructor, NFC
David Stenberg [Tue, 9 Apr 2019 10:08:26 +0000 (10:08 +0000)]
[DebugInfo] Pass all values in DebugLocEntry's constructor, NFC

Summary:
With MergeValues() removed, amend DebugLocEntry's constructor so that it
takes multiple values rather than a single, and keep non-fragment values
in OpenRanges, as this allows some cleanup of the code in
buildLocationList().

Reviewers: aprantl, dblaikie, loladiro

Reviewed By: aprantl

Subscribers: hiraditya, llvm-commits

Tags: #debug-info, #llvm

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

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

5 years agoFix Wdocumentation warning. NFCI.
Simon Pilgrim [Tue, 9 Apr 2019 09:38:25 +0000 (09:38 +0000)]
Fix Wdocumentation warning. NFCI.

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

5 years ago[PowerPC] fix trivial typos in comment, NFC
Hiroshi Inoue [Tue, 9 Apr 2019 08:40:02 +0000 (08:40 +0000)]
[PowerPC] fix trivial typos in comment, NFC

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

5 years ago[CMake] Fix accidentally swapped input/output parameters of string(REPLACE) for mingw
Martin Storsjo [Tue, 9 Apr 2019 08:31:25 +0000 (08:31 +0000)]
[CMake] Fix accidentally swapped input/output parameters of string(REPLACE) for mingw

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

5 years ago[CMake] Move configuration of LLVM_CXX_STD to HandleLLVMOptions.cmake
Justin Bogner [Tue, 9 Apr 2019 08:14:32 +0000 (08:14 +0000)]
[CMake] Move configuration of LLVM_CXX_STD to HandleLLVMOptions.cmake

Standalone builds of projects other than llvm itself (lldb, libcxx,
etc) include HandleLLVMOptions but not the top level llvm CMakeLists,
so we need to set this variable here to ensure that it always has a
value.

This should fix the build issues some folks have been seeing.

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

5 years ago[DebugInfo] Remove redundant DebugLocEntry::MergeValues() function, NFC
David Stenberg [Tue, 9 Apr 2019 07:46:09 +0000 (07:46 +0000)]
[DebugInfo] Remove redundant DebugLocEntry::MergeValues() function, NFC

Summary:
The MergeValues() function would try to merge two entries if they shared
the same beginning label. Having the same beginning label means that the
former entry's range would be empty; however, after D55919 we no longer
create entries for empty ranges, so we can no longer land in a situation
where that check in MergeValues would succeed. Instead, the "merging" is
done by keeping the live values from the preceding empty ranges in
OpenRanges, and adding them to the first non-empty range.

Reviewers: aprantl, dblaikie, loladiro

Reviewed By: aprantl

Subscribers: llvm-commits

Tags: #debug-info, #llvm

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

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

5 years ago[X86] Remove check on isAsmParserOnly from EVEX2VEX tablegenerator. NFCI
Craig Topper [Tue, 9 Apr 2019 07:40:19 +0000 (07:40 +0000)]
[X86] Remove check on isAsmParserOnly from EVEX2VEX tablegenerator. NFCI

There are no instructions VEX or EVEX instructions that set this field.

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

5 years ago[X86] Have EVEX2VEX tablegenerator use HasVEX_L and HasEVEX_L2 fields instead of...
Craig Topper [Tue, 9 Apr 2019 07:40:14 +0000 (07:40 +0000)]
[X86] Have EVEX2VEX tablegenerator use HasVEX_L and HasEVEX_L2 fields instead of the composite EVEX_LL field. Remove the EVEX_LL field. NFCI

The composite existed to simplify some other tablegen code and not really in an
important way. Remove the combined field and just calculate the vector size
using two ifs.

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

5 years ago[X86] Use VEX_WIG for VPINSRB/W and VPEXTRB/W to match what is done for EVEX.
Craig Topper [Tue, 9 Apr 2019 07:40:10 +0000 (07:40 +0000)]
[X86] Use VEX_WIG for VPINSRB/W and VPEXTRB/W to match what is done for EVEX.

The instruction's document this as W0 for the VEX encoding. But there's a
footnote mentioning that VEX.W is ignored in 64-bit mode. And the main VEX
encoding description says the VEX.W bit is ignored for instructions that are
equivalent to a legacy SSE instruction that uses REX.W to select a GPR which
would apply here.

By making this match EVEX we can remove a special case of allowing EVEX2VEX to
turn an EVEX.WIG instruction into VEX.W0.

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

5 years ago[X86] Split the VEX_WPrefix in X86Inst tablegen class into 3 separate fields with...
Craig Topper [Tue, 9 Apr 2019 07:40:06 +0000 (07:40 +0000)]
[X86] Split the VEX_WPrefix in X86Inst tablegen class into 3 separate fields with clear meanings.

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

5 years ago[ValueTracking] Use ConstantRange methods; NFC
Nikita Popov [Tue, 9 Apr 2019 07:13:09 +0000 (07:13 +0000)]
[ValueTracking] Use ConstantRange methods; NFC

Switch part of the computeOverflowForSignedAdd() implementation to
use Range.isAllNegative() rather than KnownBits.isNegative() and
similar. They do the same thing, but using the ConstantRange methods
allows dropping the KnownBits variables more easily in D60420.

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

5 years ago[ValueTracking] Explicitly specify intersection type; NFC
Nikita Popov [Tue, 9 Apr 2019 07:13:03 +0000 (07:13 +0000)]
[ValueTracking] Explicitly specify intersection type; NFC

Preparation for D60420.

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

5 years agoInclude omitted word in comment.
Eric Christopher [Tue, 9 Apr 2019 06:35:47 +0000 (06:35 +0000)]
Include omitted word in comment.

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

5 years ago[llvm-objdump] Migrate some functions from std::error_code to Error
Fangrui Song [Tue, 9 Apr 2019 05:41:24 +0000 (05:41 +0000)]
[llvm-objdump] Migrate some functions from std::error_code to Error

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

5 years agoAMDGPU/GlobalISel: Implement call lowering for shaders returning values
Tom Stellard [Tue, 9 Apr 2019 02:26:03 +0000 (02:26 +0000)]
AMDGPU/GlobalISel: Implement call lowering for shaders returning values

Reviewers: arsenm, nhaehnle

Subscribers: kzhuravl, jvesely, wdng, yaxunl, rovka, kristof.beyls, dstuttard, tpr, t-tye, volkan, llvm-commits

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

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

5 years ago[PowerPC] initialize SchedModel according to platform.
Chen Zheng [Tue, 9 Apr 2019 01:25:25 +0000 (01:25 +0000)]
[PowerPC] initialize SchedModel according to platform.
Differential Revision: https://reviews.llvm.org/D60177

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

5 years agohwasan: Enable -hwasan-allow-ifunc by default.
Peter Collingbourne [Tue, 9 Apr 2019 00:25:59 +0000 (00:25 +0000)]
hwasan: Enable -hwasan-allow-ifunc by default.

It's been on in Android for a while without causing problems, so it's time
to make it the default and remove the flag.

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

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

5 years ago[X86] Derive ssmem and sdmem from X86MemOperand. NFCI
Craig Topper [Tue, 9 Apr 2019 00:24:17 +0000 (00:24 +0000)]
[X86] Derive ssmem and sdmem from X86MemOperand. NFCI

This changes the operand type from v4f32/v2f64 to iPTR which seems more correct. But that doesn't seem to do anything other than change the comments in X86GenDAGISel.inc. Probably because we use a ComplexPattern to do the matching so there's no autogenerated code to change.

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

5 years ago[InstCombine] add tests for negate+sdiv; NFC
Sanjay Patel [Mon, 8 Apr 2019 22:55:10 +0000 (22:55 +0000)]
[InstCombine] add tests for negate+sdiv; NFC

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

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

5 years ago[RuntimeDyld] Fix an ambiguous make_unique call.
Lang Hames [Mon, 8 Apr 2019 22:19:05 +0000 (22:19 +0000)]
[RuntimeDyld] Fix an ambiguous make_unique call.

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

5 years ago[RuntimeDyld] Decouple RuntimeDyldChecker from RuntimeDyld.
Lang Hames [Mon, 8 Apr 2019 21:50:48 +0000 (21:50 +0000)]
[RuntimeDyld] Decouple RuntimeDyldChecker from RuntimeDyld.

This will allow RuntimeDyldChecker (and rtdyld-check tests) to test a new JIT
linker: JITLink (https://reviews.llvm.org/D58704).

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

5 years ago[BinaryFormat] Update Mach-O ARM64E CPU subtype and dumping
Shoaib Meenai [Mon, 8 Apr 2019 21:37:08 +0000 (21:37 +0000)]
[BinaryFormat] Update Mach-O ARM64E CPU subtype and dumping

The new value is taken from <mach/machine.h> in the MacOSX10.14 SDK from
Xcode 10.1. Update llvm-objdump and llvm-readobj accordingly.

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

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

5 years ago[InstCombine] peek through fdiv to find a squared sqrt
Sanjay Patel [Mon, 8 Apr 2019 21:23:50 +0000 (21:23 +0000)]
[InstCombine] peek through fdiv to find a squared sqrt

A more general canonicalization between fdiv and fmul would not
handle this case because that would have to be limited by uses
to prevent 2 values from becoming 3 values:
(x/y) * (x/y) --> (x*x) / (y*y)

(But we probably should still have that limited -- but more general --
canonicalization independently of this change.)

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

5 years ago[TargetLowering] SimplifyDemandedBits - use DemandedElts in bitcast handling
Simon Pilgrim [Mon, 8 Apr 2019 20:59:38 +0000 (20:59 +0000)]
[TargetLowering] SimplifyDemandedBits - use DemandedElts in bitcast handling

Be more selective in the SimplifyDemandedBits -> SimplifyDemandedVectorElts bitcast call based on the demanded elts.

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

5 years ago[InstCombine] add extra-use tests for fmul+sqrt; NFC
Sanjay Patel [Mon, 8 Apr 2019 20:37:34 +0000 (20:37 +0000)]
[InstCombine] add extra-use tests for fmul+sqrt; NFC

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

5 years ago[InstCombine] Add more tests for signed saturing math overflow; NFC
Nikita Popov [Mon, 8 Apr 2019 20:02:47 +0000 (20:02 +0000)]
[InstCombine] Add more tests for signed saturing math overflow; NFC

Overflow conditions for sadd.sat and ssub.sat which can be determined
based on constant ranges, but not necessarily known bits.

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

5 years agollvm-undname: Fix more crashes and asserts on invalid inputs
Nico Weber [Mon, 8 Apr 2019 19:46:53 +0000 (19:46 +0000)]
llvm-undname: Fix more crashes and asserts on invalid inputs

For functions whose callers don't check that enough input is present,
add checks at the start of the function that enough input is there and
set Error otherwise.

For functions that return AST objects, return nullptr instead of
incomplete AST objects with nullptr fields if an error occurred during
the function.

Introduce a new function demangleDeclarator() for the sequence
demangleFullyQualifiedSymbolName(); demangleEncodedSymbol() and
use it in the two places that had this sequence. Let this new function
check that ConversionOperatorIdentifiers have a valid TargetType.

Some of the bad inputs found by oss-fuzz, others by inspection.

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

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

5 years ago[X86] Fix a couple lowering functions that called ReplaceAllUsesOfValueWith for the...
Craig Topper [Mon, 8 Apr 2019 19:44:07 +0000 (19:44 +0000)]
[X86] Fix a couple lowering functions that called ReplaceAllUsesOfValueWith for the newly created code and then return SDValue(). Use MERGE_VALUES instead.

Returning SDValue() makes the caller think custom lowering was unsuccessful and then it will fall back to trying to expand the original node. This expanded code will end up with no users and end up being pruned later. But it was useless unnecessary work to create it.

Instead return a MERGE_VALUES with all the results so the caller knows something changed. The caller can handle the replacements.

For one of the cases I had to use UNDEF has a dummy value for a result we know is unused. This should get pruned later.

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

5 years agoAdd LLVM IR debug info support for Fortran COMMON blocks
Adrian Prantl [Mon, 8 Apr 2019 19:13:55 +0000 (19:13 +0000)]
Add LLVM IR debug info support for Fortran COMMON blocks

    COMMON blocks are a feature of Fortran that has no direct analog in C languages, but they are similar to data sections in assembly language programming. A COMMON block is a named area of memory that holds a collection of variables. Fortran subprograms may map the COMMON block memory area to their own, possibly distinct, non-empty list of variables. A Fortran COMMON block might look like the following example.

    COMMON /ALPHA/ I, J

    For this construct, the compiler generates a new scope-like DI construct (!DICommonBlock) into which variables (see I, J above) can be placed. As the common block implies a range of storage with global lifetime, the !DICommonBlock refers to a !DIGlobalVariable. The Fortran variable that comprise the COMMON block are also linked via metadata to offsets within the global variable that stands for the entire common block.

    @alpha_ = common global %alphabytes_ zeroinitializer, align 64, !dbg !27, !dbg !30, !dbg !33
    !14 = distinct !DISubprogram(…)
    !20 = distinct !DICommonBlock(scope: !14, declaration: !25, name: "alpha")
    !25 = distinct !DIGlobalVariable(scope: !20, name: "common alpha", type: !24)
    !27 = !DIGlobalVariableExpression(var: !25, expr: !DIExpression())
    !29 = distinct !DIGlobalVariable(scope: !20, name: "i", file: !3, type: !28)
    !30 = !DIGlobalVariableExpression(var: !29, expr: !DIExpression())
    !31 = distinct !DIGlobalVariable(scope: !20, name: "j", file: !3, type: !28)
    !32 = !DIExpression(DW_OP_plus_uconst, 4)
    !33 = !DIGlobalVariableExpression(var: !31, expr: !32)

    The DWARF generated for this is as follows.

    DW_TAG_common_block:
    DW_AT_name: alpha
    DW_AT_location: @alpha_+0
    DW_TAG_variable:
    DW_AT_name: common alpha
    DW_AT_type: array of 8 bytes
    DW_AT_location: @alpha_+0
    DW_TAG_variable:
    DW_AT_name: i
    DW_AT_type: integer*4
    DW_AT_location: @Alpha+0
    DW_TAG_variable:
    DW_AT_name: j
    DW_AT_type: integer*4
    DW_AT_location: @Alpha+4

Patch by Eric Schweitz!

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

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

5 years agoRevert [ThinLTO] Fix ThinLTOCodegenerator to export llvm.used symbols
Steven Wu [Mon, 8 Apr 2019 18:53:21 +0000 (18:53 +0000)]
Revert [ThinLTO] Fix ThinLTOCodegenerator to export llvm.used symbols

This reverts r357931 (git commit 8b70a5c11e08116955a875b9085433f14737bcaf)

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

5 years ago[ThinLTO] Fix ThinLTOCodegenerator to export llvm.used symbols
Steven Wu [Mon, 8 Apr 2019 18:24:10 +0000 (18:24 +0000)]
[ThinLTO] Fix ThinLTOCodegenerator to export llvm.used symbols

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

This fixes: PR41236
rdar://problem/49293439

Reviewers: tejohnson, pcc, dexonsmith

Reviewed By: tejohnson

Subscribers: mehdi_amini, inglorion, eraman, hiraditya, jkorous, dang, llvm-commits

Tags: #llvm

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

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

5 years ago[JumpThreading] Fix incorrect fold conditional after indirectbr/callbr
Brian M. Rzycki [Mon, 8 Apr 2019 18:20:35 +0000 (18:20 +0000)]
[JumpThreading] Fix incorrect fold conditional after indirectbr/callbr

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

There is potential for miscompiled code emitted from JumpThreading when
analyzing a block with one or more indirectbr or callbr predecessors. The
ProcessThreadableEdges() function incorrectly folds conditional branches
into an unconditional branch.

This patch prevents incorrect branch folding without fully pessimizing
other potential threading opportunities through the same basic block.

This IR shape was manually fed in via opt and is unclear if clang and the
full pass pipeline will ever emit similar code shapes.

Thanks to Matthias Liedtke for the bug report and simplified IR example.

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

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

5 years ago[llvm-objdump] Migrate relocation handling functions from error_code to Error
Fangrui Song [Mon, 8 Apr 2019 16:24:08 +0000 (16:24 +0000)]
[llvm-objdump] Migrate relocation handling functions from error_code to Error

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

5 years ago[llvm-mca][scheduler-stats] Print issued micro opcodes per cycle. NFCI
Andrea Di Biagio [Mon, 8 Apr 2019 16:05:54 +0000 (16:05 +0000)]
[llvm-mca][scheduler-stats] Print issued micro opcodes per cycle. NFCI

It makes more sense to print out the number of micro opcodes that are issued
every cycle rather than the number of instructions issued per cycle.
This behavior is also consistent with the dispatch-stats: numbers from the two
views can now be easily compared.

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

5 years ago[X86][AVX] Add PR34380 shuffle test cases
Simon Pilgrim [Mon, 8 Apr 2019 14:05:42 +0000 (14:05 +0000)]
[X86][AVX] Add PR34380 shuffle test cases

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

5 years ago[x86] make 8-bit shl undesirable
Sanjay Patel [Mon, 8 Apr 2019 13:58:50 +0000 (13:58 +0000)]
[x86] make 8-bit shl undesirable

I was looking at a potential DAGCombiner fix for 1 of the regressions in D60278, and it caused severe regression test pain because x86 TLI lies about the desirability of 8-bit shift ops.

We've hinted at making all 8-bit ops undesirable for the reason in the code comment:

// TODO: Almost no 8-bit ops are desirable because they have no actual
//       size/speed advantages vs. 32-bit ops, but they do have a major
//       potential disadvantage by causing partial register stalls.

...but that leads to massive diffs and exposes all kinds of optimization holes itself.

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

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

5 years agoUse llvm::crc32 instead of crc32. NFC
Eugene Leviant [Mon, 8 Apr 2019 13:40:58 +0000 (13:40 +0000)]
Use llvm::crc32 instead of crc32. NFC

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

5 years ago[InstCombine] remove overzealous assert for shuffles (PR41419)
Sanjay Patel [Mon, 8 Apr 2019 13:28:29 +0000 (13:28 +0000)]
[InstCombine] remove overzealous assert for shuffles (PR41419)

As the TODO indicates, instsimplify could be improved.

Should fix:
https://bugs.llvm.org/show_bug.cgi?id=41419

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

5 years ago[InstCombine][X86] Expand MOVMSK to generic IR (PR39927)
Simon Pilgrim [Mon, 8 Apr 2019 13:17:51 +0000 (13:17 +0000)]
[InstCombine][X86] Expand MOVMSK to generic IR (PR39927)

First step towards removing the MOVMSK intrinsics completely - this patch expands MOVMSK to the pattern:

e.g. PMOVMSKB(v16i8 x):
%cmp = icmp slt <16 x i8> %x, zeroinitializer
%int = bitcast <16 x i8> %cmp to i16
%res = zext i16 %int to i32

Which is correctly handled by ISel and FastIsel (give or take an annoying movzx move....): https://godbolt.org/z/rkrSFW

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

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

5 years agogn build: Merge r357905
Nico Weber [Mon, 8 Apr 2019 12:43:46 +0000 (12:43 +0000)]
gn build: Merge r357905

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

5 years agogn-build: Re-run `git ls-files '*.gn' '*.gni' | xargs llvm/utils/gn/gn.py format`
Nico Weber [Mon, 8 Apr 2019 12:42:37 +0000 (12:42 +0000)]
gn-build: Re-run `git ls-files '*.gn' '*.gni' | xargs llvm/utils/gn/gn.py format`

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

5 years agoAttempt to recommit r357901
Eugene Leviant [Mon, 8 Apr 2019 12:31:12 +0000 (12:31 +0000)]
Attempt to recommit r357901

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

5 years ago[InstCombine] sdiv exact flag fixup.
Chen Zheng [Mon, 8 Apr 2019 12:08:03 +0000 (12:08 +0000)]
[InstCombine] sdiv exact flag fixup.

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

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

5 years ago[llvm-readobj] Use `reinterpret_cast` instead of C-style casting. NFC.
Xing GUO [Mon, 8 Apr 2019 11:48:36 +0000 (11:48 +0000)]
[llvm-readobj] Use `reinterpret_cast` instead of C-style casting. NFC.

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

5 years agoReverting r357901 as fails to build on some of the buildbots
Eugene Leviant [Mon, 8 Apr 2019 11:37:20 +0000 (11:37 +0000)]
Reverting r357901 as fails to build on some of the buildbots

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

5 years ago[Support] Add zlib independent CRC32
Eugene Leviant [Mon, 8 Apr 2019 11:25:48 +0000 (11:25 +0000)]
[Support] Add zlib independent CRC32

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

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

5 years ago[llvm-exegesis] benchmarkMain(): less cryptic error if built w/o libpfm
Roman Lebedev [Mon, 8 Apr 2019 10:50:31 +0000 (10:50 +0000)]
[llvm-exegesis] benchmarkMain(): less cryptic error if built w/o libpfm

Wanted to check if inablility to measure latency of CMOV32rm
is a regression from D60041 / D60138, but unable to do that
because the llvm-exegesis-{8,9} from debian sid fails
with that cryptic, unhelpful error.

I suspect this will be a better error.

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

5 years ago[CMake] Replace LLVM_ENABLE_CXX1Y and friends with LLVM_CXX_STD
Justin Bogner [Mon, 8 Apr 2019 10:19:17 +0000 (10:19 +0000)]
[CMake] Replace LLVM_ENABLE_CXX1Y and friends with LLVM_CXX_STD

Simplify building with particular C++ standards by replacing the
specific "enable standard X" flags with a flag that allows specifying
the standard you want directly.

We preserve compatibility with the existing flags so that anyone with
those flags in existing caches won't break mysteriously.

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

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

5 years ago[llvm-exegesis][X86] Randomize CMOVcc/SETcc OPERAND_COND_CODE CondCodes
Roman Lebedev [Mon, 8 Apr 2019 10:11:00 +0000 (10:11 +0000)]
[llvm-exegesis][X86] Randomize CMOVcc/SETcc OPERAND_COND_CODE CondCodes

Reviewers: courbet, gchatelet

Reviewed By: gchatelet

Subscribers: tschuett, llvm-commits

Tags: #llvm

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

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

5 years agoObject/Minidump: Add support for reading the ModuleList stream
Pavel Labath [Mon, 8 Apr 2019 09:57:29 +0000 (09:57 +0000)]
Object/Minidump: Add support for reading the ModuleList stream

Summary:
The ModuleList stream consists of an integer giving the number of
entries in the list, followed by the list itself. Each entry in the list
describes a module (dynamically loaded objects which were loaded in the
process when it crashed (or when the minidump was generated).

The code for reading the list is relatively straight-forward, with a
single gotcha. Some minidump writers are emitting padding after the
"count" field in order to align the subsequent list on 8 byte boundary
(this depends on how their ModuleList type was defined and the native
alignment of various types on their platform). Fortunately, the minidump
format contains enough redundancy (in the form of the stream length
field in the stream directory), which allows us to detect this situation
and correct it.

This patch just adds the ability to parse the stream. Code for
conversion to/from yaml will come in a follow-up patch.

Reviewers: zturner, amccarth, jhenderson, clayborg

Subscribers: jdoerfert, markmentovai, lldb-commits, llvm-commits

Tags: #llvm

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

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

5 years ago[InstCombine] add more testcases for sdiv exact flag fixup.
Chen Zheng [Mon, 8 Apr 2019 09:19:42 +0000 (09:19 +0000)]
[InstCombine] add more testcases for sdiv exact flag fixup.

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

5 years ago[X86] Make LowerOperationWrapper more robust. Remove now unnecessary ReplaceAllUsesWi...
Craig Topper [Mon, 8 Apr 2019 07:39:17 +0000 (07:39 +0000)]
[X86] Make LowerOperationWrapper more robust. Remove now unnecessary ReplaceAllUsesWith from LowerMSCATTER.

Previously LowerOperationWrapper took the number of results from the original
node and counted that many results from the new node. This was intended to drop
chain operands from FP_TO_SINT lowering that uses X87 with memory operations to
stack temporaries. The final load had an extra chain output that needs to be
ignored.

Unfortunately, it didn't work with scatter which has 2 result operands, the
mask output which is discarded and a chain output. The chain output is the one
that is needed but it comes second and it would be dropped by the previous
logic here. To workaround this we were doing a ReplaceAllUses in the lowering
code so that the generic legalization code wouldn't see any uses to replace
since it had been given the wrong result/type.

After this change we take the LowerOperation result directly if the original
node has one result. This allows us to directly return the chain from scatter
or the load data from the FP_TO_SINT case. When the original node has multiple
results we'll ensure the returned node has the same number and copy them over.
For cases where the original node has multiple results and the new code for some
reason has even more results, MERGE_VALUES can be used to pass only the needed
results.

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

5 years ago[ConstantRange] Delete redundnt {z,s}extOrSelf for multiplication
Fangrui Song [Mon, 8 Apr 2019 07:29:24 +0000 (07:29 +0000)]
[ConstantRange] Delete redundnt {z,s}extOrSelf for multiplication

These calls are redundant because the quotients have the same BitWidth
as MinValue/MaxValue.

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

5 years ago[InstCombine] add testcases for sdiv exact flag fixing - NFC.
Chen Zheng [Mon, 8 Apr 2019 05:49:15 +0000 (05:49 +0000)]
[InstCombine] add testcases for sdiv exact flag fixing - NFC.

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

5 years ago[InstCombine]add testcase for sdiv canonicalizetion - NFC
Chen Zheng [Mon, 8 Apr 2019 03:07:32 +0000 (03:07 +0000)]
[InstCombine]add testcase for sdiv canonicalizetion - NFC

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

5 years ago[X86] Split floating point tests out of atomic-mi.ll into atomic-fp.ll. Add avx and...
Craig Topper [Mon, 8 Apr 2019 01:54:27 +0000 (01:54 +0000)]
[X86] Split floating point tests out of atomic-mi.ll into atomic-fp.ll. Add avx and avx512f command lines. NFC

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

5 years ago[X86] Add avx and avx512f command lines to atomic-non-integer.ll. NFC
Craig Topper [Mon, 8 Apr 2019 01:54:24 +0000 (01:54 +0000)]
[X86] Add avx and avx512f command lines to atomic-non-integer.ll. NFC

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