Commit Graph

175367 Commits

Author SHA1 Message Date
Tim Northover b4ddc0845a ARM & AArch64: make use of common cmpxchg idioms after expansion
The C and C++ semantics for compare_exchange require it to return a bool
indicating success. This gets mapped to LLVM IR which follows each cmpxchg with
an icmp of the value loaded against the desired value.

When lowered to ldxr/stxr loops, this extra comparison is redundant: its
results are implicit in the control-flow of the function.

This commit makes two changes: it replaces that icmp with appropriate PHI
nodes, and then makes sure earlyCSE is called after expansion to actually make
use of the opportunities revealed.

I've also added -{arm,aarch64}-enable-atomic-tidy options, so that
existing fragile tests aren't perturbed too much by the change. Many
of them either rely on undef/unreachable too pervasively to be
restored to something well-defined (particularly while making sure
they test the same obscure assert from many years ago), or depend on a
particular CFG shape, which is disrupted by SimplifyCFG.

rdar://problem/16227836

llvm-svn: 209883
2014-05-30 10:09:59 +00:00
Daniel Jasper 5070c18928 Remove redundant check discovered in post-commit review of r209505.
llvm-svn: 209882
2014-05-30 09:21:17 +00:00
Timur Iskhodzhanov 5bed4206c8 [ASan Win] DLL thunk: make each INTERFACE_FUNCTION unique to prevent ICF linker optimizations
llvm-svn: 209881
2014-05-30 09:01:17 +00:00
Tim Northover ce6538c38d AArch64 & ARM: remove undefined behaviour from some tests.
llvm-svn: 209880
2014-05-30 08:59:55 +00:00
Evgeniy Stepanov dd7cb28572 [asan] Enable ASan on PowerPC.
Patch by Peter Bergner.

llvm-svn: 209879
2014-05-30 08:52:03 +00:00
NAKAMURA Takumi 2a07bf4ef7 clang/test/Frontend/Weverything-and-remarks.cpp: Add explicit -target.
You could see unexpected result (*.tmp.err) with "-target x86_64-win32".

  Weverything-and-remarks.cpp:11:9: warning: 'char32_t' type specifier is incompatible with C++98 [-Wc++98-compat]
  typedef __char32_t char32_t;
          ^
  Weverything-and-remarks.cpp:12:27: error: typedef redefinition with different types ('unsigned long' vs 'unsigned long long')
  typedef long unsigned int size_t;
                            ^
  Weverything-and-remarks.cpp:19:62: warning: dynamic exception specifications are deprecated [-Wdeprecated]
    static void assign(char_type& __c1, const char_type& __c2) throw() {
                                                               ^~~~~~~
  Weverything-and-remarks.cpp:19:62: note: use 'noexcept' instead
    static void assign(char_type& __c1, const char_type& __c2) throw() {
                                                               ^~~~~~~
                                                               noexcept
  Weverything-and-remarks.cpp:25:46: warning: unused parameter '__n' [-Wunused-parameter]
                                        size_t __n) {
                                               ^
  3 warnings and 1 error generated.

llvm-svn: 209878
2014-05-30 07:03:16 +00:00
Hao Liu 5c7314b68d Test cases named with dates is a legacy rule not used now. Rename several test cases.
llvm-svn: 209877
2014-05-30 05:58:19 +00:00
Alexey Bataev f002acae9d [OPENMP] Improve debug location codegen for OpenMP runtime library.
llvm-svn: 209876
2014-05-30 05:48:40 +00:00
Simon Atanasyan 2aae2b4609 [ELF] Fix incorrect sorting of .init_array / .fini_array sections.
The main problem is in the predicate passed to the `std::stable_sort()`.
This predicate always returns false if **both** section's names do not
start with `.init_array` or `.fini_array` prefixes. In short, it does not
define a strict weak orderng. Suppose we have the following sections:

  .A .init_array.1 .init_array.2

The predicate states that:

  not .init_array.1 < .A
  not .A < .init_array.2
  but .init_array.1 < .init_array.2 !!!

The second problem is that `.init_array` section without number should
go last in the list. Not it has the lowest priority '0' and goes first.

The patch fixes both of the problems.

llvm-svn: 209875
2014-05-30 05:29:46 +00:00
Faisal Vali 47d9ed4e20 Fix 'this' capturing Generic lambdas used within default initializers (PR19876)
http://llvm.org/bugs/show_bug.cgi?id=19876

The following C++1y code results in a crash:

struct X {
  int m = 10;
  int n = [this](auto) { return m; }(20);
};

When implicitly instantiating the generic lambda's call operator specialization body, Sema is unable to determine the current 'this' type when transforming the MemberExpr 'm' - since it looks for the nearest enclosing FunctionDeclDC - which is obviously null.

I considered two ways to fix this:

    1) In InstantiateFunctionDefinition, when the context is saved after the lambda scope info is created, retain the 'this' pointer.
    2) Teach getCurrentThisType() to recognize it is within a generic lambda within an NSDMI/default-initializer and return the appropriate this type.

I chose to implement #2 (though I confess I do not have a compelling reason for choosing it over #1).

Richard Smith accepted the patch:
http://reviews.llvm.org/D3935

Thank you!

llvm-svn: 209874
2014-05-30 04:39:37 +00:00
Karthik Bhat 5ab7795649 Allow vectorization of intrinsics such as powi,cttz and ctlz in Loop and SLP Vectorizer.
This patch adds support to vectorize intrinsics such as powi, cttz and ctlz in Vectorizer. These intrinsics are different from other
intrinsics as second argument to these function must be same in order to vectorize them and it should be represented as a scalar.
Review: http://reviews.llvm.org/D3851#inline-32769 and http://reviews.llvm.org/D3937#inline-32857

llvm-svn: 209873
2014-05-30 04:31:24 +00:00
Chandler Carruth 6cd3ebb223 Add a trivial ArrayRef helper overload to the SelectionDAG interface.
I'm using this pretty frequently in a patch I'm working on and it seems
generally useful.

llvm-svn: 209872
2014-05-30 03:50:06 +00:00
Richard Trieu c0f9121e71 Remove use of comma operator.
llvm-svn: 209871
2014-05-30 03:15:17 +00:00
Nick Lewycky 59633cb478 When analyzing params/args for readnone/readonly, don't forget to consider that a pointer argument may be passed through a callsite to the return, and that we may need to analyze it. Fixes a bug reported on llvm-dev: http://lists.cs.uiuc.edu/pipermail/llvmdev/2014-May/073098.html
llvm-svn: 209870
2014-05-30 02:31:27 +00:00
Nikola Smiljanic e27de09de8 PR11410 - Confusing diagnostic when trailing array element tries to call deleted default constructor
llvm-svn: 209869
2014-05-30 01:28:28 +00:00
Nick Kledzik cc28bc1816 [mach-o] Wire up mach-o binary reader to reader registry
llvm-svn: 209868
2014-05-30 01:13:49 +00:00
Nikola Smiljanic 292b5ce301 PR12214 - Warn on suspicious self-compound-assignments.
llvm-svn: 209867
2014-05-30 00:15:04 +00:00
Adam Nemet b3587e98b7 [X86] Move test from r209863 to CodeGen/X86
We should only run this if X86 is in the targets.

llvm-svn: 209866
2014-05-29 23:52:53 +00:00
Nick Kledzik f317d66c31 [mach-0] Add support for parsing compact unwind info section
llvm-svn: 209865
2014-05-29 23:50:48 +00:00
Adam Nemet 35b80eaef1 [X86] Remove AVX1 vbroadcast intrinsics
The corresponding CFE patch replaces these intrinsics with vector initializers
in avxintrin.h.  This patch removes the LLVM intrinsics from the backend.

We now stop lowering at X86ISD::VBROADCAST custom node rather than lowering
that further to the intrinsics.

The patch only changes VBROADCASTS* and leaves VBROADCAST[FI]128 to continue
to use intrinsics.  As explained in the CFE patch, the reason is that we
currently don't generate as good code for them without the intrinsics.

CodeGen/X86/avx-vbroadcast.ll already provides coverage for this change.  It
checks that for a series of insertelements we generate the appropriate
vbroadcast instruction.

Also verified that there was no assembly change in the test-suite before and
after this patch.

llvm-svn: 209864
2014-05-29 23:35:36 +00:00
Adam Nemet 39066800e9 [X86] Auto-upgrade AVX1 vbroadcast intrinsics
They are replaced with the same IR that is generated for the
vector-initializers in avxintrin.h.

The test verifies that we get back the original instruction.  I haven't seen
this approach to be used in other auto-upgrade tests (i.e. llc + FileCheck)
but I think it's the most direct way to test this case.  I believe this should
work because llc upgrades calls during parsing.  (Other tests mostly check
that assembling and disassembling yields the upgraded IR.)

llvm-svn: 209863
2014-05-29 23:35:33 +00:00
Greg Fitzgerald 1316a0e0e0 Mark currently failing ARM tests with XFAIL.
Differential Revision: http://reviews.llvm.org/D3857

llvm-svn: 209862
2014-05-29 23:34:47 +00:00
Greg Fitzgerald c5fd7305cb Mark unstable tests as Unsupported on ARM
This is half the patch from: http://reviews.llvm.org/D3857

It lets us get deterministic results from the rest of the test suite.

llvm-svn: 209861
2014-05-29 23:34:39 +00:00
Chandler Carruth fdc0e0b478 And fix my fix to sink down through the type at the right time. My
original fix would actually trigger the *exact* same crasher as the
original bug for a different reason. Awesomesauce.

Working on test cases now, but wanted to get bots healthier.

llvm-svn: 209860
2014-05-29 23:21:12 +00:00
Peter Collingbourne efe09b4c65 Permit the "if" literal suffix with Microsoft extensions enabled.
Differential Revision: http://reviews.llvm.org/D3963

llvm-svn: 209859
2014-05-29 23:10:15 +00:00
Nick Kledzik b367c25f28 [mach-o] Add support for parsing __eh_frame section. Generalize support for whether symbols in a section are ignored or illegal
llvm-svn: 209858
2014-05-29 23:07:20 +00:00
Chandler Carruth 3012a1b4cd Fix one bug in the latest incarnation of r209843 -- combining GEPs
across PHI nodes. The code was computing the Idxs from the 'GEP'
variable's indices when what it wanted was Op1's indices. This caused an
ASan heap-overflow for me that pin pointed the issue when Op1 had more
indices than GEP did. =] I'll let Louis add a specific test case for
this if he wants.

llvm-svn: 209857
2014-05-29 23:05:52 +00:00
Greg Fitzgerald 11b49c3818 light up sanitizers for ARM, take 2
Differential Revision: http://reviews.llvm.org/D3794

llvm-svn: 209856
2014-05-29 22:38:13 +00:00
Jeroen Ketema 09f054fe37 Sync list of targets with configure's reality
llvm-svn: 209855
2014-05-29 22:23:22 +00:00
Arnold Schwaighofer e2067680a6 LoopVectorizer: Add a check that the backedge taken count + 1 does not overflow
The loop vectorizer instantiates be-taken-count + 1 as the loop iteration count.
If this expression overflows the generated code was invalid.

In case of overflow the code now jumps to the scalar loop.

Fixes PR17288.

llvm-svn: 209854
2014-05-29 22:10:01 +00:00
Filipe Cabecinhas 229dc17610 Added tests for shufflevector lowering to blend instrs.
These tests ensure that a change I will propose in clang works as
expected.

Summary:
Added tests for the generation of blend+immediate instructions from a
shufflevector.
These tests were proposed along with a patch that was dropped. I'm
committing the tests anyway to protect against possible regressions in
codegen.

Reviewers: nadav, bkramer

Subscribers: llvm-commits

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

llvm-svn: 209853
2014-05-29 22:04:42 +00:00
Greg Clayton 7ab7f89ae0 iOS simulator cleanup to make sure we use "*-apple-ios" for iOS simulator apps and binaries.
Changes include:
- ObjectFileMachO can now determine if a binary is "*-apple-ios" or "*-apple-macosx" by checking the min OS and SDK load commands
- ArchSpec now says "<arch>-apple-macosx" is equivalent to "<arch>-apple-ios" since the simulator mixes and matches binaries (some from the system and most from the iOS SDK).
- Getting process inforamtion on MacOSX now correctly classifies iOS simulator processes so they have "*-apple-ios" architectures in the ProcessInstanceInfo
- PlatformiOSSimulator can now list iOS simulator processes correctly instead of showing nothing by using:
    (lldb) platform select ios-simulator
    (lldb) platform process list
- debugserver can now properly return "*-apple-ios" for the triple in the process info packets for iOS simulator executables
- GDBRemoteCommunicationClient now correctly passes along the triples it gets for process info by setting the OS in the llvm::Triple correctly

<rdar://problem/17060217>

llvm-svn: 209852
2014-05-29 21:33:45 +00:00
Greg Fitzgerald c1146ec5ba Revert "light up sanitizers for ARM"
This commit broke the Windows build, where CMAKE_C_COMPILER can
compile and link with -march=armv7-a but the just-built-clang
cannot.

llvm-svn: 209851
2014-05-29 21:33:36 +00:00
Jeroen Ketema 75c1a0c6e2 Add more log related float constants
llvm-svn: 209850
2014-05-29 21:30:28 +00:00
Jeroen Ketema d1bb82a722 Fix _F definitions
The 'f' was missing and, hence, the values were
considered to be doubles instead of floats.

Reviewed by: Tom Stellard

llvm-svn: 209849
2014-05-29 21:29:34 +00:00
Jeroen Ketema a16fdbfac2 Add definition for M_PI
Reviewed by: Tom Stellard

llvm-svn: 209848
2014-05-29 21:24:57 +00:00
DeLesley Hutchins b603192124 Thread Safety Analysis: implement review suggestions from Aaron Ballman.
llvm-svn: 209847
2014-05-29 21:24:16 +00:00
Adam Nemet 286ae08e7d Implement AVX1 vbroadcast intrinsics with vector initializers
These intrinsics are special because they directly take a memory operand (AVX2
adds the register counterparts).  Typically, other non-memop intrinsics take
registers and then it's left to isel to fold memory operands.

In order to LICM intrinsics directly reading memory, we require that no stores
are in the loop (LICM) or that the folded load accesses constant memory
(MachineLICM).  When neither is the case we fail to hoist a loop-invariant
broadcast.

We can work around this limitation if we expose the load as a regular load and
then just implement the broadcast using the vector initializer syntax.  This
exposes the load to LICM and other optimizations.

At the IR level this is translated into a series of insertelements.  The
sequence is already recognized as a broadcast so there is no impact on the
quality of codegen.

_mm256_broadcast_pd and _mm256_broadcast_ps are not updated by this patch
because right now we lack the DAG-combiner smartness to recover the broadcast
instructions.  This will be tackled in a follow-on.

There will be completing changes on the LLVM side to remove the LLVM
intrinsics and to auto-upgrade bitcode files.

Fixes <rdar://problem/16494520>

llvm-svn: 209846
2014-05-29 20:47:29 +00:00
Todd Fiala 0428c97837 gdb-remote testing: new test, cleaned up socket reading.
Added new SocketPacketPump class to decouple gdb remote packet
reading from packet expectations code.  This allowed for cleaner
implementation of the separate $O output streams (non-deterministic
packaging of inferior stdout/stderr) from all the rest of the packets.

Added a packet expectation matcher that can match expected accumulated
output with a timeout.  Use a dictionary with "type":"output_match".
See lldbgdbserverutils.MatchRemoteOutputEntry for details.

Added a gdb remote test to verify that $Hc (continue thread selection)
plus signal delivery ($C{signo}) works.  Having trouble getting this
to pass with debugserver on MacOSX 10.9.  Tried different variants,
including $vCont;C{signo}:{thread-id};c.  In some cases, I get the
test exe's signal handler to run ($vCont variant first time), in others I don't
($vCont second and further times).  $C{signo} doesn't hit the signal
handler code at all in the test exe but delivers a stop.  Further
$Hc and $C{signo} deliver the stop marking the wrong thread.  For now I'm
marking the test as XFAIL on dsym/debugserver.  Will revisit this on
lldb-dev.

Updated the text exe for these tests to support thread:print-ids (each
thread announces its thread id) and provide a SIGUSR1 thread handler
that prints out the thread id on which it was signaled.

llvm-svn: 209845
2014-05-29 20:44:45 +00:00
Nick Kledzik 9ede702bc4 [mach-o] Add support for parsing CFString sections
llvm-svn: 209844
2014-05-29 20:44:21 +00:00
Louis Gerbarg c6b506a0ae Add support for combining GEPs across PHI nodes
Currently LLVM will generally merge GEPs. This allows backends to use more
complex addressing modes. In some cases this is not happening because there
is PHI inbetween the two GEPs:

  GEP1--\
        |-->PHI1-->GEP3
  GEP2--/

This patch checks to see if GEP1 and GEP2 are similiar enough that they can be
cloned (GEP12) in GEP3's BB, allowing GEP->GEP merging (GEP123):

  GEP1--\                     --\                           --\
        |-->PHI1-->GEP3  ==>    |-->PHI2->GEP12->GEP3 == >    |-->PHI2->GEP123
  GEP2--/                     --/                           --/

This also breaks certain use chains that are preventing GEP->GEP merges that the
the existing instcombine would merge otherwise.

Tests included.

llvm-svn: 209843
2014-05-29 20:29:47 +00:00
DeLesley Hutchins 9c6ae36861 Thread Safety Analysis: minor changes to TIL pretty-printing.
llvm-svn: 209842
2014-05-29 20:28:53 +00:00
Diego Novillo 263ce21e05 Add documentation for -Rpass*
Summary:
This adds documentation for -Rpass, -Rpass-missed and -Rpass-analysis.
It also adds release notes for 3.5.

Reviewers: rsmith

Subscribers: cfe-commits

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

llvm-svn: 209841
2014-05-29 20:13:27 +00:00
Chad Rosier e9665095cb Update Credits.
llvm-svn: 209840
2014-05-29 19:59:58 +00:00
Diego Novillo d23ec94393 Add flags -Rpass-missed and -Rpass-analysis.
Summary:
These two flags are in the same family as -Rpass, but are used in
different situations.

-Rpass-missed is used by optimizers to inform the user when they tried
to apply an optimization but couldn't (or wouldn't).

-Rpass-analysis is used by optimizers to report analysis results back
to the user (e.g., why the transformation could not be applied).

Depends on D3682.

Reviewers: rsmith

Subscribers: cfe-commits

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

llvm-svn: 209839
2014-05-29 19:55:06 +00:00
Sebastian Pop 20daf3276d implement missing SCEVDivision case
without this case we would end on an infinite recursion: the remainder is zero,
so Numerator - Remainder is equal to Numerator and so we would recursively ask
for the division of Numerator by Denominator.

llvm-svn: 209838
2014-05-29 19:44:09 +00:00
Sebastian Pop 5352408169 fail to find dimensions when ElementSize is nullptr
when ScalarEvolution::getElementSize returns nullptr it is safe to early return
in ScalarEvolution::findArrayDimensions such that we avoid later problems when
we try to divide the terms by ElementSize.

llvm-svn: 209837
2014-05-29 19:44:05 +00:00
Bob Wilson bdd2b3c7c5 Make the -mno-global-merge option work for arm64/aarch64. rdar://17024719
llvm-svn: 209836
2014-05-29 19:43:02 +00:00
Greg Fitzgerald 32685ec5fd light up sanitizers for ARM
You can expect the sanitizers to be built under any of the following conditions:

1) CMAKE_C_COMPILER is GCC built to cross-compile to ARM
2) CMAKE_C_COMPILER is Clang built to cross-compile to ARM (ARM is default target)
3) CMAKE_C_COMPILER is Clang and CMAKE_C_FLAGS contains -target and --sysroot

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

llvm-svn: 209835
2014-05-29 19:01:32 +00:00
Alexey Samsonov a02e66499b Use range-based for loops in ASan, TSan and MSan
llvm-svn: 209834
2014-05-29 18:40:48 +00:00