platform/upstream/llvm.git
6 years agoInvalid used of 'w' suffix on push and pop using 64-bit register.
Andrew V. Tischenko [Mon, 30 Oct 2017 12:02:06 +0000 (12:02 +0000)]
Invalid used of 'w' suffix on push and pop using 64-bit register.
Differential Revision: https://reviews.llvm.org/D38626

llvm-svn: 316898

6 years ago[ARM GlobalISel] Fixup r316572. NFC
Diana Picus [Mon, 30 Oct 2017 11:58:09 +0000 (11:58 +0000)]
[ARM GlobalISel] Fixup r316572. NFC

Just missed a few spots...

llvm-svn: 316897

6 years ago[CodeGen] Generate TBAA info for reference loads
Ivan A. Kosarev [Mon, 30 Oct 2017 11:49:31 +0000 (11:49 +0000)]
[CodeGen] Generate TBAA info for reference loads

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

llvm-svn: 316896

6 years ago[refactor] Fix a clang-tidy warning.
Haojian Wu [Mon, 30 Oct 2017 11:17:09 +0000 (11:17 +0000)]
[refactor] Fix a clang-tidy warning.

NFC

llvm-svn: 316895

6 years agoRevert "[X86][AVX512] Adding a pattern for broadcastm intrinsic."
Jina Nahias [Mon, 30 Oct 2017 10:35:53 +0000 (10:35 +0000)]
Revert "[X86][AVX512] Adding a pattern for broadcastm intrinsic."

This reverts commit r316890.

Change-Id: I683cceee9848ef309b452293086b1f26a941950d
llvm-svn: 316894

6 years ago[ELF] - Stop sorting input sections in createSections().
George Rimar [Mon, 30 Oct 2017 10:12:49 +0000 (10:12 +0000)]
[ELF] - Stop sorting input sections in createSections().

It does not seem that createSections() is a good place for
applying sorting. Patch changes code to do that inside
sortSections(), which looks more appropriate place.

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

llvm-svn: 316893

6 years ago[analyzer] lock_guard and unique_lock extension for BlockInCriticalSection checker
Gabor Horvath [Mon, 30 Oct 2017 10:09:55 +0000 (10:09 +0000)]
[analyzer] lock_guard and unique_lock extension for BlockInCriticalSection checker

A patch by zdtorok (Zoltán Dániel Török)!

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

llvm-svn: 316892

6 years agoRecommit r315288: [SCCP] Propagate integer range info for parameters in IPSCCP.
Florian Hahn [Mon, 30 Oct 2017 10:07:42 +0000 (10:07 +0000)]
Recommit r315288: [SCCP] Propagate integer range info for parameters in IPSCCP.

This version of the patch includes a fix addressing a stage2 LTO buildbot
failure and addressed some additional nits.

Original commit message:
This updates the SCCP solver to use of the ValueElement lattice for
parameters, which provides integer range information. The range
information is used to remove unneeded icmp instructions.

For the following function, f() can be optimized to ret i32 2 with
this change

    source_filename = "sccp.c"
    target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
    target triple = "x86_64-unknown-linux-gnu"

    ; Function Attrs: norecurse nounwind readnone uwtable
    define i32 @main() local_unnamed_addr #0 {
    entry:
      %call = tail call fastcc i32 @f(i32 1)
      %call1 = tail call fastcc i32 @f(i32 47)
      %add3 = add nsw i32 %call, %call1
      ret i32 %add3
    }

    ; Function Attrs: noinline norecurse nounwind readnone uwtable
    define internal fastcc i32 @f(i32 %x) unnamed_addr #1 {
    entry:
      %c1 = icmp sle i32 %x, 100

      %cmp = icmp sgt i32 %x, 300
      %. = select i1 %cmp, i32 1, i32 2
      ret i32 %.
    }

    attributes #1 = { noinline }

Reviewers: davide, sanjoy, efriedma, dberlin

Reviewed By: davide, dberlin

Subscribers: mcrosier, gberry, mssimpso, dberlin, llvm-commits

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

llvm-svn: 316891

6 years ago[X86][AVX512] Adding a pattern for broadcastm intrinsic.
Jina Nahias [Mon, 30 Oct 2017 09:59:52 +0000 (09:59 +0000)]
[X86][AVX512] Adding a pattern for broadcastm intrinsic.

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

Change-Id: I6551fb13879e098aed74de410e29815cf37d9ab5
llvm-svn: 316890

6 years ago[IRCE][NFC] Store Length as SCEV in RangeCheck instead of Value
Max Kazantsev [Mon, 30 Oct 2017 09:35:16 +0000 (09:35 +0000)]
[IRCE][NFC] Store Length as SCEV in RangeCheck instead of Value

llvm-svn: 316889

6 years agoRevert r316887 to fix buildbot failures.
Florian Hahn [Mon, 30 Oct 2017 09:21:50 +0000 (09:21 +0000)]
Revert r316887 to fix buildbot failures.

llvm-svn: 316888

6 years agoRecommit r315288: [SCCP] Propagate integer range info for parameters in IPSCCP.
Florian Hahn [Mon, 30 Oct 2017 09:04:18 +0000 (09:04 +0000)]
Recommit r315288: [SCCP] Propagate integer range info for parameters in IPSCCP.

This version of the patch includes a fix addressing a stage2 LTO buildbot
failure and addressed some additional nits.

Original commit message:
This updates the SCCP solver to use of the ValueElement lattice for
parameters, which provides integer range information. The range
information is used to remove unneeded icmp instructions.

For the following function, f() can be optimized to ret i32 2 with
this change

    source_filename = "sccp.c"
    target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
    target triple = "x86_64-unknown-linux-gnu"

    ; Function Attrs: norecurse nounwind readnone uwtable
    define i32 @main() local_unnamed_addr #0 {
    entry:
      %call = tail call fastcc i32 @f(i32 1)
      %call1 = tail call fastcc i32 @f(i32 47)
      %add3 = add nsw i32 %call, %call1
      ret i32 %add3
    }

    ; Function Attrs: noinline norecurse nounwind readnone uwtable
    define internal fastcc i32 @f(i32 %x) unnamed_addr #1 {
    entry:
      %c1 = icmp sle i32 %x, 100

      %cmp = icmp sgt i32 %x, 300
      %. = select i1 %cmp, i32 1, i32 2
      ret i32 %.
    }

    attributes #1 = { noinline }

Reviewers: davide, sanjoy, efriedma, dberlin

Reviewed By: davide, dberlin

Subscribers: mcrosier, gberry, mssimpso, dberlin, llvm-commits

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

llvm-svn: 316887

6 years agoAdd missing expected-no-diagnostics comment to test.
Gabor Horvath [Mon, 30 Oct 2017 09:01:48 +0000 (09:01 +0000)]
Add missing expected-no-diagnostics comment to test.

llvm-svn: 316886

6 years ago[analyzer] Handle ObjC messages conservatively in CallDescription
Gabor Horvath [Mon, 30 Oct 2017 08:47:13 +0000 (08:47 +0000)]
[analyzer] Handle ObjC messages conservatively in CallDescription

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

llvm-svn: 316885

6 years ago[GVN][NFC] Mark instruction for deletion instead of immediate erasing in LoadPRE
Max Kazantsev [Mon, 30 Oct 2017 04:48:34 +0000 (04:48 +0000)]
[GVN][NFC] Mark instruction for deletion instead of immediate erasing in LoadPRE

It is done to uniformly handle instructions removal.

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

llvm-svn: 316884

6 years ago[X86] Rearrange code in X86InstrInfo.cpp to put all the foldMemoryOperandImpl methods...
Craig Topper [Mon, 30 Oct 2017 04:39:18 +0000 (04:39 +0000)]
[X86] Rearrange code in X86InstrInfo.cpp to put all the foldMemoryOperandImpl methods together without partial/undef register handling in the middle. NFC

I have a future patch that wants to make use of the one of the partial functions in one of the earlier memory folding methods and the current ordering prevents that.

llvm-svn: 316883

6 years ago[X86] Simplify code by removing an unnecessary temporary variable. NFC
Craig Topper [Mon, 30 Oct 2017 03:35:44 +0000 (03:35 +0000)]
[X86] Simplify code by removing an unnecessary temporary variable. NFC

llvm-svn: 316882

6 years ago[X86] Move some EVEX->VEX code to a helper function to prepare for a future patch...
Craig Topper [Mon, 30 Oct 2017 03:35:43 +0000 (03:35 +0000)]
[X86] Move some EVEX->VEX code to a helper function to prepare for a future patch. NFC

llvm-svn: 316881

6 years agoRemove unnecessary code.
Rui Ueyama [Sun, 29 Oct 2017 23:41:16 +0000 (23:41 +0000)]
Remove unnecessary code.

Discarded section's Repl always points to itself, so returning
Sec is not different from returning Sec->Repl.

llvm-svn: 316880

6 years agoMove "Assigned" bit from SectionBase to InputSectionBase.
Rui Ueyama [Sun, 29 Oct 2017 23:32:23 +0000 (23:32 +0000)]
Move "Assigned" bit from SectionBase to InputSectionBase.

This bit is to manage whether an input section has already been assigned
to some output section by linker scripts or not. So it logically belongs
to InputSectionBase. SectionBase is a common base class for input and
output sections, so that wasn't the right place to define the bit.

llvm-svn: 316879

6 years agoRemove an obscure comment.
Rui Ueyama [Sun, 29 Oct 2017 22:38:00 +0000 (22:38 +0000)]
Remove an obscure comment.

llvm-svn: 316878

6 years agoELF: Correctly set edata if there are no .bss sections.
Peter Collingbourne [Sun, 29 Oct 2017 22:31:48 +0000 (22:31 +0000)]
ELF: Correctly set edata if there are no .bss sections.

edata needs to be set to the end of the last mapped initialized
section. We were previously mishandling the case where there were no
non-mapped sections by setting it to the end of the last section in
the output file.

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

llvm-svn: 316877

6 years agoInitialize members not by assignment but by the member initializer list.
Rui Ueyama [Sun, 29 Oct 2017 22:26:52 +0000 (22:26 +0000)]
Initialize members not by assignment but by the member initializer list.

llvm-svn: 316876

6 years ago[SelectionDAG] Add SEXT/AND/XOR/Or demanded elts support to ComputeNumSignBits
Simon Pilgrim [Sun, 29 Oct 2017 22:03:37 +0000 (22:03 +0000)]
[SelectionDAG] Add SEXT/AND/XOR/Or demanded elts support to ComputeNumSignBits

llvm-svn: 316875

6 years agoInitial triage
Marshall Clow [Sun, 29 Oct 2017 21:57:58 +0000 (21:57 +0000)]
Initial triage

llvm-svn: 316874

6 years agoUpdate status of 2950
Marshall Clow [Sun, 29 Oct 2017 21:43:30 +0000 (21:43 +0000)]
Update status of 2950

llvm-svn: 316873

6 years ago[Acc] Do not statically dispatch into IslNodeBuilder's createFor
Philip Pfaffe [Sun, 29 Oct 2017 21:36:34 +0000 (21:36 +0000)]
[Acc] Do not statically dispatch into IslNodeBuilder's createFor

Summary:
When GPUNodeBuilder creates loops inside the kernel, it dispatches to
IslNodeBuilder. This however is surprisingly dangerous, since it accesses the
AST Node's user through the wrong type. This patch fixes this problem by
overriding createFor correctly.

This fixes PR35010.

Reviewers: grosser, bollu, Meinersbur

Reviewed By: Meinersbur

Subscribers: Meinersbur, nemanjai, pollydev, llvm-commits, kbarton

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

llvm-svn: 316872

6 years ago[X86][SSE] Split ComputeNumSignBits SEXT/AND/XOR/OR demandedelts test
Simon Pilgrim [Sun, 29 Oct 2017 21:35:28 +0000 (21:35 +0000)]
[X86][SSE] Split ComputeNumSignBits SEXT/AND/XOR/OR demandedelts test

Max depth was being exceeded which could prevent some combines working

llvm-svn: 316871

6 years agoFix two testcases. NFC intended.
Philip Pfaffe [Sun, 29 Oct 2017 21:00:48 +0000 (21:00 +0000)]
Fix two testcases. NFC intended.

Add missing %loadPolly directive to support out of tree builds. One of
the changes is somewhat bigger, because the directive turns on LLVM
names, and the testcase deosn't use those.

llvm-svn: 316870

6 years ago[(new) Pass Manager] instantiate SimplifyCFG with the same options as the old PM
Sanjay Patel [Sun, 29 Oct 2017 20:49:31 +0000 (20:49 +0000)]
[(new) Pass Manager] instantiate SimplifyCFG with the same options as the old PM

The old PM sets the options of what used to be known as "latesimplifycfg" on the
instantiation after the vectorizers have run, so that's what we'redoing here.

FWIW, there's a later SimplifyCFGPass instantiation in both PMs where we do not
set the "late" options. I'm not sure if that's intentional or not.

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

llvm-svn: 316869

6 years ago[X86][SSE] ComputeNumSignBits tests showing missing SEXT/AND/XOR/OR demandedelts...
Simon Pilgrim [Sun, 29 Oct 2017 20:49:27 +0000 (20:49 +0000)]
[X86][SSE] ComputeNumSignBits tests showing missing SEXT/AND/XOR/OR demandedelts support

llvm-svn: 316868

6 years agoIssues to be voted on in ABQ
Marshall Clow [Sun, 29 Oct 2017 19:02:00 +0000 (19:02 +0000)]
Issues to be voted on in ABQ

llvm-svn: 316867

6 years ago[SelectionDAG] Add SRA/SHL demanded elts support to ComputeNumSignBits
Simon Pilgrim [Sun, 29 Oct 2017 18:19:37 +0000 (18:19 +0000)]
[SelectionDAG] Add SRA/SHL demanded elts support to ComputeNumSignBits

Introduce a isConstOrDemandedConstSplat helper function that can recognise a constant splat build vector for at least the demanded elts we care about.

llvm-svn: 316866

6 years ago[X86][SSE] ComputeNumSignBits tests showing missing SHL/SRA demandedelts support
Simon Pilgrim [Sun, 29 Oct 2017 18:01:31 +0000 (18:01 +0000)]
[X86][SSE] ComputeNumSignBits tests showing missing SHL/SRA demandedelts support

llvm-svn: 316865

6 years ago[X86] Add a slow-incdec command line to atomic-eflags-reuse.ll
Craig Topper [Sun, 29 Oct 2017 17:15:09 +0000 (17:15 +0000)]
[X86] Add a slow-incdec command line to atomic-eflags-reuse.ll

I believe the test_sub_1_cmp_1_setcc_ugt test case is being miscompiled in the fast inc/dec case.

llvm-svn: 316864

6 years agoFix ubsan error that shift amount 64 is too large.
Rui Ueyama [Sun, 29 Oct 2017 16:49:42 +0000 (16:49 +0000)]
Fix ubsan error that shift amount 64 is too large.

llvm-svn: 316863

6 years agoRemove a redundant temporary variable.
Rui Ueyama [Sun, 29 Oct 2017 16:46:39 +0000 (16:46 +0000)]
Remove a redundant temporary variable.

llvm-svn: 316862

6 years ago[X86] Remove combine that turns X86ISD::LSUB into X86ISD::LADD. Update patterns that...
Craig Topper [Sun, 29 Oct 2017 06:51:04 +0000 (06:51 +0000)]
[X86] Remove combine that turns X86ISD::LSUB into X86ISD::LADD. Update patterns that depended on this.

If the carry flag is being used, this transformation isn't safe.

This does prevent some test cases from using DEC now, but I'll try to look into that separately.

Fixes PR35068.

llvm-svn: 316860

6 years ago[X86] Fix typo in comment. NFC
Craig Topper [Sun, 29 Oct 2017 06:51:02 +0000 (06:51 +0000)]
[X86] Fix typo in comment. NFC

llvm-svn: 316859

6 years agoDriver: default to `unsigned int` `wchar_t` for ARM
Saleem Abdulrasool [Sun, 29 Oct 2017 06:01:14 +0000 (06:01 +0000)]
Driver: default to `unsigned int` `wchar_t` for ARM

AAPCS and AAPCS64 mandate that `wchar_t` with `-fno-short-wchar` is an
`unsigned int` rather than a `signed int`.  Ensure that the driver does
not flip the signedness of `wchar_t` for those targets.

Add additional tests to ensure that this does not regress.

llvm-svn: 316858

6 years ago[X86] Use the extended vector register classes in fast isel with AVX512F/VL.
Craig Topper [Sun, 29 Oct 2017 05:14:26 +0000 (05:14 +0000)]
[X86] Use the extended vector register classes in fast isel with AVX512F/VL.

llvm-svn: 316857

6 years ago[X86] Add AVX512 support to X86FastISel::X86SelectFPExt and X86FastISel::X86SelectFPT...
Craig Topper [Sun, 29 Oct 2017 02:50:31 +0000 (02:50 +0000)]
[X86] Add AVX512 support to X86FastISel::X86SelectFPExt and X86FastISel::X86SelectFPTrunc.

llvm-svn: 316856

6 years ago[X86] Use update_llc_test_checks.py to regenerate fast-isel-int-float-conversion.ll
Craig Topper [Sun, 29 Oct 2017 02:25:48 +0000 (02:25 +0000)]
[X86] Use update_llc_test_checks.py to regenerate fast-isel-int-float-conversion.ll

llvm-svn: 316855

6 years ago[X86] Use update_llc_test_checks.py to regenerate fast-isel-fptrunc-fpext.ll
Craig Topper [Sun, 29 Oct 2017 02:18:43 +0000 (02:18 +0000)]
[X86] Use update_llc_test_checks.py to regenerate fast-isel-fptrunc-fpext.ll

llvm-svn: 316854

6 years ago[X86] Add AVX512 support to X86FastISel::X86MaterializeFP
Craig Topper [Sun, 29 Oct 2017 02:18:41 +0000 (02:18 +0000)]
[X86] Add AVX512 support to X86FastISel::X86MaterializeFP

llvm-svn: 316853

6 years ago[analyzer] MisusedMovedObjectChecker: More precise warning message
Peter Szecsi [Sat, 28 Oct 2017 23:24:00 +0000 (23:24 +0000)]
[analyzer] MisusedMovedObjectChecker: More precise warning message

Added new enum in order to differentiate the warning messages on "misusing" into
3 categories: function calls, moving an object, copying an object. (At the
moment the checker gives the same message in case of copying and moving.)

Additional test cases added as well.

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

llvm-svn: 316852

6 years ago[X86] Remove invalid code from LowerVSELECT.
Craig Topper [Sat, 28 Oct 2017 23:10:13 +0000 (23:10 +0000)]
[X86] Remove invalid code from LowerVSELECT.

This code attempted to say that v8i16/v16i16 VSELECT is legal if BWI and VLX are enabled, but the only way we could reach this point is if the condition was not a vXi1 type. Which means it really wasn't legal.

We don't have any tests that exercise this code. So I'm hoping it wasn't really reachable.

llvm-svn: 316851

6 years ago[analyzer] MisusedMovedObjectChecker: Fix false positive on state-resetting, handling...
Peter Szecsi [Sat, 28 Oct 2017 23:09:37 +0000 (23:09 +0000)]
[analyzer] MisusedMovedObjectChecker: Fix false positive on state-resetting, handling method calls on base-class sub-objects

An earlier solution from Artem r315301 solves the reset problem, however, the
reports should be handled the same way in case of method calls. We should not
just report the base class of the object where the method was defined but the
whole object.

Fixed false positive which came from not removing the subobjects in case of a
state-resetting function. (Just replaced the State->remove(...) call to
removeFromState(..) which was defined exactly for that purpose.)

Some minor typos fixed in this patch as well which did not worth a whole new
patch in my opinion, so included them here.

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

llvm-svn: 316850

6 years agoFix ubsan error.
Rui Ueyama [Sat, 28 Oct 2017 22:18:29 +0000 (22:18 +0000)]
Fix ubsan error.

This patch fixes ubsan's "shift exponent 64 is too large for 32-bit type
'int'" error.

llvm-svn: 316849

6 years agoReduce sizeof(Symbol) from 104 bytes to 88 bytes.
Rui Ueyama [Sat, 28 Oct 2017 22:18:17 +0000 (22:18 +0000)]
Reduce sizeof(Symbol) from 104 bytes to 88 bytes.

Finding aliases for shared symbols doesn't need st_shndx because
we can just compare st_value.

llvm-svn: 316848

6 years ago[SelectionDAG] Add support for INSERT_SUBVECTOR to computeKnownBits
Simon Pilgrim [Sat, 28 Oct 2017 22:10:40 +0000 (22:10 +0000)]
[SelectionDAG] Add support for INSERT_SUBVECTOR to computeKnownBits

llvm-svn: 316847

6 years agoDo not handle DefinedCommon symbols in the MapFile writer.
Rui Ueyama [Sat, 28 Oct 2017 21:11:38 +0000 (21:11 +0000)]
Do not handle DefinedCommon symbols in the MapFile writer.

Because of r314495 which converts DefinedCommon symbols to DefinedRegular
symbols, common symbols are no longer reachable to the MapFile writer.
So the code to handle common symbols is now dead.

llvm-svn: 316846

6 years ago[X86][SSE] Combine 128-bit target shuffles to PACKSS/PACKUS.
Simon Pilgrim [Sat, 28 Oct 2017 20:51:27 +0000 (20:51 +0000)]
[X86][SSE] Combine 128-bit target shuffles to PACKSS/PACKUS.

llvm-svn: 316845

6 years ago[X86][SSE] Split off matchVectorShuffleWithPACK. NFCI.
Simon Pilgrim [Sat, 28 Oct 2017 20:27:22 +0000 (20:27 +0000)]
[X86][SSE] Split off matchVectorShuffleWithPACK. NFCI.

Split matchVectorShuffleWithPACK from lowerVectorShuffleWithPACK so that we can reuse it for target shuffle combines

llvm-svn: 316844

6 years agoRestore arch specific lastDwarfRegNum in builds without _LIBUNWIND_IS_NATIVE_ONLY
Martin Storsjo [Sat, 28 Oct 2017 20:19:49 +0000 (20:19 +0000)]
Restore arch specific lastDwarfRegNum in builds without _LIBUNWIND_IS_NATIVE_ONLY

This restores the previous behaviour of the Registers_* classes
after SVN r316745.

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

llvm-svn: 316843

6 years agoRename V -> Ver for readability.
Rui Ueyama [Sat, 28 Oct 2017 20:16:11 +0000 (20:16 +0000)]
Rename V -> Ver for readability.

llvm-svn: 316842

6 years agoPass symbol attributes instead of ElfSym to Shared symbol ctor.
Rui Ueyama [Sat, 28 Oct 2017 20:15:56 +0000 (20:15 +0000)]
Pass symbol attributes instead of ElfSym to Shared symbol ctor.

This change allows us to use less templates for Shared symbol and
the functions that deals with shared symbols.

llvm-svn: 316841

6 years ago[X86] Fix a mistake in the X86ISelDAGToDAG.cpp code for MUL8r/IMUL8r.
Craig Topper [Sat, 28 Oct 2017 19:56:57 +0000 (19:56 +0000)]
[X86] Fix a mistake in the X86ISelDAGToDAG.cpp code for MUL8r/IMUL8r.

I think this code is unreachable due to some promotions that occur elsewhere. I'll look into that to be sure, but for now I thought I should at least fix the obvious typo.

llvm-svn: 316840

6 years ago[X86] Replace some default cases in X86SelectShift with llvm_unreachable.
Craig Topper [Sat, 28 Oct 2017 19:56:56 +0000 (19:56 +0000)]
[X86] Replace some default cases in X86SelectShift with llvm_unreachable.

llvm-svn: 316839

6 years agoADT: add a helper to check if the Triple is ARM64
Saleem Abdulrasool [Sat, 28 Oct 2017 19:15:05 +0000 (19:15 +0000)]
ADT: add a helper to check if the Triple is ARM64

Add a trivial helper for checking if the architecture is AArch64 Little
Endian or Big Endian.

llvm-svn: 316837

6 years agoPR35039: Materialize temporary objects before wrapping them in an
Richard Smith [Sat, 28 Oct 2017 18:59:51 +0000 (18:59 +0000)]
PR35039: Materialize temporary objects before wrapping them in an
OpaqueValueExpr in a GNU binary conditional expression.

It's not meaningful for a non-materialized temporary object to be used as a
common subexpression of multiple expressions.

llvm-svn: 316836

6 years ago[SimplifyCFG] use pass options and remove the latesimplifycfg pass
Sanjay Patel [Sat, 28 Oct 2017 18:43:07 +0000 (18:43 +0000)]
[SimplifyCFG] use pass options and remove the latesimplifycfg pass

This is no-functional-change-intended.

This is repackaging the functionality of D30333 (defer switch-to-lookup-tables) and
D35411 (defer folding unconditional branches) with pass parameters rather than a named
"latesimplifycfg" pass. Now that we have individual options to control the functionality,
we could decouple when these fire (but that's an independent patch if desired).

The next planned step would be to add another option bit to disable the sinking transform
mentioned in D38566. This should also make it clear that the new pass manager needs to
be updated to limit simplifycfg in the same way as the old pass manager.

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

llvm-svn: 316835

6 years ago[X86][SSE] Rename truncateVectorCompareWithPACKSS to truncateVectorWithPACKSS. NFC.
Simon Pilgrim [Sat, 28 Oct 2017 17:59:56 +0000 (17:59 +0000)]
[X86][SSE] Rename truncateVectorCompareWithPACKSS to truncateVectorWithPACKSS. NFC.

We no longer rely on the vector source being a comparison result, just have sufficient sign bits.

llvm-svn: 316834

6 years ago[X86] Correct the alignments on the aligned test cases in fast-isel-vecload.ll to...
Craig Topper [Sat, 28 Oct 2017 17:37:51 +0000 (17:37 +0000)]
[X86] Correct the alignments on the aligned test cases in fast-isel-vecload.ll to make sure they test selection of aligned loads.

llvm-svn: 316833

6 years ago[clangd] Fix clang-tidy warnings.
Benjamin Kramer [Sat, 28 Oct 2017 17:32:56 +0000 (17:32 +0000)]
[clangd] Fix clang-tidy warnings.

No functionality change intended.

llvm-svn: 316832

6 years ago[SelectionDAG] Support 'bit preserving' floating points bitcasts on computeKnownBits...
Simon Pilgrim [Sat, 28 Oct 2017 14:27:53 +0000 (14:27 +0000)]
[SelectionDAG] Support 'bit preserving' floating points bitcasts on computeKnownBits/ComputeNumSignBits

For cases where we know the floating point representations match the bitcasted integer equivalent, allow bitcasting to these types.

This is especially useful for the X86 floating point compare results which return all/zero bits but as a floating point type.

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

llvm-svn: 316831

6 years ago[analyzer] LoopUnrolling: check the bitwidth of the used numbers (pr34943)
Peter Szecsi [Sat, 28 Oct 2017 12:19:08 +0000 (12:19 +0000)]
[analyzer] LoopUnrolling: check the bitwidth of the used numbers (pr34943)

The loop unrolling feature aims to track the maximum possible steps a loop can
make. In order to implement this, it investigates the initial value of the
counter variable and the bound number. (It has to be known.)
These numbers are used as llvm::APInts, however, it was not checked if their
bitwidths are the same which lead to some crashes.
This revision solves this problem by extending the "shorter" one (to the length
of the "longer" one).
For the detailed bug report, see: https://bugs.llvm.org/show_bug.cgi?id=34943

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

llvm-svn: 316830

6 years ago[X86] Add avx command lines to fast-isel-constpool.ll to improve coverage.
Craig Topper [Sat, 28 Oct 2017 06:31:48 +0000 (06:31 +0000)]
[X86] Add avx command lines to fast-isel-constpool.ll to improve coverage.

llvm-svn: 316829

6 years ago[X86] Use update_llc_test_checks.py to regenerate fast-isel-constpool.ll
Craig Topper [Sat, 28 Oct 2017 06:31:46 +0000 (06:31 +0000)]
[X86] Use update_llc_test_checks.py to regenerate fast-isel-constpool.ll

llvm-svn: 316828

6 years ago[X86] Add a fast-isel test for the i8 pseudo cmov.
Craig Topper [Sat, 28 Oct 2017 06:10:03 +0000 (06:10 +0000)]
[X86] Add a fast-isel test for the i8 pseudo cmov.

llvm-svn: 316827

6 years agoBasic: improve coverage for Darwin targets and fix ABI
Saleem Abdulrasool [Sat, 28 Oct 2017 06:00:43 +0000 (06:00 +0000)]
Basic: improve coverage for Darwin targets and fix ABI

The existing coverage for the Darwin targets wasn't enough to catch all
the variations.  Improve the coverage a bit further and fix a few cases
for Darwin targets.

llvm-svn: 316826

6 years ago[X86] Remove unneeded MVT::i1 related code from fast isel.
Craig Topper [Sat, 28 Oct 2017 05:52:23 +0000 (05:52 +0000)]
[X86] Remove unneeded MVT::i1 related code from fast isel.

llvm-svn: 316825

6 years ago[ConstantFold] Fix a crash when folding a GEP that has vector index
Haicheng Wu [Sat, 28 Oct 2017 02:27:14 +0000 (02:27 +0000)]
[ConstantFold] Fix a crash when folding a GEP that has vector index

LLVM crashes when factoring out an out-of-bound index into preceding dimension
and the preceding dimension uses vector index.  Simply bail out now when this
case happens.

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

llvm-svn: 316824

6 years ago[X86] Add avx command lines to two fast-isel tests to get coverage of selecting vucom...
Craig Topper [Sat, 28 Oct 2017 02:03:59 +0000 (02:03 +0000)]
[X86] Add avx command lines to two fast-isel tests to get coverage of selecting vucomiss/vucomisd.

The selection of these shows up as a code coverage hole when looking at the llvm-cov link on llvm.org

llvm-svn: 316823

6 years ago[X86] Use update_llc_test_checks.py to regenerate fast-isel-select-cmov2.ll
Craig Topper [Sat, 28 Oct 2017 02:03:58 +0000 (02:03 +0000)]
[X86] Use update_llc_test_checks.py to regenerate fast-isel-select-cmov2.ll

llvm-svn: 316822

6 years ago[XRay] [compiler-rt] fix build by including errno.h into FDR mode
Martin Pelikan [Sat, 28 Oct 2017 01:35:07 +0000 (01:35 +0000)]
[XRay] [compiler-rt] fix build by including errno.h into FDR mode

The build got broken after D39277 (and rL316816) deleted <cerrno>.

llvm-svn: 316821

6 years agoNever try to instantiate a deduction guide's "definition". Fixes bogus warning when...
Richard Smith [Sat, 28 Oct 2017 01:15:00 +0000 (01:15 +0000)]
Never try to instantiate a deduction guide's "definition". Fixes bogus warning when there inevitably isn't one.

llvm-svn: 316820

6 years ago[PartialInlineLibCalls] Teach PartialInlineLibCalls to honor nobuiltin, properly...
Craig Topper [Sat, 28 Oct 2017 00:36:58 +0000 (00:36 +0000)]
[PartialInlineLibCalls] Teach PartialInlineLibCalls to honor nobuiltin, properly check the function signature, and check TLI::has

Summary:
We shouldn't do this transformation if the function is marked nobuitlin.

We were only checking that the return type is floating point, we really should be checking the argument types and argument count as well. This can be accomplished by using the other version of getLibFunc that takes the Function and not just the name.

We should also be checking TLI::has since sqrtf is a macro on Windows.

Fixes PR32559.

Reviewers: hfinkel, spatel, davide, efriedma

Reviewed By: davide, efriedma

Subscribers: efriedma, llvm-commits, eraman

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

llvm-svn: 316819

6 years ago[ADT] Fix some Clang-tidy modernize and Include What You Use warnings; other minor...
Eugene Zelenko [Sat, 28 Oct 2017 00:24:26 +0000 (00:24 +0000)]
[ADT] Fix some Clang-tidy modernize and Include What You Use warnings; other minor fixes (NFC).

llvm-svn: 316818

6 years agoSimplify error handling.
Rui Ueyama [Sat, 28 Oct 2017 00:05:12 +0000 (00:05 +0000)]
Simplify error handling.

I don't think we have to aim for precise bug compatibility.
We can return a nullptr if a section is consumed by the linker, and
the rest should naturally work.

llvm-svn: 316817

6 years ago[XRay][compiler-rt] Remove more STL dependenices from FDR mode
Dean Michael Berris [Fri, 27 Oct 2017 23:59:41 +0000 (23:59 +0000)]
[XRay][compiler-rt] Remove more STL dependenices from FDR mode

Summary:
This change removes dependencies on STL types:

  - std::aligned_storage -- we're using manually-aligned character
    buffers instead for metadata and function records.

  - std::tuple -- use a plain old struct instead.

This is an incremental step in removing all STL references from the
compiler-rt implementation of XRay (llvm.org/PR32274).

Reviewers: dblaikie, pelikan, kpw

Subscribers: llvm-commits

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

llvm-svn: 316816

6 years agoAMDGPU/GlobalISel: Mark 32-bit G_FADD as legal
Tom Stellard [Fri, 27 Oct 2017 23:57:41 +0000 (23:57 +0000)]
AMDGPU/GlobalISel: Mark 32-bit G_FADD as legal

Reviewers: arsenm

Reviewed By: arsenm

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

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

llvm-svn: 316815

6 years ago[support] remove tautological comparison in Support/Windows/Path.inc
Bob Haarman [Fri, 27 Oct 2017 23:41:17 +0000 (23:41 +0000)]
[support] remove tautological comparison in Support/Windows/Path.inc

Summary:
The removed code checks that we are able to handle a 64-bit number, but
the code we're calling takes two dwords (for a total of 64 bits), so this
is always true.

Reviewers: zturner, rnk, majnemer, compnerd

Reviewed By: zturner

Subscribers: amccarth, hiraditya, lebedev.ri, llvm-commits

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

llvm-svn: 316814

6 years agoRevert "Add support for writing 64-bit symbol tables for archives when offsets become...
Jake Ehrlich [Fri, 27 Oct 2017 23:39:31 +0000 (23:39 +0000)]
Revert "Add support for writing 64-bit symbol tables for archives when offsets become too large for 32-bit"

This reverts commit r316805.

llvm-svn: 316813

6 years agoRemove unnecessary namespace specifiers.
Rui Ueyama [Fri, 27 Oct 2017 23:29:58 +0000 (23:29 +0000)]
Remove unnecessary namespace specifiers.

llvm-svn: 316812

6 years agoInline trivial symbol constructors.
Rui Ueyama [Fri, 27 Oct 2017 23:26:46 +0000 (23:26 +0000)]
Inline trivial symbol constructors.

llvm-svn: 316811

6 years agoARM: centralise SizeType, PtrDiffType, and IntPtrType
Saleem Abdulrasool [Fri, 27 Oct 2017 23:04:27 +0000 (23:04 +0000)]
ARM: centralise SizeType, PtrDiffType, and IntPtrType

Centralise the definitions of these compiler vended types to aid
inspection to ensure that they are defined similarly.  The one case that
stands out is the Darwin case where the types do not match up.  This
fixes the API conformance for APCS-GNU as well.

llvm-svn: 316810

6 years agoRename isInCurrentDSO -> isInCurrentOutput.
Rui Ueyama [Fri, 27 Oct 2017 22:54:16 +0000 (22:54 +0000)]
Rename isInCurrentDSO -> isInCurrentOutput.

DSO is short for dynamic shared object, so the function name was a
little confusing because it sounded like it didn't work when we were
a creating statically-linked executable or something.

What we mean by "DSO" here is the current output file that we are
creating. Thus the new name. Alternatively, we could call it the current
ELF module, but "module" is a overloaded word, so I avoided that.

llvm-svn: 316809

6 years ago[Analyzer] [Tests] Fixing typo from the previous commit.
George Karpenkov [Fri, 27 Oct 2017 22:52:36 +0000 (22:52 +0000)]
[Analyzer] [Tests] Fixing typo from the previous commit.

Can not open a non-existent file with r+.

llvm-svn: 316808

6 years ago[MS] Allow access to ambiguous, inaccessible direct bases
Reid Kleckner [Fri, 27 Oct 2017 22:48:41 +0000 (22:48 +0000)]
[MS] Allow access to ambiguous, inaccessible direct bases

Summary:
Clang typically warns that in the following class hierarchy, 'A' is
inaccessible because there is no series of casts that the user can
write to access it unambiguously:
  struct A { };
  struct B : A { };
  struct C : A, B { };

MSVC allows the user to convert from C* to A*, though, and we've
encountered this issue in the latest Windows SDK headers.

This patch allows this conversion when -fms-compatibility is set and
adds a warning for it under -Wmicrosoft-inaccessible-base.

Reviewers: rsmith

Subscribers: cfe-commits

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

llvm-svn: 316807

6 years ago[Analyzer] [Tests] Dump the output of scan-build to stdout on failure.
George Karpenkov [Fri, 27 Oct 2017 22:39:54 +0000 (22:39 +0000)]
[Analyzer] [Tests] Dump the output of scan-build to stdout on failure.

Eliminates extra lookup step during debugging.

llvm-svn: 316806

6 years agoAdd support for writing 64-bit symbol tables for archives when offsets become too...
Jake Ehrlich [Fri, 27 Oct 2017 22:26:37 +0000 (22:26 +0000)]
Add support for writing 64-bit symbol tables for archives when offsets become too large for 32-bit

This should fix https://bugs.llvm.org//show_bug.cgi?id=34189

This change makes it so that if writing a K_GNU style archive, you need
to output a > 32-bit offset it should output in K_GNU64 style instead.

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

llvm-svn: 316805

6 years ago[Hexagon] Adjust patterns to reflect instruction selection preferences
Krzysztof Parzyszek [Fri, 27 Oct 2017 22:24:49 +0000 (22:24 +0000)]
[Hexagon] Adjust patterns to reflect instruction selection preferences

llvm-svn: 316804

6 years agoAdd a few missing headers for modularization/IWYU/etc
David Blaikie [Fri, 27 Oct 2017 22:12:46 +0000 (22:12 +0000)]
Add a few missing headers for modularization/IWYU/etc

Several cases where class definitions are required for DenseMap pointer
traits handling.

llvm-svn: 316803

6 years ago[DAGCombine] Don't combine sext with extload if sextload is not supported and extload...
Guozhi Wei [Fri, 27 Oct 2017 21:54:24 +0000 (21:54 +0000)]
[DAGCombine] Don't combine sext with extload if sextload is not supported and extload has multi users

In function DAGCombiner::visitSIGN_EXTEND_INREG, sext can be combined with extload even if sextload is not supported by target, then

  if sext is the only user of extload, there is no big difference, no harm no benefit.
  if extload has more than one user, the combined sextload may block extload from combining with other zext, causes extra zext instructions generated. As demonstrated by the attached test case.

This patch add the constraint that when sextload is not supported by target, sext can only be combined with extload if it is the only user of extload.

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

llvm-svn: 316802

6 years agoMake 32-bit member offset in Archive::Symbol::getMember 64-bit
Jake Ehrlich [Fri, 27 Oct 2017 21:47:38 +0000 (21:47 +0000)]
Make 32-bit member offset in Archive::Symbol::getMember 64-bit

When accessing a member for a symbol with an offset greater than 2^32 -
1 the current Archive::Symbol::getMember implementation will overflow
and cause unexpected behavior. This change simply fixes that. In
particular if you call "llvm-nm --print-armap" on an archive that has
this behavior you'll get an error.

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

llvm-svn: 316801

6 years ago[CMake] Build clang as dependency when using in-tree clang for tests.
Davide Italiano [Fri, 27 Oct 2017 21:22:57 +0000 (21:22 +0000)]
[CMake] Build clang as dependency when using in-tree clang for tests.

Discussed with Zachary Turner and Pavel Labath on lldb-dev.
Let's hope this doesn't break anything :)

llvm-svn: 316800

6 years agoHandle undefined weak hidden symbols on all architectures.
Rafael Espindola [Fri, 27 Oct 2017 21:18:48 +0000 (21:18 +0000)]
Handle undefined weak hidden symbols on all architectures.

We were handling the non-hidden case in lib/Target/TargetMachine.cpp,
but the hidden case was handled in architecture dependent code and
only X86_64 and AArch64 were covered.

While it is true that some code sequences in some ABIs might be able
to produce the correct value at runtime, that doesn't seem to be the
common case.

I left the AArch64 code in place since it also forces a got access for
non-pic code. It is not clear if that is needed, but it is probably
better to change that in another commit.

llvm-svn: 316799

6 years agoForce #define GTEST_LANG_CXX11.
Zachary Turner [Fri, 27 Oct 2017 21:12:28 +0000 (21:12 +0000)]
Force #define GTEST_LANG_CXX11.

gtest depends on this #define to determine whether it can
use various classes like std::tuple, or whether it has to fall
back to experimental classes in the std::tr1 namespace.  The
check in the current version of gtest relies on the value of
the `__cplusplus` macro, but MSVC provides a non-conformant
value of this macro, making it effectively impossible to detect
C++11.  In short, LLVM compiled with MSVC has been silently
using the tr1 versions of several classes since the beginning of
time.

This would normally be pretty benign, except that in the latest
preview of MSVC they have marked all of the tr1 classes
deprecated, so it spews thousands of warnings.

llvm-svn: 316798

6 years ago[X86] Remove fast-isel code for handling i8 shifts. This is handled by auto generated...
Craig Topper [Fri, 27 Oct 2017 21:00:59 +0000 (21:00 +0000)]
[X86] Remove fast-isel code for handling i8 shifts. This is handled by auto generated code.

llvm-svn: 316797