Commit Graph

230467 Commits

Author SHA1 Message Date
Tim Northover 3961735f03 Revert "MemCpyOpt: combine local load/store sequences into memcpy."
This reverts commit r269125. It was in my tree when I ran "git svn dcommit".
It's really still under review.

llvm-svn: 269127
2016-05-10 21:49:40 +00:00
Tim Northover 56048d5c2c ARM: report an error when attempting to target a misalgined BLX
The CodeGen problem was fixed in r269101, but we still miscompiled assembly
that tried the same thing.

llvm-svn: 269126
2016-05-10 21:48:48 +00:00
Tim Northover 6c65c71639 MemCpyOpt: combine local load/store sequences into memcpy.
Sort of the BB-local equivalent to idiom-recognizer: if we have a basic-block
that really implements a memcpy operation, backends can benefit from seeing
this.

llvm-svn: 269125
2016-05-10 21:48:11 +00:00
Hans Wennborg 719b26ba54 Loop unroller: set thresholds for optsize and minsize functions to zero
Before r268509, Clang would disable the loop unroll pass when optimizing
for size. That commit enabled it to be able to support unroll pragmas
in -Os builds. However, this regressed binary size in one of Chromium's
DLLs with ~100 KB.

This restores the original behaviour of no unrolling at -Os, but doing it
in LLVM instead of Clang makes more sense, and also allows the pragmas to
keep working.

Differential revision: http://reviews.llvm.org/D20115

llvm-svn: 269124
2016-05-10 21:45:55 +00:00
Sanjay Patel 12de4aeeb3 update test to use FileCheck for tighter checking
llvm-svn: 269123
2016-05-10 21:45:51 +00:00
Sanjay Patel f68a8c4779 update test to use FileCheck for tighter checking
llvm-svn: 269122
2016-05-10 21:42:09 +00:00
Lawrence Hu e58a814c07 Enable loopreroll for sext of loop control only IV
This patch extend loopreroll to allow the instruction chain
        of loop control only IV has sext.

        Differential Revision: http://reviews.llvm.org/D19820

llvm-svn: 269121
2016-05-10 21:16:49 +00:00
Justin Bogner bbcd2233b2 SDAG: Avoid relying on the return value of SelectCode in SystemZ. NFC
This is a bit of a spot fix for now. I'll try to fix this up more
comprehensively soon.

This is part of the work to have Select return void instead of an
SDNode *, which is in turn part of llvm.org/pr26808.

llvm-svn: 269120
2016-05-10 21:11:26 +00:00
Lawrence Hu fe7c87beac Revert r26084: Enable loopreroll for sext of loop control only IV
llvm-svn: 269119
2016-05-10 21:11:09 +00:00
Reid Kleckner 0ff6e1bc26 Wildcard away paths in fixit CHECKs in my last testcase
Oops. :(

llvm-svn: 269118
2016-05-10 21:10:25 +00:00
Lawrence Hu 4c623d27b5 Revert r269093: Enable loopreroll for sext of loop control only IV
llvm-svn: 269117
2016-05-10 21:04:28 +00:00
Reid Kleckner 9f49733c65 Add -Wcast-calling-convention to warn when casting away calling conventions
Summary:
This only warns on casts of the address of a function defined in the
current TU. In this case, the fix is likely to be local and the warning
useful.

Here are some things we could experiment with in the future:
- Fire on declarations as well as definitions
- Limit the warning to non-void function prototypes
- Limit the warning to mismatches of caller and callee cleanup CCs

This warning is currently off by default while we study its usefulness.

Reviewers: thakis, rtrieu

Subscribers: cfe-commits

Differential Revision: http://reviews.llvm.org/D17348

llvm-svn: 269116
2016-05-10 21:00:03 +00:00
Quentin Colombet 220f7da488 [X86] Properly check that EAX is dead when copying EFLAGS.
This fixes a bug introduced in r267623, where we got smarter and avoided to save
EAX before using it. However, we failed to check if any of the subregister of
EAX were alive and thus, missed cases where we have to save EAX before using it.

The problem may happen on every X86/i386/... platform.

This fixes llvm.org/PR27624

llvm-svn: 269115
2016-05-10 20:49:46 +00:00
Sanjay Patel 6786bc5390 [InstSimplify] use computeKnownBits on shift amount operands
Do simplifications common to all shift instructions based on the amount shifted:
1. If the shift amount is known larger than the bitwidth, the result is undefined.
2. If the valid bits of the shift amount are all known to be 0, it's a shift by zero, so the shift operand is the result.

Note that we could generalize the shift-by-zero transform into a shift-by-constant if all of the valid bits in the shift
amount are known, but that would have to be done in InstCombine rather than here because it would mean we need to create
a new shift instruction.

Differential Revision: http://reviews.llvm.org/D19874

llvm-svn: 269114
2016-05-10 20:46:54 +00:00
Justin Bogner dcb7a821b8 SDAG: Avoid relying on the return value of SelectCode in Hexagon. NFC
This is a bit of a spot fix for now. I'll try to fix this up more
comprehensively soon.

This is part of the work to have Select return void instead of an
SDNode *, which is in turn part of llvm.org/pr26808.

llvm-svn: 269112
2016-05-10 20:31:53 +00:00
Peter Collingbourne 7d6e81d179 Update clang for LLVM API change.
llvm-svn: 269111
2016-05-10 20:23:29 +00:00
Peter Collingbourne dba995601b Cloning: Clean up the interface to the CloneFunction function.
Remove the ModuleLevelChanges argument, and the ability to create new
subprograms for cloned functions. The latter was added without review in
r203662, but it has no in-tree clients (all non-test callers pass false
for ModuleLevelChanges [1], so it isn't reachable outside of tests). It
also isn't clear that adding a duplicate subprogram to the compile unit is
always the right thing to do when cloning a function within a module. If
this functionality comes back it should be accompanied with a more concrete
use case.

Furthermore, all in-tree clients add the returned function to the module.
Since that's pretty much the only sensible thing you can do with the function,
just do that in CloneFunction.

[1] http://llvm-cs.pcc.me.uk/lib/Transforms/Utils/CloneFunction.cpp/rCloneFunction

Differential Revision: http://reviews.llvm.org/D18628

llvm-svn: 269110
2016-05-10 20:23:24 +00:00
Chad Rosier 4e6cda2db5 [InstCombine] Fold icmp ugt/ult (udiv i32 C2, X), C1.
This patch adds support for two optimizations:
icmp ugt (udiv C2, X), C1 -> icmp ule X, C2/(C1+1)
icmp ult (udiv C2, X), C1 -> icmp ugt X, C2/C1

Differential Revision: http://reviews.llvm.org/D20123

llvm-svn: 269109
2016-05-10 20:22:09 +00:00
Bruno Cardoso Lopes 7347fce4c3 [VFS] Change unittest to try appeasing win10 buildbot
http://lab.llvm.org:8011/builders/llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast/builds/5103
Follow up from r269100.

llvm-svn: 269108
2016-05-10 20:20:55 +00:00
Matthias Braun 8a5b46737a ScheduleDAGInstrs: Comment on why subreg defs are not seen as uses; NFC
Usually subregister definitions are consider uses of the remaining
lanes that did not get defined. Add a comment why the code in
ScheduleDAGInstrs does not add use dependencies regardless.

llvm-svn: 269107
2016-05-10 20:11:58 +00:00
Kit Barton 02d455768e [SystemZ] Add support for additional branch extended mnemonics
Added support for extended mnemonics for the following branch instructions and
load/store-on-condition opcodes:

BR, LOCR, LOCGR, LOC, LOCG, STOC, STOCG

Phabricator: http://reviews.llvm.org/D19729

Committing on behalf of Zhan Liau

llvm-svn: 269106
2016-05-10 20:11:24 +00:00
Davide Italiano 7860c9bbf4 [SCCP] Partially propagate informations when the input is not fully defined.
With this patch:
%r1 = lshr i64 -1, 4294967296 -> undef

Before this patch:
%r1 = lshr i64 -1, 4294967296 -> 0

llvm-svn: 269105
2016-05-10 19:49:47 +00:00
Chris Bieneman 1f4af49a5d [CMake] Add some extra variables to LLVMConfig.cmake.in
Compiler-RT needs LLVM_LIBRARY_DIR, LLVM_BINARY_DIR.

Setting these in LLVMConfig.cmake will allow Compiler-RT to not need to run llvm-config as long as the LLVMConfig.cmake module is in the CMake module path.

llvm-svn: 269104
2016-05-10 19:45:17 +00:00
Adrian Prantl 723ccd2790 Debug Info: Prevent DW_AT_abstract_origin from being emitted twice
for the same subprogram.

This fixes a bug where DW_AT_abstract_origin is being emitted twice for
the same subprogram if a function is both inlined and emitted in the same
translation unit, by restoring the pre-r266446 behavior.

http://reviews.llvm.org/D20072

llvm-svn: 269103
2016-05-10 19:38:51 +00:00
Rafael Espindola f72914f42a Add a link to the format description.
llvm-svn: 269102
2016-05-10 19:26:55 +00:00
Tim Northover b5ece527a1 ARM: stop emitting blx instructions for most calls on MachO.
I'm really not sure why we were in the first place, it's the linker's job to
convert between BL/BLX as necessary. Even worse, using BLX left Thumb calls
that could be locally resolved completely unencodable since all offsets to BLX
are multiples of 4.

rdar://26182344

llvm-svn: 269101
2016-05-10 19:17:47 +00:00
Bruno Cardoso Lopes ecf7d15d49 [VFS] Reconstruct the VFS overlay tree for more accurate lookup
The way we currently build the internal VFS overlay representation leads
to inefficient path search and might yield wrong answers when asked for
recursive or regular directory iteration.

Currently, when reading an YAML file, each YAML root entry is placed
inside a new root in the filesystem overlay. In the crash reproducer, a
simple "@import Foundation" currently maps to 43 roots, and when looking
up paths, we traverse a directory tree for each of these different
roots, until we find a match (or don't). This has two consequences:

- It's slow.
- Directory iteration gives incomplete results since it only return
results within one root - since contents of the same directory can be
declared inside different roots, the result isn't accurate.

This is in part fault of the way we currently write out the YAML file
when emitting the crash reproducer - we could generate only one root and
that would make it fast and correct again. However, we should not rely
on how the client writes the YAML, but provide a good internal
representation regardless.

This patch builds a proper virtual directory tree out of the YAML
representation, allowing faster search and proper iteration. Besides the
crash reproducer, this potentially benefits other VFS clients.

llvm-svn: 269100
2016-05-10 18:43:00 +00:00
Derek Schuff ef508f34a6 [WebAssembly] Reduce strictness of static destructor test
It didn't work on non-asserts builds

llvm-svn: 269099
2016-05-10 18:35:31 +00:00
Konstantin Zhuravlyov a791932145 [AMDGPU][NFC] Rename SIInsertNops -> SIDebuggerInsertNops
Differential Revision: http://reviews.llvm.org/D20117

llvm-svn: 269098
2016-05-10 18:33:41 +00:00
Justin Bogner da0fe183c3 LPM: Drop require<loops> from these tests, it's redundant. NFC
The LoopPassManager needs to calculate the loops analysis in order to
iterate over the loops at all. Requiring it is redundant and just adds
noise to the RUN lines here.

llvm-svn: 269097
2016-05-10 18:28:10 +00:00
Rafael Espindola 32483a7641 Make "@name =" mandatory for globals in .ll files.
An oddity of the .ll syntax is that the "@var = " in

@var = global i32 42

is optional. Writing just

global i32 42

is equivalent to

@0 = global i32 42

This means that there is a pretty big First set at the top level. The
current implementation maintains it manually. I was trying to refactor
it, but then started wondering why keep it a all. I personally find the
above syntax confusing. It looks like something is missing.

This patch removes the feature and simplifies the parser.

llvm-svn: 269096
2016-05-10 18:22:45 +00:00
Enrico Granata c3b0a5b099 In some cases, type lookup has to deal with situations where it cannot reconstruct a compile unit or a function, but it still has a valid symbol - and it can use that in order to figure out the preferential language for lookups
This is not the right thing for all clients (notably the expression parser), so put it in type lookup specific code

Fixes rdar://problem/22422313

llvm-svn: 269095
2016-05-10 18:16:33 +00:00
Peter Collingbourne ccdc225c27 Re-apply r269081 and r269082 with a fix for MSVC.
llvm-svn: 269094
2016-05-10 18:07:21 +00:00
Lawrence Hu b68f16e007 Enable loopreroll for sext of loop control only IV
This patch extend loopreroll to allow the instruction chain
    of loop control only IV has sext.

    Differential Revision: http://reviews.llvm.org/D19820

llvm-svn: 269093
2016-05-10 18:00:42 +00:00
Mandeep Singh Grang e5a2f116d6 Fix PR26655: Bail out if all regs of an inst BUNDLE have the correct kill flag
Summary:
While setting kill flags on instructions inside a BUNDLE, we bail out as soon
as we set kill flag on a register.  But we are missing a check when all the
registers already have the correct kill flag set. We need to bail out in that
case as well.

This patch refactors the old code and simply makes use of the addRegisterKilled
function in MachineInstr.cpp in order to determine whether to set/remove kill
on an instruction.

Reviewers: apazos, t.p.northover, pete, MatzeB

Subscribers: MatzeB, davide, llvm-commits

Differential Revision: http://reviews.llvm.org/D17356

llvm-svn: 269092
2016-05-10 17:57:27 +00:00
Peter Collingbourne 4d41cb6cc6 Revert r269081 and r269082 while I try to find the right incantation to fix MSVC build.
llvm-svn: 269091
2016-05-10 17:54:43 +00:00
Rong Xu b6211a0b4f [PGO] resubmit r268969
Put the test into a target specific directory.

llvm-svn: 269090
2016-05-10 17:45:33 +00:00
Derek Schuff 8179be4897 Introduce CGCXXABI::canCallMismatchedFunctionType
llvm-svn: 269089
2016-05-10 17:44:55 +00:00
Derek Schuff 09b2492387 more cleanup
llvm-svn: 269088
2016-05-10 17:44:52 +00:00
Derek Schuff 2136eed869 Clarify condition, remove redundant check
llvm-svn: 269087
2016-05-10 17:44:50 +00:00
Derek Schuff 060fd22093 Clean up condition, add ARM to test
llvm-svn: 269086
2016-05-10 17:44:48 +00:00
Derek Schuff cc42df4a30 Do not register incompatible C++ destructors with __cxa_atexit
Summary:
For a static object with a nontrivial destructor, clang generates an
initializer function (__cxx_global_var_init) which registers that
object's destructor using __cxa_atexit. However some ABIs (ARM,
WebAssembly) use destructors that return 'this' instead of having void
return (which does not match the signature of function pointers passed
to __cxa_atexit). This results in undefined behavior when the destructors are
called. All the calling conventions I know of on ARM can tolerate this,
but WebAssembly requires the signatures of indirect calls to match the
called function.

This patch disables that direct registration of destructors for ABIs
that have this-returning destructors.

Subscribers: aemerson, jfb, cfe-commits, dschuff

Differential Revision: http://reviews.llvm.org/D19275

llvm-svn: 269085
2016-05-10 17:44:46 +00:00
Lawrence Hu 8cc3b37d2c Enable loopreroll for sext of loop control only IV
This patch extend loopreroll to allow the instruction chain
    of loop control only IV has sext.

llvm-svn: 269084
2016-05-10 17:42:27 +00:00
Dan Gohman 2e64438ae4 [WebAssembly] Preliminary fast-isel support.
llvm-svn: 269083
2016-05-10 17:39:48 +00:00
Peter Collingbourne 0f522a5903 Use doxygen style comments.
llvm-svn: 269082
2016-05-10 17:35:30 +00:00
Peter Collingbourne 0df2b085bc WholeProgramDevirt: Move logic for finding devirtualizable call sites to Analysis.
The plan is to eventually make this logic simpler, however I expect it to
be a little tricky for the foreseeable future (at least until we're rid of
pointee types), so move it here so that it can be reused to build a summary
index for devirtualization.

Differential Revision: http://reviews.llvm.org/D20005

llvm-svn: 269081
2016-05-10 17:34:21 +00:00
Rafael Espindola c6269916b3 Simplify LLParser::ParseOptionalLinkage. NFC.
llvm-svn: 269080
2016-05-10 17:16:45 +00:00
NAKAMURA Takumi d4fbaef2b0 clang/test/CodeGen/avx512f-builtins.c: Fix for -Asserts.
llvm-svn: 269079
2016-05-10 17:16:12 +00:00
Simon Pilgrim d86b2d6b1e [X86][AVX512] Added another masked shuffle combine from load test
llvm-svn: 269077
2016-05-10 16:55:20 +00:00
Krzysztof Parzyszek a356bb7fa4 [ScheduleDAG] Make sure to process all def operands before any use operands
An example from Hexagon where things went wrong:
  %R0<def> = L2_loadrigp <ga:@fp04>      ; load function address
  J2_callr %R0<kill>, ..., %R0<imp-def>  ; call *R0, return value in R0

ScheduleDAGInstrs::buildSchedGraph would visit all instructions going
backwards, and in each instruction it would visit all operands in their
order on the operand list. In the case of this call, it visited the use
of R0 first, then removed it from the set Uses after it visited the def.
This caused the DAG to be missing the data dependence edge on R0 between
the load and the call.

Differential Revision: http://reviews.llvm.org/D20102

llvm-svn: 269076
2016-05-10 16:50:30 +00:00