OSDN Git Service

android-x86/external-llvm.git
7 years ago[ARM] Recommit the glueless lowering of addc/adde in Thumb1,
Artyom Skrobov [Tue, 21 Mar 2017 18:39:41 +0000 (18:39 +0000)]
[ARM] Recommit the glueless lowering of addc/adde in Thumb1,
including the amended (no UB anymore) fix for adding/subtracting -2147483648.

This reverts r298328 "[ARM] Revert r297443 and r297820."
and partially reverts r297842 "Revert "[Thumb1] Fix the bug when adding/subtracting -2147483648""

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

7 years agoDelete eol-style:native SVN property.
Zachary Turner [Tue, 21 Mar 2017 18:31:08 +0000 (18:31 +0000)]
Delete eol-style:native SVN property.

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

7 years agoUse ProfileSummary:getProfileCount to get ScaledCount for ModuleSummary
Dehao Chen [Tue, 21 Mar 2017 17:22:35 +0000 (17:22 +0000)]
Use ProfileSummary:getProfileCount to get ScaledCount for ModuleSummary

Summary: ModuleSummary should use the standard interface of ProfileSummary::getProfileCount.

Reviewers: eraman, tejohnson

Reviewed By: tejohnson

Subscribers: tejohnson, mehdi_amini, llvm-commits

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

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

7 years agoRevert 298388 and 298389 because they broke some AMDGPU tests.
Adrian Prantl [Tue, 21 Mar 2017 17:14:30 +0000 (17:14 +0000)]
Revert 298388 and 298389 because they broke some AMDGPU tests.

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

7 years agoRecommit r298282 with fixes for memory allocation/deallocation
Krzysztof Parzyszek [Tue, 21 Mar 2017 17:09:27 +0000 (17:09 +0000)]
Recommit r298282 with fixes for memory allocation/deallocation

[Hexagon] Recognize polynomial-modulo loop idiom again

Regain the ability to recognize loops calculating polynomial modulo
operation. This ability has been lost due to some changes in the
preceding optimizations. Add code to preprocess the IR to a form
that the pattern matching code can recognize.

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

7 years agoFix RST docs AttributeList heading underline
Reid Kleckner [Tue, 21 Mar 2017 17:05:00 +0000 (17:05 +0000)]
Fix RST docs AttributeList heading underline

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

7 years agoAMDGPU: Buffer descriptor changes for GFX9
Marek Olsak [Tue, 21 Mar 2017 17:00:39 +0000 (17:00 +0000)]
AMDGPU: Buffer descriptor changes for GFX9

Reviewers: arsenm

Subscribers: qcolombet, kzhuravl, wdng, nhaehnle, yaxunl, tony-tye, dstuttard, tpr

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

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

7 years agoAMDGPU: Always use VGPR indexing on GFX9
Marek Olsak [Tue, 21 Mar 2017 17:00:32 +0000 (17:00 +0000)]
AMDGPU: Always use VGPR indexing on GFX9

Reviewers: arsenm

Subscribers: kzhuravl, wdng, nhaehnle, yaxunl, tony-tye, dstuttard, tpr

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

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

7 years ago[Hexagon] Add -march=hexagon to a testcase
Krzysztof Parzyszek [Tue, 21 Mar 2017 16:59:40 +0000 (16:59 +0000)]
[Hexagon] Add -march=hexagon to a testcase

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

7 years agoRename AttributeSet to AttributeList
Reid Kleckner [Tue, 21 Mar 2017 16:57:19 +0000 (16:57 +0000)]
Rename AttributeSet to AttributeList

Summary:
This class is a list of AttributeSetNodes corresponding the function
prototype of a call or function declaration. This class used to be
called ParamAttrListPtr, then AttrListPtr, then AttributeSet. It is
typically accessed by parameter and return value index, so
"AttributeList" seems like a more intuitive name.

Rename AttributeSetImpl to AttributeListImpl to follow suit.

It's useful to rename this class so that we can rename AttributeSetNode
to AttributeSet later. AttributeSet is the set of attributes that apply
to a single function, argument, or return value.

Reviewers: sanjoy, javed.absar, chandlerc, pete

Reviewed By: pete

Subscribers: pete, jholewinski, arsenm, dschuff, mehdi_amini, jfb, nhaehnle, sbc100, void, llvm-commits

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

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

7 years agoAMDGPU: Fix not including v2i16/v2f16 in register class
Matt Arsenault [Tue, 21 Mar 2017 16:42:50 +0000 (16:42 +0000)]
AMDGPU: Fix not including v2i16/v2f16 in register class

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

7 years agoDon't compose DWARF expressions with multiple subregisters.
Adrian Prantl [Tue, 21 Mar 2017 16:37:39 +0000 (16:37 +0000)]
Don't compose DWARF expressions with multiple subregisters.

If a register location can only be described by a complex expression
(i.e., multiple subregisters) it doesn't safely compose with another
complex expression. For example, it is not possible to apply a
DW_OP_deref operation to multiple DW_OP_pieces.

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

7 years agoDwarfExpression: Defer emitting DWARF register operations
Adrian Prantl [Tue, 21 Mar 2017 16:37:35 +0000 (16:37 +0000)]
DwarfExpression: Defer emitting DWARF register operations
until the rest of the expression is known.

This is still an NFC refactoring in preparation of a subsequent bugfix.

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

7 years agoAMDGPU: Fix asserting on 0 dmask for image intrinsics
Matt Arsenault [Tue, 21 Mar 2017 16:32:17 +0000 (16:32 +0000)]
AMDGPU: Fix asserting on 0 dmask for image intrinsics

Fold these to undef during lowering so users get eliminated.

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

7 years agoAMDGPU: Convert image intrinsic uses in tests
Matt Arsenault [Tue, 21 Mar 2017 16:24:12 +0000 (16:24 +0000)]
AMDGPU: Convert image intrinsic uses in tests

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

7 years agoDAG: Fold bitcast/extract_vector_elt of undef to undef
Matt Arsenault [Tue, 21 Mar 2017 16:20:16 +0000 (16:20 +0000)]
DAG: Fold bitcast/extract_vector_elt of undef to undef

Fixes not eliminating store when intrinsic is lowered to undef.

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

7 years agoFix shufpd test name.
Simon Pilgrim [Tue, 21 Mar 2017 15:12:53 +0000 (15:12 +0000)]
Fix shufpd test name.

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

7 years ago[ARM] [Assembler] Support negative immediates for A32, T32 and T16
Sanne Wouda [Tue, 21 Mar 2017 14:59:17 +0000 (14:59 +0000)]
[ARM] [Assembler] Support negative immediates for A32, T32 and T16

Summary:
To support negative immediates for certain arithmetic instructions, the
instruction is converted to the inverse instruction with a negated (or inverted)
immediate. For example, "ADD r0, r1, #FFFFFFFF" cannot be encoded as an ADD
instruction.  However, "SUB r0, r1, #1" is equivalent.

These conversions are different from instruction aliases.  An alias maps
several assembler instructions onto one encoding.  A conversion, however, maps
an *invalid* instruction--e.g. with an immediate that cannot be represented in
the encoding--to a different (but equivalent) instruction.

Several instructions with negative immediates were being converted already, but
this was not systematically tested, nor did it cover all instructions.

This patch implements all possible substitutions for ARM, Thumb1 and
Thumb2 assembler and adds tests.  It also adds a feature flag
(-mattr=+no-neg-immediates) to turn these substitutions off.  This is
helpful for users who want their code to assemble to exactly what they
wrote.

Reviewers: t.p.northover, rovka, samparker, javed.absar, peter.smith, rengolin

Reviewed By: javed.absar

Subscribers: aadg, aemerson, llvm-commits

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

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

7 years agoTest commit access
Yi Kong [Tue, 21 Mar 2017 14:49:19 +0000 (14:49 +0000)]
Test commit access

Remove some trailing whitespaces.

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

7 years ago[InstCombine] auto-generate better checks; NFC
Sanjay Patel [Tue, 21 Mar 2017 14:04:44 +0000 (14:04 +0000)]
[InstCombine] auto-generate better checks; NFC

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

7 years ago[x86] use PMOVMSK for vector-sized equality comparisons
Sanjay Patel [Tue, 21 Mar 2017 13:50:33 +0000 (13:50 +0000)]
[x86] use PMOVMSK for vector-sized equality comparisons

We could do better by splitting any oversized type into whatever vector size the target supports,
but I left that for future work if it ever comes up. The motivating case is memcmp() calls on 16-byte
structs, so I think we can wire that up with a TLI hook that feeds into this.

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

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

7 years ago[X86][AVX] Tests showing missing SHUFPD + ZERO lowering
Simon Pilgrim [Tue, 21 Mar 2017 13:30:40 +0000 (13:30 +0000)]
[X86][AVX] Tests showing missing SHUFPD + ZERO lowering

This lowers to SHUFPD if the input is zeroinitializer but not with a demanded elts optimized build vector.

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

7 years ago[AMDGPU] Iterative scheduling infrastructure + minimal registry scheduler
Valery Pykhtin [Tue, 21 Mar 2017 13:15:46 +0000 (13:15 +0000)]
[AMDGPU] Iterative scheduling infrastructure + minimal registry scheduler

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

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

7 years ago[GlobalISel] Fix shufflevector tests
Volkan Keles [Tue, 21 Mar 2017 13:12:59 +0000 (13:12 +0000)]
[GlobalISel] Fix shufflevector tests

clang-lld-x86_64-2stage fails because of the order
of the instructions. `CHECK-DAG` directives should
fix the problem.

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

7 years ago[ADMGPU] SDWA peephole optimization pass.
Sam Kolton [Tue, 21 Mar 2017 12:51:34 +0000 (12:51 +0000)]
[ADMGPU] SDWA peephole optimization pass.

Summary:
First iteration of SDWA peephole.

This pass tries to combine several instruction into one SDWA instruction. E.g. it converts:
'''
    V_LSHRREV_B32_e32 %vreg0, 16, %vreg1
    V_ADD_I32_e32 %vreg2, %vreg0, %vreg3
    V_LSHLREV_B32_e32 %vreg4, 16, %vreg2
'''
Into:
'''
   V_ADD_I32_sdwa %vreg4, %vreg1, %vreg3 dst_sel:WORD_1 dst_unused:UNUSED_PAD src0_sel:WORD_1 src1_sel:DWORD
'''

Pass structure:
    1. Iterate over machine instruction in basic block and try to apply "SDWA patterns" to each of them. SDWA patterns match machine instruction into either source or destination SDWA operand. E.g. ''' V_LSHRREV_B32_e32 %vreg0, 16, %vreg1''' is matched to source SDWA operand '''%vreg1 src_sel:WORD_1'''.
    2. Iterate over found SDWA operands and find instruction that could be potentially coverted into SDWA. E.g. for source SDWA operand potential instruction are all instruction in this basic block that uses '''%vreg0'''
    3. Iterate over all potential instructions and check if they can be converted into SDWA.
    4. Convert instructions to SDWA.

This review contains basic implementation of SDWA peephole pass. This pass requires additional testing fot both correctness and performance (no performance testing done).
There are several ways this pass can be improved:
    1. Make this pass work on whole function not only basic block. As I can see this can be done right now without changes to pass.
    2. Introduce more SDWA patterns
    3. Introduce mnemonics to limit when SDWA patterns should apply

Reviewers: vpykhtin, alex-t, arsenm, rampitec

Subscribers: wdng, nhaehnle, mgorny

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

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

7 years ago[DebugInfo][X86] Teach Optimize LEAs pass to handle debug values
Andrea Di Biagio [Tue, 21 Mar 2017 11:36:21 +0000 (11:36 +0000)]
[DebugInfo][X86] Teach Optimize LEAs pass to handle debug values

This patch fixes an issue in the Optimize LEAs pass where redundant LEAs were
not removed because they were being used by debug values. The debug values are
now ignored when determining whether LEAs are redundant.

For now the debug values for the redundant LEAs are marked as undefined,
effectively lost. The intention is for a follow up patch which will attempt to
preserve the debug values where possible.

Patch by Andrew Ng.

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

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

7 years agoNFC. InstCombiner::visitFAdd extract LHSIntVal/RHSIntVal local variables
Artur Pilipenko [Tue, 21 Mar 2017 11:32:15 +0000 (11:32 +0000)]
NFC. InstCombiner::visitFAdd extract LHSIntVal/RHSIntVal local variables

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

7 years ago[GlobalISel] Move isTriviallyDead to Utils. NFC.
Volkan Keles [Tue, 21 Mar 2017 10:47:35 +0000 (10:47 +0000)]
[GlobalISel] Move isTriviallyDead to Utils. NFC.

Make it accessible by the targets to avoid code duplication.

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

7 years ago[DAGTypeLegalizer] Handle widening truncate to vector of i1.
Jonas Paulsson [Tue, 21 Mar 2017 10:24:14 +0000 (10:24 +0000)]
[DAGTypeLegalizer]  Handle widening truncate to vector of i1.

Previously, PromoteIntRes_TRUNCATE() did not handle the case where
the operand needs widening, which resulted in llvm_unreachable().

This patch adds the needed handling, along with a test case.

Review: Eli Friedman, Simon Pilgrim.
https://reviews.llvm.org/D31077

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

7 years ago[ConstantFolding] Fix to prevent constant folding having to repeatedly scan operands...
David Green [Tue, 21 Mar 2017 10:17:39 +0000 (10:17 +0000)]
[ConstantFolding] Fix to prevent constant folding having to repeatedly scan operands. NFCI

After the loop unroll threshold was increased in r295538, very
large constant expressions can be created. This prevents them
from having to be recursively scanned, leading to a compile
time blow-up.

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

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

7 years ago[GlobalISel] Translate shufflevector
Volkan Keles [Tue, 21 Mar 2017 08:44:13 +0000 (08:44 +0000)]
[GlobalISel] Translate shufflevector

Reviewers: qcolombet, aditya_nandakumar, t.p.northover, javed.absar, ab, dsanders

Reviewed By: javed.absar

Subscribers: dberris, rovka, llvm-commits, kristof.beyls

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

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

7 years ago[APFloat] Tag the fltSemantic getter functions with LLVM_READNONE.
Craig Topper [Tue, 21 Mar 2017 07:18:00 +0000 (07:18 +0000)]
[APFloat] Tag the fltSemantic getter functions with LLVM_READNONE.

This gives about an 8k reduction in the size of the opt binary on my local x86-64 build.

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

7 years ago[APInt] Add LLVM_READONLY to some methods.
Craig Topper [Tue, 21 Mar 2017 06:19:46 +0000 (06:19 +0000)]
[APInt] Add LLVM_READONLY to some methods.

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

7 years ago[SystemZ] Don't drop MO flags in foldMemoryOperandImpl()
Jonas Paulsson [Tue, 21 Mar 2017 05:49:40 +0000 (05:49 +0000)]
[SystemZ]  Don't drop MO flags in foldMemoryOperandImpl()

The def operand of the new LG/LD should have the old def operands
flags and subreg index.

New test: test/CodeGen/SystemZ/fold-memory-op-impl.ll

Review: Ulrich Weigand

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

7 years agoFix evaluation of LLVM_DEFINITIONS
Serge Pavlov [Tue, 21 Mar 2017 04:03:24 +0000 (04:03 +0000)]
Fix evaluation of LLVM_DEFINITIONS

CMake variable LLVM_DEFINITIONS collects preprocessor definitions provided
for host compiler that builds llvm components. A function
add_llvm_definitions was introduced in AddLLVMDefinitions.cmake to keep
track of these definitions and was intended to be a replacement for CMake
command add_definitions. Actually in many cases add_definitions is still
used and the content of LLVM_DEFINITIONS is not actual now. On the other
hand the current version of CMake allows getting set of definitions in a
more convenient way. This fix implements evaluation of the variable by
reading corresponding cmake property.

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

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

7 years agoRevert "[Hexagon] Recognize polynomial-modulo loop idiom again"
Vitaly Buka [Tue, 21 Mar 2017 00:59:51 +0000 (00:59 +0000)]
Revert "[Hexagon] Recognize polynomial-modulo loop idiom again"

Fix memory leaks on check-llvm tests detected by Asan.

This reverts commit r298282.

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

7 years ago[ARM] Revert r297443 and r297820.
Eli Friedman [Tue, 21 Mar 2017 00:26:39 +0000 (00:26 +0000)]
[ARM] Revert r297443 and r297820.

The glueless lowering of addc/adde in Thumb1 has known serious
miscompiles (see https://reviews.llvm.org/D31081), and r297820
causes an infinite loop for certain constructs.  It's not
clear when they will be fixed, so let's just take them out
of the tree for now.

(I resolved a small conflict with r297453.)

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

7 years ago[Support] Fill the file_status struct with link count.
Zachary Turner [Mon, 20 Mar 2017 23:55:20 +0000 (23:55 +0000)]
[Support] Fill the file_status struct with link count.

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

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

7 years agoAdd a function to MD5 a file's contents.
Zachary Turner [Mon, 20 Mar 2017 23:33:18 +0000 (23:33 +0000)]
Add a function to MD5 a file's contents.

In doing so, clean up the MD5 interface a little.  Most
existing users only care about the lower 8 bytes of an MD5,
but for some users that care about the upper and lower,
there wasn't a good interface.  Furthermore, consumers
of the MD5 checksum were required to handle endianness
details on their own, so it seems reasonable to abstract
this into a nicer interface that just gives you the right
value.

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

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

7 years ago[ARM] Fix PR32130: Handle promotion of zero sized constants.
Vadzim Dambrouski [Mon, 20 Mar 2017 22:59:57 +0000 (22:59 +0000)]
[ARM] Fix PR32130: Handle promotion of zero sized constants.

The special case of zero sized values was previously not handled correctly.
This patch handles this by not promoting if the size is zero.

Patch by Tim Neumann.

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

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

7 years ago[x86] add tests for setcc of i128/i256; NFC
Sanjay Patel [Mon, 20 Mar 2017 22:15:40 +0000 (22:15 +0000)]
[x86] add tests for setcc of i128/i256; NFC

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

7 years agoInstCombine: Check source value precision when reducing cast intrinsic
Matt Arsenault [Mon, 20 Mar 2017 21:59:24 +0000 (21:59 +0000)]
InstCombine: Check source value precision when reducing cast intrinsic

Missed this check when porting from the libcall version.

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

7 years agoGlobalISel: add implicit defs & uses when mutating an instruction.
Tim Northover [Mon, 20 Mar 2017 21:58:23 +0000 (21:58 +0000)]
GlobalISel: add implicit defs & uses when mutating an instruction.

Otherwise a scheduler might do bad things to the code we produce.

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

7 years agoReplace uses of DwarfExpression::addMachineReg* with addMachineRegExpression
Adrian Prantl [Mon, 20 Mar 2017 21:35:09 +0000 (21:35 +0000)]
Replace uses of DwarfExpression::addMachineReg* with addMachineRegExpression
and mark the methods as protected.

Besides reducing the surface area of DwarfExpression, this is in
preparation for an upcoming bugfix in the DwarfExpression
implementation, for which it will be necessary to defer emitting
register operations until the rest of the expression is known.

NFC

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

7 years agoMake implementation details in DwarfExpression protected. (NFC)
Adrian Prantl [Mon, 20 Mar 2017 21:34:19 +0000 (21:34 +0000)]
Make implementation details in DwarfExpression protected. (NFC)

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

7 years ago[Fuchsia] Use %gs for ABI slots under -mcmodel=kernel
Evgeniy Stepanov [Mon, 20 Mar 2017 20:35:37 +0000 (20:35 +0000)]
[Fuchsia] Use %gs for ABI slots under -mcmodel=kernel

Make x86_64-fuchsia targets under -mcmodel=kernel use %gs rather
than %fs to access ABI slots for stack-protector and safe-stack

Patch by Roland McGrath.

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

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

7 years ago[SCEV] Fix trip multiple calculation
Eli Friedman [Mon, 20 Mar 2017 20:25:46 +0000 (20:25 +0000)]
[SCEV] Fix trip multiple calculation

If loop bound containing calculations like min(a,b), the Scalar
Evolution API getSmallConstantTripMultiple returns 4294967295 "-1"
as the trip multiple. The problem is that, SCEV use -1 * umax to
represent umin. The multiple constant -1 was returned, and the logic
of guarding against huge trip counts was skipped. Because -1 has 32
active bits.

The fix attempt to factor more general cases. First try to get the
greatest power of two divisor of trip count expression. In case
overflow happens, the trip count expression is still divisible by the
greatest power of two divisor returned. Returns 1 if not divisible by 2.

Patch by Huihui Zhang <huihuiz@codeaurora.org>

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

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

7 years ago[X86] Clean up test/CodeGen/X86/2006-03-01-InstrSchedBug.ll
David L. Jones [Mon, 20 Mar 2017 20:10:30 +0000 (20:10 +0000)]
[X86] Clean up test/CodeGen/X86/2006-03-01-InstrSchedBug.ll

Summary:
- Migrated from grep to FileCheck.
- Re-indented, removed boilerplate comments.
- Added 'entry' label at beginning of basic block.

Patch by Jorge Gorbe!

Reviewed By: RKSimon

Subscribers: RKSimon, jgorbe, llvm-commits

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

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

7 years agoExplicitly add move constructor/assignment operators.
Zachary Turner [Mon, 20 Mar 2017 19:56:52 +0000 (19:56 +0000)]
Explicitly add move constructor/assignment operators.

These are needed due to some obscure rules in the standard
about how std::vector selects between copy and move
constructors, which can cause a conforming implementation
to attempt to select the copy constructor of RuleMatcher,
which will fail since std::unique_ptr<> isn't copyable.

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

7 years agoAdd test case for merging of chained stores of mismatched type.
Nirav Dave [Mon, 20 Mar 2017 19:48:22 +0000 (19:48 +0000)]
Add test case for merging of chained stores of mismatched type.

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

7 years agoAdd the rest of the error checking for Mach-O dyld compact bind entry errors
Kevin Enderby [Mon, 20 Mar 2017 19:46:55 +0000 (19:46 +0000)]
Add the rest of the error checking for Mach-O dyld compact bind entry errors
and test cases for each of the error checks.

To do this more plumbing was needed so that the segment indexes and
segment offsets can be checked.  Basically what was done was the SegInfo
from llvm-objdump’s MachODump.cpp was moved into libObject for Mach-O
objects as BindRebaseSegInfo and it is only created when an iterator for
bind or rebase entries are created.

This commit really only adds the error checking and test cases for the
bind table entires and the checking for the lazy bind and weak bind entries
are still to be fully done as well as the rebase entires.  Though some of
the plumbing for those are added with this commit.  Those other error
checks and test cases will be added in follow on commits.

Note, the two llvm_unreachable() calls should now actually be unreachable
with the error checks in place and would take a logic bug in the error
checking code to be reached if the segment indexes and segment
offsets are used from a checked bind entry.  Comments have been added
to the methods that require the arguments to have been checked
prior to calling.

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

7 years agoRevert r298158.
Evgeniy Stepanov [Mon, 20 Mar 2017 18:45:34 +0000 (18:45 +0000)]
Revert r298158.

Revert "[asan] Fix dead stripping of globals on Linux."

OOM in gold linker.

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

7 years agoFixed include order. NFCI.
Simon Pilgrim [Mon, 20 Mar 2017 18:33:23 +0000 (18:33 +0000)]
Fixed include order. NFCI.

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

7 years agoTry using llvm::errc, should hopefully fix version mismatch problem on clang-s390x...
Peter Collingbourne [Mon, 20 Mar 2017 18:19:41 +0000 (18:19 +0000)]
Try using llvm::errc, should hopefully fix version mismatch problem on clang-s390x-linux bot.

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

7 years ago[Hexagon] Recognize polynomial-modulo loop idiom again
Krzysztof Parzyszek [Mon, 20 Mar 2017 18:12:58 +0000 (18:12 +0000)]
[Hexagon] Recognize polynomial-modulo loop idiom again

Regain the ability to recognize loops calculating polynomial modulo
operation. This ability has been lost due to some changes in the
preceding optimizations. Add code to preprocess the IR to a form
that the pattern matching code can recognize.

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

7 years ago[AMDGPU] Run always inliner early in opt
Konstantin Zhuravlyov [Mon, 20 Mar 2017 18:06:45 +0000 (18:06 +0000)]
[AMDGPU] Run always inliner early in opt

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

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

7 years agoAdd missing updated test from VN coercion changes. Instructions were renamed. NFC
Daniel Berlin [Mon, 20 Mar 2017 18:04:19 +0000 (18:04 +0000)]
Add missing updated test from VN coercion changes. Instructions were renamed. NFC

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

7 years agoFix UB found by -Wtautological-undefined-compare
David Blaikie [Mon, 20 Mar 2017 18:01:07 +0000 (18:01 +0000)]
Fix UB found by -Wtautological-undefined-compare

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

7 years agoMention that the Sphinx docs build wants version 1.5 or later
Jonathan Roelofs [Mon, 20 Mar 2017 17:49:36 +0000 (17:49 +0000)]
Mention that the Sphinx docs build wants version 1.5 or later

`misc.highlighting_failure` support was added to `suppress_warnings` in that
version, and the warnings-as-errors docs build relies on it.

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

7 years ago[WinEH] Adjust decision to emit SEH moves for leaf functions
Reid Kleckner [Mon, 20 Mar 2017 17:45:59 +0000 (17:45 +0000)]
[WinEH] Adjust decision to emit SEH moves for leaf functions

Move the check for "MF->hasWinCFI()" up into the calculation of the
shouldEmitMoves boolean, rather than putting it in the early returning
if. This ensures that endFunction doesn't try to emit .seh_* directives
for leaf functions.

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

7 years agoGlobalISel: allow quad-precision values to be dumped.
Tim Northover [Mon, 20 Mar 2017 16:52:08 +0000 (16:52 +0000)]
GlobalISel: allow quad-precision values to be dumped.

Otherwise the fallback path fails with an assertion on AAPCS AArch64 targets,
when "long double" is encountered.

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

7 years agoSupport, LTO: When pruning a directory, ignore files matching a prefix.
Peter Collingbourne [Mon, 20 Mar 2017 16:41:57 +0000 (16:41 +0000)]
Support, LTO: When pruning a directory, ignore files matching a prefix.

This is a safeguard against data loss if the user specifies a directory
that is not a cache directory. Teach the existing cache pruning clients
to create files with appropriate names.

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

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

7 years agoUpdates branch_weights annotation for call instructions during inlining.
Dehao Chen [Mon, 20 Mar 2017 16:40:44 +0000 (16:40 +0000)]
Updates branch_weights annotation for call instructions during inlining.

Summary: Inliner should update the branch_weights annotation to scale it to proper value.

Reviewers: davidxl, eraman

Reviewed By: eraman

Subscribers: zzheng, llvm-commits

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

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

7 years agoUse isa<> instead of dyn_cast<> (NFC).
Adrian Prantl [Mon, 20 Mar 2017 16:39:41 +0000 (16:39 +0000)]
Use isa<> instead of dyn_cast<> (NFC).

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

7 years agoAvoid potential ADL ambiguity between llvm::make_unique and std::make_unique (when...
David Blaikie [Mon, 20 Mar 2017 16:35:33 +0000 (16:35 +0000)]
Avoid potential ADL ambiguity between llvm::make_unique and std::make_unique (when building as C++14+)

Patch by Moritz Kiefer!

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

7 years ago[AMDGPU][MC] Fix for Bugs 28201, 28199, 28170 + LIT tests
Dmitry Preobrazhensky [Mon, 20 Mar 2017 16:33:20 +0000 (16:33 +0000)]
[AMDGPU][MC] Fix for Bugs 28201, 28199, 28170 + LIT tests

This fix enables sp3 abs modifier with constants

Reviewers: artem.tamazov

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

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

7 years ago[InstCombine] Print a debug message when we constant fold an operand during worklist...
Craig Topper [Mon, 20 Mar 2017 16:31:14 +0000 (16:31 +0000)]
[InstCombine] Print a debug message when we constant fold an operand during worklist creation

InstCombine tries to constant fold instruction operands during worklist building, but we don't print that we're doing this.

We also set a change flag here that causes us to rebuild and rerun the worklist one more time even if processing the worklist itself created no additional changes. So in the log I saw two inst combine runs that visited all instructions without printing that anything was changed. I may be submitting another patch to remove the change flag unless I can find some reason why we should be doing that.

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

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

7 years ago[Outliner] ACTUALLY remove the errs output
Jessica Paquette [Mon, 20 Mar 2017 16:25:04 +0000 (16:25 +0000)]
[Outliner] ACTUALLY remove the errs output

I don't know how to type. This fixes the last commit which would have made all
of the overflows legal, and kept the screaming.

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

7 years agoTemplatize parts of VNCoercion, and add constant-only versions of the functions to...
Daniel Berlin [Mon, 20 Mar 2017 16:08:29 +0000 (16:08 +0000)]
Templatize parts of VNCoercion, and add constant-only versions of the functions to be used in NewGVN.
NFCI.

Summary:
This is ground work for the changes to enable coercion in NewGVN.
GVN doesn't care if they end up constant because it eliminates as it goes.
NewGVN cares.

IRBuilder and ConstantFolder deliberately present the same interface,
so we use this to our advantage to templatize our functions to make
them either constant only or not.

Reviewers: davide

Subscribers: llvm-commits, Prazek

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

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

7 years ago[Outliner] Remove output for offset range check
Jessica Paquette [Mon, 20 Mar 2017 15:51:45 +0000 (15:51 +0000)]
[Outliner] Remove output for offset range check

Forgot to remove some output before committing last time. (Instruction fixups
don't actually overflow anywhere in the test suite so far, so I missed it).

To prevent the outliner from screaming "Overflow!" in the event that that
does happen, this commit removes that output.

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

7 years ago[tablegen][globalisel] Capture instructions into locals and related infrastructure...
Daniel Sanders [Mon, 20 Mar 2017 15:20:42 +0000 (15:20 +0000)]
[tablegen][globalisel] Capture instructions into locals and related infrastructure for multiple instructions matches.

Summary:
Prepare the way for nested instruction matching support by having actions
like CopyRenderer look up operands in the RuleMatcher rather than a
specific InstructionMatcher. This allows actions to reference any operand
from any matched instruction.

It works by checking the 'shape' of the match and capturing
each matched instruction to a local variable. If the shape is wrong
(not enough operands, leaf nodes where non-leafs are expected, etc.), then
the rule exits early without checking the predicates. Once we've captured
the instructions, we then test the predicates as before (except using the
local variables). If the match is successful, then we render the new
instruction as before using the local variables.

It's not noticable in this patch but by the time we support multiple
instruction matching, this patch will also cause a significant improvement
to readability of the emitted code since
MRI.getVRegDef(I->getOperand(0).getReg()) will simply be MI1 after
emitCxxCaptureStmts().

This isn't quite NFC because I've also fixed a bug that I'm surprised we
haven't encountered yet. It now checks there are at least the expected
number of operands before accessing them with getOperand().

Depends on D30531

Reviewers: t.p.northover, qcolombet, aditya_nandakumar, ab, rovka

Reviewed By: rovka

Subscribers: dberris, kristof.beyls, llvm-commits

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

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

7 years ago[AMDGPU][MC] Fix for Bugs 28200, 28202 + LIT tests
Dmitry Preobrazhensky [Mon, 20 Mar 2017 14:50:35 +0000 (14:50 +0000)]
[AMDGPU][MC] Fix for Bugs 28200, 28202 + LIT tests

Fixed several related issues with VOP3 fp modifiers.

Reviewers: artem.tamazov

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

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

7 years ago[GlobalISel] Use the correct calling conv for calls
Diana Picus [Mon, 20 Mar 2017 14:40:18 +0000 (14:40 +0000)]
[GlobalISel] Use the correct calling conv for calls

This commit adds a parameter that lets us pass in the calling convention
of the call to CallLowering::lowerCall. This allows us to handle
situations where the calling convetion of the callee is different from
that of the caller.

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

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

7 years agoUse MutableArrayRef for APFloat::convertToInteger
Simon Pilgrim [Mon, 20 Mar 2017 14:40:12 +0000 (14:40 +0000)]
Use MutableArrayRef for APFloat::convertToInteger

As discussed on D31074, use MutableArrayRef for destination integer buffers to help assert before stack overflows happen.

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

7 years ago[sancov] Fix broken links and displaced coloring in coverage-report-server.py
Maxim Ostapenko [Mon, 20 Mar 2017 14:06:04 +0000 (14:06 +0000)]
[sancov] Fix broken links and displaced coloring in coverage-report-server.py

This patch fixes two issues:

* Fixed relative links to source files
* Enumeration of lines in source files starts from 1 instead of 0 to
  align with .symcov files generated by sancov -symbolize

Patch by Dmitiriy Nikiforov.

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

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

7 years agoStrip trailing whitespace
Simon Pilgrim [Mon, 20 Mar 2017 13:55:35 +0000 (13:55 +0000)]
Strip trailing whitespace

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

7 years agoStrip trailing whitespace
Simon Pilgrim [Mon, 20 Mar 2017 13:54:44 +0000 (13:54 +0000)]
Strip trailing whitespace

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

7 years agoStrip trailing whitespace
Simon Pilgrim [Mon, 20 Mar 2017 13:53:59 +0000 (13:53 +0000)]
Strip trailing whitespace

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

7 years agoRevert "[AMDGPU] Run always inliner early in opt"
Konstantin Zhuravlyov [Mon, 20 Mar 2017 09:26:08 +0000 (09:26 +0000)]
Revert "[AMDGPU] Run always inliner early in opt"

This reverts commit r297958, it breaks device-libs build.

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

7 years ago[IR] Move a few static functions in Instruction class inline.
Craig Topper [Mon, 20 Mar 2017 06:40:39 +0000 (06:40 +0000)]
[IR] Move a few static functions in Instruction class inline.

They just check for certain opcodes and opcode enums are available in Instruction.h.

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

7 years ago[ConstantRange] Add setSizeSmallerThanOf method.
Michael Zolotukhin [Mon, 20 Mar 2017 06:33:07 +0000 (06:33 +0000)]
[ConstantRange] Add setSizeSmallerThanOf method.

Summary:
ConstantRange class currently has a method getSetSize, which is mostly used to
compare set sizes of two constant ranges (there is only one spot where it's used
in a slightly different scenario). This patch introduces setSizeSmallerThanOf
method, which does such comparison in a more efficient way. In the original
method we have to extend our types to (BitWidth+1), which can result it using
slow case of APInt, extra memory allocations, etc.

The change is supposed to not change any functionality, but it slightly improves
compile time. Here is compile time improvements that I observed on CTMark:
* tramp3d-v4 -2.02%
* pairlocalalign -1.82%
* lencod -1.67%

Reviewers: sanjoy, atrick, pete

Subscribers: llvm-commits

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

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

7 years ago[IR] Remove some unneeded includes from Operator.h and fix cpp files that were transi...
Craig Topper [Mon, 20 Mar 2017 05:08:41 +0000 (05:08 +0000)]
[IR] Remove some unneeded includes from Operator.h and fix cpp files that were transitively depending on it. NFC

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

7 years ago[IR] Add missing copyright header.
Craig Topper [Mon, 20 Mar 2017 05:08:38 +0000 (05:08 +0000)]
[IR] Add missing copyright header.

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

7 years ago[APInt] Don't initialize VAL to 0 in APInt constructors. Push it down to the initSlow...
Craig Topper [Mon, 20 Mar 2017 01:29:52 +0000 (01:29 +0000)]
[APInt] Don't initialize VAL to 0 in APInt constructors. Push it down to the initSlowCase and other init methods.

I'm not sure if zeroing VAL before writing pVal is really necessary, but at least one other place did it in code.

But by taking the store out of line, this reduces the opt binary by about 20k on my local x86-64 build.

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

7 years agoRemove unnecessary IDom check
Xin Tong [Mon, 20 Mar 2017 00:30:19 +0000 (00:30 +0000)]
Remove unnecessary IDom check

Summary: This Idom check seems unnecessary. The immediate children of a node on the Dominator Tree should always be the IDom of its immediate children in this case.

Reviewers: hfinkel, majnemer, dberlin

Reviewed By: dberlin

Subscribers: dberlin, davide, llvm-commits

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

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

7 years ago[InstCombine] Remove duplicate code in SimplifyDemandedUseBits for URem. NFC
Craig Topper [Sun, 19 Mar 2017 21:45:57 +0000 (21:45 +0000)]
[InstCombine] Remove duplicate code in SimplifyDemandedUseBits for URem. NFC

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

7 years ago[AVX-512] Handle kor/kand/kandn/kxor/kxnor/knot intrinsics at lowering time instead...
Craig Topper [Sun, 19 Mar 2017 17:11:09 +0000 (17:11 +0000)]
[AVX-512] Handle kor/kand/kandn/kxor/kxnor/knot intrinsics at lowering time instead of isel

Summary:
Currently we handle these intrinsics at isel with special patterns. But as they just map to normal logic operations, we should just handle them at lowering. This will expose them to DAG combine optimizations. Right now the kor-sequence test generates a bunch of regclass copies between GR16 and VK16 that the peephole optimizer and/or register coallescing are removing to keep everything in the mask domain. By handling the logic op intrinsics earlier, these copies become bitcasts in the DAG and get removed by DAG combine which seems more robust.

This should help enable my plan to stop copying between K registers and GR8/GR16. The peephole optimizer can't remove a chain of copies between K and GR32 with insert_subreg/extract_subreg present in the chain so the kor-sequence test break. But this patch should dodge the problem entirely.

Reviewers: zvi, delena, RKSimon, igorb

Reviewed By: igorb

Subscribers: llvm-commits

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

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

7 years ago[InstCombine] Use update_test_checks.py to regenerate a test. NFC
Craig Topper [Sun, 19 Mar 2017 17:04:52 +0000 (17:04 +0000)]
[InstCombine] Use update_test_checks.py to regenerate a test. NFC

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

7 years agoFix constant folding of fp2int to large integers
Simon Pilgrim [Sun, 19 Mar 2017 16:50:25 +0000 (16:50 +0000)]
Fix constant folding of fp2int to large integers

We make the assumption in most of our constant folding code that a fp2int will target an integer of 128-bits or less, calling the APFloat::convertToInteger with only uint64_t[2] of raw bits for the result.

Fuzz testing (PR24662) showed that we don't handle other cases at all, resulting in stack overflows and all sorts of crashes.

This patch uses the APSInt version of APFloat::convertToInteger instead to better handle such cases.

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

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

7 years agoFix MSVC warning: "switch statement contains 'default' but no 'case' labels". NFCI.
Simon Pilgrim [Sun, 19 Mar 2017 16:39:04 +0000 (16:39 +0000)]
Fix MSVC warning: "switch statement contains 'default' but no 'case' labels". NFCI.

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

7 years ago[GlobalISel] Don't select trivially dead instructions.
Ahmed Bougacha [Sun, 19 Mar 2017 16:13:00 +0000 (16:13 +0000)]
[GlobalISel] Don't select trivially dead instructions.

Folding instructions when selecting can cause them to become dead.
Don't select these dead instructions (if they don't have other side
effects, and don't define physical registers).

Preserve existing tests by adding COPYs.

In some tests, the G_CONSTANT vregs never get constrained to a class:
the only use of the vreg was folded into another instruction, so the
G_CONSTANT, now dead, never gets selected.

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

7 years ago[GlobalISel][AArch64] Add DBG_VALUE select test. NFC.
Ahmed Bougacha [Sun, 19 Mar 2017 16:12:53 +0000 (16:12 +0000)]
[GlobalISel][AArch64] Add DBG_VALUE select test. NFC.

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

7 years ago[GlobalISel][AArch64] Split out cast select tests. NFC.
Ahmed Bougacha [Sun, 19 Mar 2017 16:12:51 +0000 (16:12 +0000)]
[GlobalISel][AArch64] Split out cast select tests. NFC.

And remove some redundant bitcast tests.

Also split the test functions themselves: it makes it obvious to see
what's tested where and what isn't, it makes the tests much easier to
read and manually update, and, most importantly, it makes them almost
trivial to update using tooling.  Yes, it's obnoxiously verbose, but
said tooling helps upgrade to better MIR syntax whenever available.

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

7 years ago[GlobalISel] Move method definition to the proper file. NFC.
Ahmed Bougacha [Sun, 19 Mar 2017 16:12:48 +0000 (16:12 +0000)]
[GlobalISel] Move method definition to the proper file. NFC.

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

7 years ago[CodeGen] Update hasSideEffects comment. NFC.
Ahmed Bougacha [Sun, 19 Mar 2017 16:12:45 +0000 (16:12 +0000)]
[CodeGen] Update hasSideEffects comment. NFC.

We used to have 3 side effect flags, but as of r222809, we only have
hasSideEffects.  Change the comment to reflect that.

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

7 years agoCorrect a rebase mistake.
Xin Tong [Sun, 19 Mar 2017 15:41:46 +0000 (15:41 +0000)]
Correct a rebase mistake.

Left out AA in jumpthreading SimplifyPartiallyRedundantLoad

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

7 years agoRemove unused arguments. NFCI
Xin Tong [Sun, 19 Mar 2017 15:31:16 +0000 (15:31 +0000)]
Remove unused arguments. NFCI

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

7 years ago[JumpThreading] Perform phi-translation in SimplifyPartiallyRedundantLoad.
Xin Tong [Sun, 19 Mar 2017 15:30:53 +0000 (15:30 +0000)]
[JumpThreading] Perform phi-translation in SimplifyPartiallyRedundantLoad.

Summary:
In case we are loading on a phi-load in SimplifyPartiallyRedundantLoad.
Try to phi translate it into incoming values in the predecessors before
we search for available loads.

This needs https://reviews.llvm.org/D30524

Reviewers: davide, sanjoy, efriedma, dberlin, rengolin

Reviewed By: dberlin

Subscribers: junbuml, llvm-commits

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

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

7 years agoExtract FindAvailablePtrLoadStore out of FindAvailableLoadedValue. NFCI
Xin Tong [Sun, 19 Mar 2017 15:27:52 +0000 (15:27 +0000)]
Extract FindAvailablePtrLoadStore out of FindAvailableLoadedValue. NFCI

Summary:
Extract FindAvailablePtrLoadStore out of FindAvailableLoadedValue.
Prepare for upcoming change which will do phi-translation for load on
phi pointer in jump threading SimplifyPartiallyRedundantLoad.

This is in preparation for https://reviews.llvm.org/D30543

Reviewers: efriedma, sanjoy, davide, dberlin

Reviewed By: davide

Subscribers: junbuml, davide, llvm-commits

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

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

7 years agoEnable stripping of multiple DILocation on !llvm.loop metadata
Teresa Johnson [Sun, 19 Mar 2017 13:54:57 +0000 (13:54 +0000)]
Enable stripping of multiple DILocation on !llvm.loop metadata

Summary:
I found that stripDebugInfo was still leaving significant amounts of
debug info due to !llvm.loop that contained DILocation after stripping.
The support for stripping debug info on !llvm.loop added in r293377 only
removes a single DILocation. Enhance that to remove all DILocation from
!llvm.loop.

Reviewers: hfinkel, aprantl, dsanders

Subscribers: llvm-commits

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

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