platform/upstream/llvm.git
10 years agoDon't include DFAPacketizer in TargetInstrInfo, there's no reason.
Eric Christopher [Tue, 14 Oct 2014 01:13:53 +0000 (01:13 +0000)]
Don't include DFAPacketizer in TargetInstrInfo, there's no reason.

llvm-svn: 219653

10 years agoInclude map into the A15SDOptimizer rather than pick it up
Eric Christopher [Tue, 14 Oct 2014 01:13:51 +0000 (01:13 +0000)]
Include map into the A15SDOptimizer rather than pick it up
transitively from the DFAPacketizer via TargetInstrInfo.h.

llvm-svn: 219652

10 years agoRemove the TargetMachine from DFAPacketizer since it was only
Eric Christopher [Tue, 14 Oct 2014 01:03:16 +0000 (01:03 +0000)]
Remove the TargetMachine from DFAPacketizer since it was only
being used to grab subtarget specific things that we can grab
from the MachineFunction anyhow.

llvm-svn: 219650

10 years agoRevert "Frontend: Extract SerializedDiagnosticReader out of CXLoadedDiagnostic (NFC)"
Justin Bogner [Tue, 14 Oct 2014 00:57:34 +0000 (00:57 +0000)]
Revert "Frontend: Extract SerializedDiagnosticReader out of CXLoadedDiagnostic (NFC)"

The bots can't seem to find an include file. Reverting for now and
I'll look into it in a bit.

This reverts commits r219647 and r219648.

llvm-svn: 219649

10 years agoFrontend: Try to fix cmake builders after r219647
Justin Bogner [Tue, 14 Oct 2014 00:51:18 +0000 (00:51 +0000)]
Frontend: Try to fix cmake builders after r219647

Looks like I missed a dependency here.

llvm-svn: 219648

10 years agoFrontend: Extract SerializedDiagnosticReader out of CXLoadedDiagnostic (NFC)
Justin Bogner [Tue, 14 Oct 2014 00:40:55 +0000 (00:40 +0000)]
Frontend: Extract SerializedDiagnosticReader out of CXLoadedDiagnostic (NFC)

We currently read serialized diagnostics directly in the C API, which
makes it difficult to reuse this logic elsewhere. This extracts the
core of the serialized diagnostic parsing logic into a base class that
can be subclassed using a visitor pattern.

llvm-svn: 219647

10 years agoIntroduce Go coding standards for LLVM.
Peter Collingbourne [Tue, 14 Oct 2014 00:40:53 +0000 (00:40 +0000)]
Introduce Go coding standards for LLVM.

Rather than define our own standards, we adopt a set of best practices that
are already in use by the Go community.

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

llvm-svn: 219646

10 years agofix formatting; NFC
Sanjay Patel [Tue, 14 Oct 2014 00:33:23 +0000 (00:33 +0000)]
fix formatting; NFC

llvm-svn: 219645

10 years agoAdd some optional passes around the vectorizer to both better prepare
Chandler Carruth [Tue, 14 Oct 2014 00:31:29 +0000 (00:31 +0000)]
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

10 years agoIntroduce LLVMWriteBitcodeToMemoryBuffer C API function.
Peter Collingbourne [Tue, 14 Oct 2014 00:30:59 +0000 (00:30 +0000)]
Introduce LLVMWriteBitcodeToMemoryBuffer C API function.

llvm-svn: 219643

10 years agoSanitize upcasts and conversion to virtual base.
Alexey Samsonov [Mon, 13 Oct 2014 23:59:00 +0000 (23:59 +0000)]
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

10 years agoResolve non-pointer isas for metaclasses.
Sean Callanan [Mon, 13 Oct 2014 23:03:49 +0000 (23:03 +0000)]
Resolve non-pointer isas for metaclasses.
Patch by Enrico Granata.
<rdar://problem/18618298>

llvm-svn: 219641

10 years agoUpdating documentation as per Chandler's feedback.
Chris Bieneman [Mon, 13 Oct 2014 23:03:45 +0000 (23:03 +0000)]
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

10 years agoInstCombine: Fix miscompile in X % -Y -> X % Y transform
David Majnemer [Mon, 13 Oct 2014 22:37:51 +0000 (22:37 +0000)]
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

10 years agoRemoving the static destructor from ManagedStatic.cpp by controlling the allocation...
Chris Bieneman [Mon, 13 Oct 2014 22:37:25 +0000 (22:37 +0000)]
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

10 years agoFix the build
David Majnemer [Mon, 13 Oct 2014 22:18:22 +0000 (22:18 +0000)]
Fix the build

llvm-svn: 219637

10 years agoMigrate another set of getSubtargetImpl away.
Eric Christopher [Mon, 13 Oct 2014 21:57:44 +0000 (21:57 +0000)]
Migrate another set of getSubtargetImpl away.

llvm-svn: 219636

10 years agoRemove unused debug info constants.
Peter Collingbourne [Mon, 13 Oct 2014 21:50:30 +0000 (21:50 +0000)]
Remove unused debug info constants.

These became unused in r219010.

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

llvm-svn: 219635

10 years agoInstCombine: Don't miscompile (x lshr C1) udiv C2
David Majnemer [Mon, 13 Oct 2014 21:48:30 +0000 (21:48 +0000)]
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

10 years agoMake first of several changes to bring up to AArch64 fast-isel style
Reed Kotler [Mon, 13 Oct 2014 21:46:41 +0000 (21:46 +0000)]
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

10 years agoFix minor typos in comments.
Filipe Cabecinhas [Mon, 13 Oct 2014 21:40:52 +0000 (21:40 +0000)]
Fix minor typos in comments.

llvm-svn: 219632

10 years agoUpdate the example of using a command-line option custom parser to
Paul Robinson [Mon, 13 Oct 2014 21:11:22 +0000 (21:11 +0000)]
Update the example of using a command-line option custom parser to
match the current implementation.

Patch by Douglas Yung!

llvm-svn: 219631

10 years agoObjective-C [Sema]. Fixes a bug in comparing qualified
Fariborz Jahanian [Mon, 13 Oct 2014 21:07:45 +0000 (21:07 +0000)]
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

10 years agoCorrectly export _Unwind_[GS]et(GR|IP) for EHABI.
Dan Albert [Mon, 13 Oct 2014 21:01:30 +0000 (21:01 +0000)]
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

10 years agoAdd an assertion about the integrity of the iterator.
Adrian Prantl [Mon, 13 Oct 2014 20:44:58 +0000 (20:44 +0000)]
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

10 years agoconstify the getters in SDNodeDbgValue.
Adrian Prantl [Mon, 13 Oct 2014 20:43:47 +0000 (20:43 +0000)]
constify the getters in SDNodeDbgValue.

llvm-svn: 219627

10 years agoRefactor debug statement and remove dead argument. NFC.
Chad Rosier [Mon, 13 Oct 2014 19:46:39 +0000 (19:46 +0000)]
Refactor debug statement and remove dead argument. NFC.

llvm-svn: 219626

10 years ago[analyzer] Check all 'nonnull' attributes, not just the first one.
Jordan Rose [Mon, 13 Oct 2014 19:38:02 +0000 (19:38 +0000)]
[analyzer] Check all 'nonnull' attributes, not just the first one.

Patch by Daniel Fahlgren!

llvm-svn: 219625

10 years agoFix order of evaluation bug in DynTypedMatcher::constructVariadic().
Samuel Benzaquen [Mon, 13 Oct 2014 18:17:11 +0000 (18:17 +0000)]
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

10 years agocleanup comments and remove an obsolete workaround
Adrian Prantl [Mon, 13 Oct 2014 18:04:10 +0000 (18:04 +0000)]
cleanup comments and remove an obsolete workaround

llvm-svn: 219623

10 years agoFix bug in DynTypedMatcher::constructVariadic() that would cause false negatives.
Samuel Benzaquen [Mon, 13 Oct 2014 17:38:12 +0000 (17:38 +0000)]
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

10 years agoAdd VS2012-generated test inputs for test/tools/llvm-readobj/codeview-linetables...
Timur Iskhodzhanov [Mon, 13 Oct 2014 17:03:13 +0000 (17:03 +0000)]
Add VS2012-generated test inputs for test/tools/llvm-readobj/codeview-linetables.test

llvm-svn: 219621

10 years agoDon't lock the IOHandlerList::m_mutex in Debugger::RunIOHandler(...) since if a proce...
Greg Clayton [Mon, 13 Oct 2014 16:54:26 +0000 (16:54 +0000)]
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

10 years agoRelinquish ownership of MS-style inline assembly.
Chad Rosier [Mon, 13 Oct 2014 16:45:21 +0000 (16:45 +0000)]
Relinquish ownership of MS-style inline assembly.

llvm-svn: 219619

10 years agoAddress review comments from Justin Bogner.
Adrian Prantl [Mon, 13 Oct 2014 16:34:31 +0000 (16:34 +0000)]
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

10 years agoFix a broadcast related regression on the vector shuffle lowering.
Filipe Cabecinhas [Mon, 13 Oct 2014 16:16:16 +0000 (16:16 +0000)]
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

10 years agoR600/SI: Minor cleanup of function
Matt Arsenault [Mon, 13 Oct 2014 15:47:59 +0000 (15:47 +0000)]
R600/SI: Minor cleanup of function

llvm-svn: 219616

10 years agoMore OpenMP test case compatibility fixes
Ulrich Weigand [Mon, 13 Oct 2014 13:49:39 +0000 (13:49 +0000)]
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

10 years ago[Refactor][NfC] Simplify and clean the handling of (new) access relations
Johannes Doerfert [Mon, 13 Oct 2014 12:58:03 +0000 (12:58 +0000)]
[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

10 years ago[clang-tidy] misc-braces-around-statements.ShortStatementLines option
Alexander Kornienko [Mon, 13 Oct 2014 12:46:22 +0000 (12:46 +0000)]
[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

10 years ago[asan-asm-instrumentation] Follow-up fixes to r219602: asserts are moved into
Yuri Gorshenin [Mon, 13 Oct 2014 11:44:06 +0000 (11:44 +0000)]
[asan-asm-instrumentation] Follow-up fixes to r219602: asserts are moved into
function.

llvm-svn: 219610

10 years agoRe-structure clang-rename into a library and the tool.
Manuel Klimek [Mon, 13 Oct 2014 11:30:27 +0000 (11:30 +0000)]
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

10 years ago[AArch64] Fixup test from A53 erratum patch after buildbot failures
Bradley Smith [Mon, 13 Oct 2014 11:18:05 +0000 (11:18 +0000)]
[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

10 years agoAdds support for the Cortex-A17 processor to Clang
Renato Golin [Mon, 13 Oct 2014 10:22:48 +0000 (10:22 +0000)]
Adds support for the Cortex-A17 processor to Clang

Patch by Matthew Wahab.

llvm-svn: 219607

10 years agoAdds support for the Cortex-A17 to the ARM backend
Renato Golin [Mon, 13 Oct 2014 10:22:19 +0000 (10:22 +0000)]
Adds support for the Cortex-A17 to the ARM backend

Patch by Matthew Wahab.

llvm-svn: 219606

10 years ago[mips] Mark redundant instructions with a comment in test/CodeGen/Mips/Fast-ISel...
Daniel Sanders [Mon, 13 Oct 2014 10:18:02 +0000 (10:18 +0000)]
[mips] Mark redundant instructions with a comment in test/CodeGen/Mips/Fast-ISel/icmpa.ll.

llvm-svn: 219605

10 years ago[AArch64] Add workaround for Cortex-A53 erratum (835769)
Bradley Smith [Mon, 13 Oct 2014 10:16:06 +0000 (10:16 +0000)]
[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

10 years ago[AArch64] Add workaround for Cortex-A53 erratum (835769)
Bradley Smith [Mon, 13 Oct 2014 10:12:35 +0000 (10:12 +0000)]
[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

10 years ago[asan-asm-instrumentation] Fixed memory references which includes %rsp as a base...
Yuri Gorshenin [Mon, 13 Oct 2014 09:37:47 +0000 (09:37 +0000)]
[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

10 years agoFix incompatibility issue in /OpenMP/parallel_num_threads_codegen.cpp
Alexey Bataev [Mon, 13 Oct 2014 08:51:32 +0000 (08:51 +0000)]
Fix incompatibility issue in /OpenMP/parallel_num_threads_codegen.cpp

llvm-svn: 219601

10 years agotsan: better reporting for virtual-call-after-free
Dmitry Vyukov [Mon, 13 Oct 2014 08:46:25 +0000 (08:46 +0000)]
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

10 years ago[OPENMP] Codegen for 'num_threads' clause in 'parallel' directive.
Alexey Bataev [Mon, 13 Oct 2014 08:23:51 +0000 (08:23 +0000)]
[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

10 years agoFix test OpenMP/parallel_if_codegen.cpp.
Alexey Bataev [Mon, 13 Oct 2014 06:21:04 +0000 (06:21 +0000)]
Fix test OpenMP/parallel_if_codegen.cpp.

llvm-svn: 219598

10 years ago[OPENMP] Codegen for 'if' clause in 'parallel' directive.
Alexey Bataev [Mon, 13 Oct 2014 06:02:40 +0000 (06:02 +0000)]
[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

10 years agoUnix/Signals.inc: Let findModulesAndOffsets() built conditionally regarding to (defin...
NAKAMURA Takumi [Mon, 13 Oct 2014 04:32:43 +0000 (04:32 +0000)]
Unix/Signals.inc: Let findModulesAndOffsets() built conditionally regarding to (defined(HAVE_BACKTRACE) && defined(ENABLE_BACKTRACES)). [-Wunused-function]

llvm-svn: 219596

10 years agoRevert r219584, "[X86] Memory folding for commutative instructions."
NAKAMURA Takumi [Mon, 13 Oct 2014 04:17:34 +0000 (04:17 +0000)]
Revert r219584, "[X86] Memory folding for commutative instructions."

It broke i686 selfhosting.

llvm-svn: 219595

10 years agoPredefinedExpr deserialization test in dependent context.
Alexey Bataev [Mon, 13 Oct 2014 03:27:35 +0000 (03:27 +0000)]
PredefinedExpr deserialization test in dependent context.
For commit r219561 - Fix deserialization of PredefinedExpr in dependent context.

llvm-svn: 219594

10 years ago[modules] Stop excluding Support/Debug.h from the Support module. This header
Richard Smith [Mon, 13 Oct 2014 00:41:03 +0000 (00:41 +0000)]
[modules] Stop excluding Support/Debug.h from the Support module. This header
has been modular since r206822, and excluding it was leading to workarounds
such as the one in r219592, which this change removes.

llvm-svn: 219593

10 years ago[Modules] Add some missing includes to make files compile stand-alone.
Benjamin Kramer [Sun, 12 Oct 2014 22:49:26 +0000 (22:49 +0000)]
[Modules] Add some missing includes to make files compile stand-alone.

llvm-svn: 219592

10 years ago[Modules] Make header standalone. NFC.
Benjamin Kramer [Sun, 12 Oct 2014 22:49:21 +0000 (22:49 +0000)]
[Modules] Make header standalone. NFC.

llvm-svn: 219591

10 years agoFixed a problem in r19589.
Tyler Nowicki [Sun, 12 Oct 2014 21:28:02 +0000 (21:28 +0000)]
Fixed a problem in r19589.

Several systems failed to compile the array allocation of the TokenArray.

llvm-svn: 219590

10 years agoAllow constant expressions in pragma loop hints.
Tyler Nowicki [Sun, 12 Oct 2014 20:46:07 +0000 (20:46 +0000)]
Allow constant expressions in pragma loop hints.

Previously loop hints such as #pragma loop vectorize_width(#) required a constant. This patch allows a constant expression to be used as well. Such as a non-type template parameter or an expression (2 * c + 1).

Reviewed by Richard Smith

llvm-svn: 219589

10 years agoModernize old-style static asserts. NFC.
Benjamin Kramer [Sun, 12 Oct 2014 17:56:40 +0000 (17:56 +0000)]
Modernize old-style static asserts. NFC.

llvm-svn: 219588

10 years agoRevert r219223, it creates invalid PHI nodes.
Joerg Sonnenberger [Sun, 12 Oct 2014 17:16:04 +0000 (17:16 +0000)]
Revert r219223, it creates invalid PHI nodes.

llvm-svn: 219587

10 years agoAPSInt: Simplify code to reduce the number of copies. No functionality change.
Benjamin Kramer [Sun, 12 Oct 2014 15:36:31 +0000 (15:36 +0000)]
APSInt: Simplify code to reduce the number of copies. No functionality change.

llvm-svn: 219586

10 years agoInstCombine: Turn (x != 0 & x <u C) into the canonical range check form (x-1 <u C-1)
Benjamin Kramer [Sun, 12 Oct 2014 14:02:34 +0000 (14:02 +0000)]
InstCombine: Turn (x != 0 & x <u C) into the canonical range check form (x-1 <u C-1)

llvm-svn: 219585

10 years ago[X86] Memory folding for commutative instructions.
Simon Pilgrim [Sun, 12 Oct 2014 10:52:55 +0000 (10:52 +0000)]
[X86] Memory folding for commutative instructions.

This patch improves support for commutative instructions in the x86 memory folding implementation by attempting to fold a commuted version of the instruction if the original folding fails - if that folding fails as well the instruction is 're-commuted' back to its original order before returning.

This mainly helps the stack inliner better fold reloads of 3 (or more) operand instructions (VEX encoded SSE etc.) but by performing this in the lowest foldMemoryOperandImpl implementation it also replaces the X86InstrInfo::optimizeLoadInstr version and is now used by FastISel too.

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

llvm-svn: 219584

10 years agoInstCombine: Simplify commonIDivTransforms
David Majnemer [Sun, 12 Oct 2014 08:34:24 +0000 (08:34 +0000)]
InstCombine: Simplify commonIDivTransforms

A helper routine, MultiplyOverflows, was a less efficient
reimplementation of APInt's smul_ov and umul_ov.  While we are here,
clean up the code so it's more uniform.

No functionality change intended.

llvm-svn: 219583

10 years agoCodeGen: Strip qualifiers from qualified array types in catches
David Majnemer [Sun, 12 Oct 2014 06:58:22 +0000 (06:58 +0000)]
CodeGen: Strip qualifiers from qualified array types in catches

While we ran getUnqualifiedType over the catch type,
it isn't enough for array types.  Use getUnqualifiedArrayType instead.

This fixes PR21252.

llvm-svn: 219582

10 years agollvm/test/CodeGen: Some tests don't REQUIRE asserts any more. Remove them.
NAKAMURA Takumi [Sun, 12 Oct 2014 06:47:47 +0000 (06:47 +0000)]
llvm/test/CodeGen: Some tests don't REQUIRE asserts any more. Remove them.

llvm-svn: 219581

10 years agoclang/test/Driver: Some tests don't REQUIRE asserts any more. Remove them.
NAKAMURA Takumi [Sun, 12 Oct 2014 06:44:05 +0000 (06:44 +0000)]
clang/test/Driver: Some tests don't REQUIRE asserts any more. Remove them.

llvm-svn: 219580

10 years agoSuppress llvm-ar's MRI tests for now on win32, since line_iterator is incompatible...
NAKAMURA Takumi [Sat, 11 Oct 2014 22:21:27 +0000 (22:21 +0000)]
Suppress llvm-ar's MRI tests for now on win32, since line_iterator is incompatible to CRLF.

llvm-svn: 219579

10 years agollgs: fixes to PTY/gdb-remote inferior stdout/stderr handling, logging addtions.
Todd Fiala [Sat, 11 Oct 2014 21:42:09 +0000 (21:42 +0000)]
llgs: fixes to PTY/gdb-remote inferior stdout/stderr handling, logging addtions.

With this change, both local-process llgs and remote-target llgs stdout/stderr
handling from inferior work correctly.

Several log lines have been added around PTY and stdout/stderr redirection
logic on the lldb client side.

Regarding remote llgs execution, see the following:

With these changes, remote llgs with $O now works properly:

$ lldb
(lldb) platform select remote-linux
(lldb) target create ~/some/inferior/exe
(lldb) gdb-remote {some-target}:{port}
(lldb) run

The sequence above will correctly redirect stdout/stderr over gdb-remote $O,
as is needed for remote debugging.  That sequence assumes there is a lldb-gdbserver
exe running on the target with {some-host}:{port}.

You can replace the gdb-remote command with a '(lldb) platform connect
connect://{target-ip}:{target-port}'.  If you do this and have a
lldb-platform running on the remote end, it will go ahead and launch
llgs for lldb for each target instance that is run/attached.

For local debugging with llgs, the following sequence also works, and
uses local PTYs instead to avoid $O and extra gdb-remote messages:

$ lldb
(lldb) settings set platform.plugin.linux.use-llgs true
(lldb) target create ~/some/inferior/exe
(lldb) run

The above will run the inferior using llgs on the local host, and
will use PTYs rather than $O redirection.

This change also removes the logging that happened after the fork but
before the exec when llgs is launching a new inferior process.  Some
aspect of the file handling during that portion of code would not do
the right thing with log handling.  We might want to go back later
and have that communicate over a pipe from the child to parent to pass
along any messages that previously were logged in that section of code.

llvm-svn: 219578

10 years agoTest commit access (email fix)
Simon Pilgrim [Sat, 11 Oct 2014 20:28:56 +0000 (20:28 +0000)]
Test commit access (email fix)

Indentation tidyup.

llvm-svn: 219577

10 years agoFix cmake build for PluginInstrumentationRuntimeAddressSanitizer.
Todd Fiala [Sat, 11 Oct 2014 20:11:18 +0000 (20:11 +0000)]
Fix cmake build for PluginInstrumentationRuntimeAddressSanitizer.

llvm-svn: 219576

10 years agoAssumptionTracker: Don't create temporary CallbackVHs.
Benjamin Kramer [Sat, 11 Oct 2014 19:13:01 +0000 (19:13 +0000)]
AssumptionTracker: Don't create temporary CallbackVHs.

Those are expensive to create in cold cache scenarios. NFC.

llvm-svn: 219575

10 years agoMC: Shrink MCSymbolRefExpr by only storing the bits we need.
Benjamin Kramer [Sat, 11 Oct 2014 17:57:27 +0000 (17:57 +0000)]
MC: Shrink MCSymbolRefExpr by only storing the bits we need.

32 -> 16 bytes on x86_64. NFC.

llvm-svn: 219574

10 years agoMC: Bit pack MCSymbolData.
Benjamin Kramer [Sat, 11 Oct 2014 15:07:21 +0000 (15:07 +0000)]
MC: Bit pack MCSymbolData.

On x86_64 this brings it from 80 bytes to 64 bytes. Also make any member
variables private and clean up uses to go through the existing accessors.

NFC.

llvm-svn: 219573

10 years agoTest commit access
Simon Pilgrim [Sat, 11 Oct 2014 14:23:36 +0000 (14:23 +0000)]
Test commit access

Fix comment typo + spelling.

llvm-svn: 219572

10 years agoSuppress a warning about an unused variable in NDEBUG builds.
Chandler Carruth [Sat, 11 Oct 2014 11:29:26 +0000 (11:29 +0000)]
Suppress a warning about an unused variable in NDEBUG builds.

llvm-svn: 219571

10 years ago[complex] Teach the other two binary operators on complex numbers (==
Chandler Carruth [Sat, 11 Oct 2014 11:03:30 +0000 (11:03 +0000)]
[complex] Teach the other two binary operators on complex numbers (==
and !=) to support mixed complex and real operand types.

This requires removing an assert from SemaChecking, and adding support
both to the constant evaluator and the code generator to synthesize the
imaginary part when needed. This seemed somewhat cleaner than having
just the comparison operators force real-to-complex conversions.

I've added test cases for these operations. I'm really terrified that
there were *no* tests in-tree which exercised this.

This turned up when trying to build R after my change to the complex
type lowering.

llvm-svn: 219570

10 years agoFix typo in ARM reserved-r9 test case
Renato Golin [Sat, 11 Oct 2014 10:34:18 +0000 (10:34 +0000)]
Fix typo in ARM reserved-r9 test case

Patch by Charlie Turner.

llvm-svn: 219569

10 years agoInstCombine: Don't fold (X <<s log(INT_MIN)) /s INT_MIN to X
David Majnemer [Sat, 11 Oct 2014 10:20:04 +0000 (10:20 +0000)]
InstCombine: Don't fold (X <<s log(INT_MIN)) /s INT_MIN to X

Consider the case where X is 2.  (2 <<s 31)/s-2147483648 is zero but we
would fold to X.  Note that this is valid when we are in the unsigned
domain because we require NUW: 2 <<u 31 results in poison.

This fixes PR21245.

llvm-svn: 219568

10 years agoInstCombine, InstSimplify: (%X /s C1) /s C2 isn't always 0 when C1 * C2 overflow
David Majnemer [Sat, 11 Oct 2014 10:20:01 +0000 (10:20 +0000)]
InstCombine, InstSimplify: (%X /s C1) /s C2 isn't always 0 when C1 * C2 overflow

consider:
C1 = INT_MIN
C2 = -1

C1 * C2 overflows without a doubt but consider the following:
%x = i32 INT_MIN

This means that (%X /s C1) is 1 and (%X /s C1) /s C2 is -1.

N. B.  Move the unsigned version of this transform to InstSimplify, it
doesn't create any new instructions.

This fixes PR21243.

llvm-svn: 219567

10 years agoInstCombine: mul to shl shouldn't preserve nsw
David Majnemer [Sat, 11 Oct 2014 10:19:52 +0000 (10:19 +0000)]
InstCombine: mul to shl shouldn't preserve nsw

consider:
mul i32 nsw %x, -2147483648

this instruction will not result in poison if %x is 1

however, if we transform this into:
shl i32 nsw %x, 31

then we will be generating poison because we just shifted into the sign
bit.

This fixes PR21242.

llvm-svn: 219566

10 years ago[complex] Use the much more powerful EmitCall routine to call libcalls
Chandler Carruth [Sat, 11 Oct 2014 09:24:41 +0000 (09:24 +0000)]
[complex] Use the much more powerful EmitCall routine to call libcalls
for complex math.

This should fix the windows build bots that started having trouble here
and generally fix complex libcall emission on targets which use sret for
complex data types. It also makes the code a bit simpler (despite
calling into a much more complex bucket of code).

llvm-svn: 219565

10 years agoclang-format: [ObjC] Wrap ObjC method declarations before annotations.
Daniel Jasper [Sat, 11 Oct 2014 08:24:56 +0000 (08:24 +0000)]
clang-format: [ObjC] Wrap ObjC method declarations before annotations.

Before:
  - (instancetype)initXxxxxxxxxxxxxxxxxxxxxxxxx:(id<x>)x
                                              y:(id<yyyyyyyyyyyyyyyyyyyy>)
                                                    y NS_DESIGNATED_INITIALIZER;
After:
  - (instancetype)initXxxxxxxxxxxxxxxxxxxxxxxxx:(id<x>)x
                                              y:(id<yyyyyyyyyyyyyyyyyyyy>)y
      NS_DESIGNATED_INITIALIZER;

llvm-svn: 219564

10 years ago[UBSan] Disable one run line of this test to allow the test as a whole
Chandler Carruth [Sat, 11 Oct 2014 06:49:00 +0000 (06:49 +0000)]
[UBSan] Disable one run line of this test to allow the test as a whole
to pass in an opt build.

The test case in question does show UBSan catching the error, but it
doesn't then successfully set the exit code of the program. I'll let the
UBSan folks sort out why. It should reproduce trivially with an
optimized build.

llvm-svn: 219563

10 years ago[SCEV] Fix one more caller blindly passing the latch to SCEV's
Chandler Carruth [Sat, 11 Oct 2014 05:28:30 +0000 (05:28 +0000)]
[SCEV] Fix one more caller blindly passing the latch to SCEV's
getSmallConstantTripCount even when it isn't the exiting block.

I missed this in my first audit, very sorry. This was found in LNT and
elsewhere. I don't have a test case, but it was completely obvious from
inspection that this was the problem. I'll see if I can reduce a test
case, but I'm not really hopeful, and the value seems quite low.

llvm-svn: 219562

10 years agoFix deserialization of PredefinedExpr in dependent context.
Alexey Bataev [Sat, 11 Oct 2014 05:07:24 +0000 (05:07 +0000)]
Fix deserialization of PredefinedExpr in dependent context.

llvm-svn: 219561

10 years agoAdd a IsInstrumentationRuntimePresent SB API
Kuba Brecka [Sat, 11 Oct 2014 01:59:32 +0000 (01:59 +0000)]
Add a IsInstrumentationRuntimePresent SB API

Reviewed at http://reviews.llvm.org/D5738

This adds an SB API into SBProcess:
  bool SBProcess::IsInstrumentationRuntimePresent(InstrumentationRuntimeType type);
which simply tells whether a particular InstrumentationRuntime (read "ASan") plugin is present and active.

llvm-svn: 219560

10 years ago[UBSan] Fix UBSan testcase for float->int conversion after LLVM r219542.
Alexey Samsonov [Sat, 11 Oct 2014 01:34:16 +0000 (01:34 +0000)]
[UBSan] Fix UBSan testcase for float->int conversion after LLVM r219542.

llvm-svn: 219559

10 years agoGuard the definition of the stack tracing function with the same macros
Chandler Carruth [Sat, 11 Oct 2014 01:04:40 +0000 (01:04 +0000)]
Guard the definition of the stack tracing function with the same macros
that guard its usage. Without this, we can get unused function warnings
when backtraces are disabled.

llvm-svn: 219558

10 years ago[complex] Teach Clang to preserve different-type operands to arithmetic
Chandler Carruth [Sat, 11 Oct 2014 00:57:18 +0000 (00:57 +0000)]
[complex] Teach Clang to preserve different-type operands to arithmetic
operators where one type is a C complex type, and to emit both the
efficient and correct implementation for complex arithmetic according to
C11 Annex G using this extra information.

For both multiply and divide the old code was writing a long-hand
reduced version of the math without any of the special handling of inf
and NaN recommended by the standard here. Instead of putting more
complexity here, this change does what GCC does which is to emit
a libcall for the fully general case.

However, the old code also failed to do the proper minimization of the
set of operations when there was a mixed complex and real operation. In
those cases, C provides a spec for much more minimal operations that are
valid. Clang now emits the exact suggested operations. This change isn't
*just* about performance though, without minimizing these operations, we
again lose the correct handling of infinities and NaNs. It is critical
that this happen in the frontend based on assymetric type operands to
complex math operations.

The performance implications of this change aren't trivial either. I've
run a set of benchmarks in Eigen, an open source mathematics library
that makes heavy use of complex. While a few have slowed down due to the
libcall being introduce, most sped up and some by a huge amount: up to
100% and 140%.

In order to make all of this work, also match the algorithm in the
constant evaluator to the one in the runtime library. Currently it is
a broken port of the simplifications from C's Annex G to the long-hand
formulation of the algorithm.

Splitting this patch up is very hard because none of this works without
the AST change to preserve non-complex operands. Sorry for the enormous
change.

Follow-up changes will include support for sinking the libcalls onto
cold paths in common cases and fastmath improvements to allow more
aggressive backend folding.

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

llvm-svn: 219557

10 years agoAdd basic conditional branches in mips fast-isel
Reed Kotler [Sat, 11 Oct 2014 00:55:18 +0000 (00:55 +0000)]
Add basic conditional branches in mips fast-isel

Summary: Implement the most basic form of conditional branches in Mips fast-isel.

Test Plan:
br1.ll
run 4 flavors of test-suite. mips32 r1/r2 and at -O0/O2

Reviewers: dsanders

Reviewed By: dsanders

Subscribers: llvm-commits, rfuhler

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

llvm-svn: 219556

10 years agoinclude compiler-rt in build-llvm.pl
Kuba Brecka [Sat, 11 Oct 2014 00:53:32 +0000 (00:53 +0000)]
include compiler-rt in build-llvm.pl

Reviewed at http://reviews.llvm.org/D5736

The new test cases for ASan fail if the llvm build that is used with LLDB doesn't have compiler-rt (because the resulting compiler then cannot build with -fsanitize=address). Let's include compiler-rt in build-llvm.pl script and make sure we actually *build* it by removing the NO_RUNTIME_LIBS=1 argument used in the make line. After this, the ASan tests pass on a fresh svn checkout.

llvm-svn: 219555

10 years agoFix the build after the recent plugin additions for
Eric Christopher [Sat, 11 Oct 2014 00:38:55 +0000 (00:38 +0000)]
Fix the build after the recent plugin additions for
AddressSanitizer by adding dependencies and definitions.

llvm-svn: 219554

10 years agoRework the way we pass "run multiple command" options to the various API's that
Jim Ingham [Sat, 11 Oct 2014 00:38:27 +0000 (00:38 +0000)]
Rework the way we pass "run multiple command" options to the various API's that
do that (RunCommandInterpreter, HandleCommands, HandleCommandsFromFile) to gather
the options into an options class.  Also expose that to the SB API's.

Change the way the "-o" options to the lldb driver are processed so:
1) They are run synchronously - didn't really make any sense to run the asynchronously.
2) The stop on error
3) "quit" in one of the -o commands will not quit lldb - not the command interpreter
that was running the -o commands.

I added an entry to the run options to stop-on-crash, but I haven't implemented that yet.

llvm-svn: 219553

10 years ago[modules] When instantiating a class member, don't expect to find the previous
Richard Smith [Sat, 11 Oct 2014 00:37:16 +0000 (00:37 +0000)]
[modules] When instantiating a class member, don't expect to find the previous
declaration in the instantiation if the previous declaration came from another
definition of the class template that got merged into the pattern definition.

llvm-svn: 219552

10 years agoclang-cl: Don't warn for unused private fields when encountering a late parsed templa...
Ehsan Akhgari [Sat, 11 Oct 2014 00:24:15 +0000 (00:24 +0000)]
clang-cl: Don't warn for unused private fields when encountering a late parsed template member

Summary: This fixes PR21235.

Test Plan: Includes an automated test.

Reviewers: hansw

Subscribers: cfe-commits

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

llvm-svn: 219551