Commit Graph

184516 Commits

Author SHA1 Message Date
Sanjay Patel 17045f7fac fix formatting; NFC
llvm-svn: 219645
2014-10-14 00:33:23 +00:00
Chandler Carruth 7b8297a61e Add some optional passes around the vectorizer to both better prepare
the IR going into it and to clean up the IR produced by the vectorizers.

Note that these are *off by default* right now while folks collect data
on whether the performance tradeoff is reasonable.

In a build of the 'opt' binary, I see about 2% compile time regression
due to this change on average. This is in my mind essentially the worst
expected case: very little of the opt binary is going to *benefit* from
these extra passes.

I've seen several benchmarks improve in performance my small amounts due
to running these passes, and there are certain (rare) cases where these
passes make a huge difference by either enabling the vectorizer at all
or by hoisting runtime checks out of the outer loop. My primary
motivation is to prevent people from seeing runtime check overhead in
benchmarks where the existing passes and optimizers would be able to
eliminate that.

I've chosen the sequence of passes based on the kinds of things that
seem likely to be relevant for the code at each stage: rotaing loops for
the vectorizer, finding correlated values, loop invariants, and
unswitching opportunities from any runtime checks, and cleaning up
commonalities exposed by the SLP vectorizer.

I'll be pinging existing threads where some of these issues have come up
and will start new threads to get folks to benchmark and collect data on
whether this is the right tradeoff or we should do something else.

llvm-svn: 219644
2014-10-14 00:31:29 +00:00
Peter Collingbourne ba689eeb38 Introduce LLVMWriteBitcodeToMemoryBuffer C API function.
llvm-svn: 219643
2014-10-14 00:30:59 +00:00
Alexey Samsonov eb47d8a2c8 Sanitize upcasts and conversion to virtual base.
This change adds UBSan check to upcasts. Namely, when we
perform derived-to-base conversion, we:
1) check that the pointer-to-derived has suitable alignment
   and underlying storage, if this pointer is non-null.
2) if vptr-sanitizer is enabled, and we perform conversion to
   virtual base, we check that pointer-to-derived has a matching vptr.

llvm-svn: 219642
2014-10-13 23:59:00 +00:00
Sean Callanan 0809b2ddc3 Resolve non-pointer isas for metaclasses.
Patch by Enrico Granata.
<rdar://problem/18618298>

llvm-svn: 219641
2014-10-13 23:03:49 +00:00
Chris Bieneman 2dee5480d8 Updating documentation as per Chandler's feedback.
This goes with the earlier commit to remove the static destructor from ManagedStatic.cpp by controlling the allocation and de-allocation of the mutex.

Summary: This is part of the ongoing work to remove static constructors and destructors.

Reviewers: chandlerc, rnk

Reviewed By: rnk

Subscribers: rnk, llvm-commits

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

llvm-svn: 219640
2014-10-13 23:03:45 +00:00
David Majnemer db0773089f InstCombine: Fix miscompile in X % -Y -> X % Y transform
We assumed that negation operations of the form (0 - %Z) resulted in a
negative number.  This isn't true if %Z was originally negative.
Substituting the negative number into the remainder operation may result
in undefined behavior because the dividend might be INT_MIN.

This fixes PR21256.

llvm-svn: 219639
2014-10-13 22:37:51 +00:00
Chris Bieneman b75d8f300c Removing the static destructor from ManagedStatic.cpp by controlling the allocation and de-allocation of the mutex.
This patch adds a new llvm_call_once function which is used by the ManagedStatic implementation to safely initialize a global to avoid static construction and destruction.

llvm-svn: 219638
2014-10-13 22:37:25 +00:00
David Majnemer 3e8b6ac54c Fix the build
llvm-svn: 219637
2014-10-13 22:18:22 +00:00
Eric Christopher 1c5fce0ebb Migrate another set of getSubtargetImpl away.
llvm-svn: 219636
2014-10-13 21:57:44 +00:00
Peter Collingbourne 1dba54aedc Remove unused debug info constants.
These became unused in r219010.

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

llvm-svn: 219635
2014-10-13 21:50:30 +00:00
David Majnemer a252138942 InstCombine: Don't miscompile (x lshr C1) udiv C2
We have a transform that changes:
  (x lshr C1) udiv C2
into:
  x udiv (C2 << C1)

However, it is unsafe to do so if C2 << C1 discards any of C2's bits.

This fixes PR21255.

llvm-svn: 219634
2014-10-13 21:48:30 +00:00
Reed Kotler a562b46db7 Make first of several changes to bring up to AArch64 fast-isel style
Summary:
Make Mips fast-isel track the form of AArch64 where practical.
This makes it easier for people to review the code, to borrow similar code, and to see how to eventually move a lot of this
 target code for fast-isels into target independent code.

These are just cosmetic changes. Should be no functional difference.

Test Plan:
make check
test-suite for 4 flavors mips32 r1/r2 , -O0/-O2

Reviewers: dsanders

Reviewed By: dsanders

Subscribers: aemerson, llvm-commits, rfuhler

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

llvm-svn: 219633
2014-10-13 21:46:41 +00:00
Filipe Cabecinhas 830c45e5de Fix minor typos in comments.
llvm-svn: 219632
2014-10-13 21:40:52 +00:00
Paul Robinson fd989c9aee Update the example of using a command-line option custom parser to
match the current implementation.

Patch by Douglas Yung!

llvm-svn: 219631
2014-10-13 21:11:22 +00:00
Fariborz Jahanian 12f7ef39ce Objective-C [Sema]. Fixes a bug in comparing qualified
Objective-C pointer types. In this case, checker incorrectly
claims incompatible pointer types if redundant protocol conformance 
is specified. rdar://18491222

llvm-svn: 219630
2014-10-13 21:07:45 +00:00
Dan Albert b44ad60835 Correctly export _Unwind_[GS]et(GR|IP) for EHABI.
These need to have normal linkage instead of being static inline as
many libraries expect to be able to declare these and have the linker
find them rather than needing to include the header.

http://mentorembedded.github.io/cxx-abi/abi-eh.html

Also clean up some warnings while I'm here.

Reviewers: jroelofs, kledzik

Subscribers: cfe-commits

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

llvm-svn: 219629
2014-10-13 21:01:30 +00:00
Adrian Prantl 049d21caea Add an assertion about the integrity of the iterator.
Broken parent scope pointers in inlined DIVariables can cause
ensureAbstractVariableIsCreated to insert new abstract scopes, thus
invalidating the iterator in this loop and leading to hard-to-debug
crashes. Useful when manually reducing IR for testcases.

llvm-svn: 219628
2014-10-13 20:44:58 +00:00
Adrian Prantl 13c58820f8 constify the getters in SDNodeDbgValue.
llvm-svn: 219627
2014-10-13 20:43:47 +00:00
Chad Rosier df82a33d42 Refactor debug statement and remove dead argument. NFC.
llvm-svn: 219626
2014-10-13 19:46:39 +00:00
Jordan Rose 679659f58c [analyzer] Check all 'nonnull' attributes, not just the first one.
Patch by Daniel Fahlgren!

llvm-svn: 219625
2014-10-13 19:38:02 +00:00
Samuel Benzaquen 193d87fd8c Fix order of evaluation bug in DynTypedMatcher::constructVariadic().
Fix order of evaluation bug in DynTypedMatcher::constructVariadic().
If it evaluates right-to-left, the vector gets moved before we read the
kind from it.

llvm-svn: 219624
2014-10-13 18:17:11 +00:00
Adrian Prantl 17a0011082 cleanup comments and remove an obsolete workaround
llvm-svn: 219623
2014-10-13 18:04:10 +00:00
Samuel Benzaquen 2009960ea3 Fix bug in DynTypedMatcher::constructVariadic() that would cause false negatives.
Summary:
Change r219118 fixed the bug for anyOf and eachOf, but it is still
present for unless.
The variadic wrapper doesn't have enough information to know how to
restrict the type. Different operators handle restrict failures in
different ways.

Reviewers: klimek

Subscribers: klimek, cfe-commits

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

llvm-svn: 219622
2014-10-13 17:38:12 +00:00
Timur Iskhodzhanov 1ee5ac87e2 Add VS2012-generated test inputs for test/tools/llvm-readobj/codeview-linetables.test
llvm-svn: 219621
2014-10-13 17:03:13 +00:00
Greg Clayton e5bbe10d9e Don't lock the IOHandlerList::m_mutex in Debugger::RunIOHandler(...) since if a process is resumed or halted, it will try to push/pop the process IOHandler and it will deadlock.
<rdar://problem/18610852>

llvm-svn: 219620
2014-10-13 16:54:26 +00:00
Chad Rosier 76267490cb Relinquish ownership of MS-style inline assembly.
llvm-svn: 219619
2014-10-13 16:45:21 +00:00
Adrian Prantl 971ad5925c Address review comments from Justin Bogner.
- raise without arguments is preserving the backtrace
- move the call to terminate lldb to the exit handler

llvm-svn: 219618
2014-10-13 16:34:31 +00:00
Filipe Cabecinhas 9d7bd78ffa Fix a broadcast related regression on the vector shuffle lowering.
Summary: Test by Robert Lougher!

Reviewers: chandlerc

Subscribers: llvm-commits

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

llvm-svn: 219617
2014-10-13 16:16:16 +00:00
Matt Arsenault 3f3a2751e0 R600/SI: Minor cleanup of function
llvm-svn: 219616
2014-10-13 15:47:59 +00:00
Ulrich Weigand 799c3d3a04 More OpenMP test case compatibility fixes
Allow "signext" in a couple of more places in recently
added test cases to fix failures on SystemZ.

llvm-svn: 219615
2014-10-13 13:49:39 +00:00
Johannes Doerfert a99130f042 [Refactor][NfC] Simplify and clean the handling of (new) access relations
This patch does not change the semantic on it's own. However, the
  dependence analysis as well as dce will now use the newest available
  access relation for each memory access, thus if at some point the json
  importer or any other pass will run before those two and set a new
  access relation the behaviour will be different. In general it is
  unclear if the dependence analysis and dce should be run on the old or
  new access functions anyway. If we need to access the original access
  function from the outside later, we can expose the getter again.

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

llvm-svn: 219612
2014-10-13 12:58:03 +00:00
Alexander Kornienko f305000a91 [clang-tidy] misc-braces-around-statements.ShortStatementLines option
Add option ShortStatementLines to trigger this check only if the statement spans
over at least a given number of lines.

Modifications from the original patch:
  merged test/clang-tidy/misc-braces-around-statements-always.cpp into
  test/clang-tidy/misc-braces-around-statements.cpp and removed unnecessary
  CHECK-NOTs from the tests.

http://reviews.llvm.org/D5642

Patch by Marek Kurdej!

llvm-svn: 219611
2014-10-13 12:46:22 +00:00
Yuri Gorshenin ab1b88ab59 [asan-asm-instrumentation] Follow-up fixes to r219602: asserts are moved into
function.

llvm-svn: 219610
2014-10-13 11:44:06 +00:00
Manuel Klimek 3f840a934e Re-structure clang-rename into a library and the tool.
This allows the unit tests to link the library.

Patch by Xin Huang.

llvm-svn: 219609
2014-10-13 11:30:27 +00:00
Bradley Smith 76d2e24bb8 [AArch64] Fixup test from A53 erratum patch after buildbot failures
Don't include stdint.h directly, instead typedef int64_t which is all we need.

llvm-svn: 219608
2014-10-13 11:18:05 +00:00
Renato Golin 5886bc35b0 Adds support for the Cortex-A17 processor to Clang
Patch by Matthew Wahab.

llvm-svn: 219607
2014-10-13 10:22:48 +00:00
Renato Golin 16ea8ba3bc Adds support for the Cortex-A17 to the ARM backend
Patch by Matthew Wahab.

llvm-svn: 219606
2014-10-13 10:22:19 +00:00
Daniel Sanders 642daf0c0c [mips] Mark redundant instructions with a comment in test/CodeGen/Mips/Fast-ISel/icmpa.ll.
llvm-svn: 219605
2014-10-13 10:18:02 +00:00
Bradley Smith 9ff64332a0 [AArch64] Add workaround for Cortex-A53 erratum (835769)
Some early revisions of the Cortex-A53 have an erratum (835769) whereby it is
possible for a 64-bit multiply-accumulate instruction in AArch64 state to
generate an incorrect result.  The details are quite complex and hard to
determine statically, since branches in the code may exist in some
circumstances, but all cases end with a memory (load, store, or prefetch)
instruction followed immediately by the multiply-accumulate operation.

The safest work-around for this issue is to make the compiler avoid emitting
multiply-accumulate instructions immediately after memory instructions and the
simplest way to do this is to insert a NOP.

This patch implements clang options to enable this workaround in the backend.

The work-around code generation is not enabled by default.

llvm-svn: 219604
2014-10-13 10:16:06 +00:00
Bradley Smith f2a801d8ac [AArch64] Add workaround for Cortex-A53 erratum (835769)
Some early revisions of the Cortex-A53 have an erratum (835769) whereby it is
possible for a 64-bit multiply-accumulate instruction in AArch64 state to
generate an incorrect result.  The details are quite complex and hard to
determine statically, since branches in the code may exist in some
 circumstances, but all cases end with a memory (load, store, or prefetch)
instruction followed immediately by the multiply-accumulate operation.

The safest work-around for this issue is to make the compiler avoid emitting
multiply-accumulate instructions immediately after memory instructions and the
simplest way to do this is to insert a NOP.

This patch implements such work-around in the backend, enabled via the option
-aarch64-fix-cortex-a53-835769.

The work-around code generation is not enabled by default.

llvm-svn: 219603
2014-10-13 10:12:35 +00:00
Yuri Gorshenin 46853b55fa [asan-asm-instrumentation] Fixed memory references which includes %rsp as a base or an index register.
Summary: [asan-asm-instrumentation] Fixed memory references which includes %rsp as a base or an index register.

Reviewers: eugenis

Subscribers: llvm-commits

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

llvm-svn: 219602
2014-10-13 09:37:47 +00:00
Alexey Bataev 106f68cd97 Fix incompatibility issue in /OpenMP/parallel_num_threads_codegen.cpp
llvm-svn: 219601
2014-10-13 08:51:32 +00:00
Dmitry Vyukov 02ff8bb986 tsan: better reporting for virtual-call-after-free
Previously we said that it's a data race, which is confusing
if it happens in the same thread.

llvm-svn: 219600
2014-10-13 08:46:25 +00:00
Alexey Bataev b205978100 [OPENMP] Codegen for 'num_threads' clause in 'parallel' directive.
This patch generates call to "kmpc_push_num_threads(ident_t *loc, kmp_int32 global_tid, kmp_int32 num_threads);" library function before calling "kmpc_fork_call" each time there is an associated "num_threads" clause in the "omp parallel" directive.
Differential Revision: http://reviews.llvm.org/D5145

llvm-svn: 219599
2014-10-13 08:23:51 +00:00
Alexey Bataev c451a40e9d Fix test OpenMP/parallel_if_codegen.cpp.
llvm-svn: 219598
2014-10-13 06:21:04 +00:00
Alexey Bataev d74d060d6d [OPENMP] Codegen for 'if' clause in 'parallel' directive.
Adds codegen for 'if' clause. Currently only for 'if' clause used with the 'parallel' directive.
If condition evaluates to true, the code executes parallel version of the code by calling __kmpc_fork_call(loc, 1, microtask, captured_struct/*context*/), where loc - debug location, 1 - number of additional parameters after "microtask" argument, microtask - is outlined finction for the code associated with the 'parallel' directive, captured_struct - list of variables captured in this outlined function.
If condition evaluates to false, the code executes serial version of the code by executing the following code:

global_thread_id.addr = alloca i32
store i32 global_thread_id, global_thread_id.addr
zero.addr = alloca i32
store i32 0, zero.addr
kmpc_serialized_parallel(loc, global_thread_id);
microtask(global_thread_id.addr, zero.addr, captured_struct/*context*/);
kmpc_end_serialized_parallel(loc, global_thread_id);

Where loc - debug location, global_thread_id - global thread id, returned by __kmpc_global_thread_num() call or passed as a first parameter in microtask() call, global_thread_id.addr - address of the variable, where stored global_thread_id value, zero.addr - implicit bound thread id (should be set to 0 for serial call), microtask() and captured_struct are the same as in parallel call.

Also this patch checks if the condition is constant and if it is constant it evaluates its value and then generates either parallel version of the code (if the condition evaluates to true), or the serial version of the code (if the condition evaluates to false).
Differential Revision: http://reviews.llvm.org/D4716

llvm-svn: 219597
2014-10-13 06:02:40 +00:00
NAKAMURA Takumi 59fe0d4e56 Unix/Signals.inc: Let findModulesAndOffsets() built conditionally regarding to (defined(HAVE_BACKTRACE) && defined(ENABLE_BACKTRACES)). [-Wunused-function]
llvm-svn: 219596
2014-10-13 04:32:43 +00:00
NAKAMURA Takumi 75a0240056 Revert r219584, "[X86] Memory folding for commutative instructions."
It broke i686 selfhosting.

llvm-svn: 219595
2014-10-13 04:17:34 +00:00
Alexey Bataev 4dcead4bc3 PredefinedExpr deserialization test in dependent context.
For commit r219561 - Fix deserialization of PredefinedExpr in dependent context.

llvm-svn: 219594
2014-10-13 03:27:35 +00:00