platform/upstream/llvm.git
12 years agoWe need this symbol after an LTO build.
Bill Wendling [Fri, 12 Oct 2012 01:06:33 +0000 (01:06 +0000)]
We need this symbol after an LTO build.

llvm-svn: 165776

12 years agodocs: Add SphinxQuickstartTemplate.rst.
Sean Silva [Fri, 12 Oct 2012 00:53:48 +0000 (00:53 +0000)]
docs: Add SphinxQuickstartTemplate.rst.

The intent of this document is to be the go-to document for anybody who
wants to write new documentation, but isn't familiar with Sphinx.

llvm-svn: 165775

12 years agoConditionally use an integral cast for BodyFarm support for OSAtomicCompareAndSwap...
Ted Kremenek [Fri, 12 Oct 2012 00:18:19 +0000 (00:18 +0000)]
Conditionally use an integral cast for BodyFarm support for OSAtomicCompareAndSwap if the return type is not a boolean.

llvm-svn: 165774

12 years agoTrack which particular submodule #undef's a macro, so that the actual
Douglas Gregor [Fri, 12 Oct 2012 00:16:50 +0000 (00:16 +0000)]
Track which particular submodule #undef's a macro, so that the actual
#undef only occurs if that submodule is imported.

llvm-svn: 165773

12 years agoRemove dead code introduced in r165751.
Chad Rosier [Fri, 12 Oct 2012 00:02:48 +0000 (00:02 +0000)]
Remove dead code introduced in r165751.

llvm-svn: 165772

12 years agosearch for overridden methods with comment when overriding method
Fariborz Jahanian [Thu, 11 Oct 2012 23:52:50 +0000 (23:52 +0000)]
search for overridden methods with comment when overriding method
has none of its own. Factor in Doug's comments.
// rdar://12378793

llvm-svn: 165771

12 years agoRemove pointless classof()'s.
Sean Silva [Thu, 11 Oct 2012 23:31:23 +0000 (23:31 +0000)]
Remove pointless classof()'s.

Updates to llvm/Support/Casting.h have rendered these classof()'s
irrelevant.

llvm-svn: 165770

12 years agoAdd missing classof().
Sean Silva [Thu, 11 Oct 2012 23:31:18 +0000 (23:31 +0000)]
Add missing classof().

Somewhat troublingly, without this implemented, the check inside
isa_impl<> would silently use the parent's `classof()` when determining
whether it was okay to downcast from the parent to the child!

Bug analysis:

A build failure after removing the parent's `classof()` initially
alerted me to the bug, after which a little bit of thinking and reading
of the code identified the root cause.

The compiler could be made to prevent this bug from happening if there
were a way to ensure that in the code

    template <typename To, typename From, typename Enabler = void>
    struct isa_impl {
      static inline bool doit(const From &Val) {
        return To::classof(&Val);
      }
    };

that `To::classof` is actually inside the class `To`, and not in a base
class. I am not aware of a way to check this in C++. If there is a means
to perform that check, please bring it up on the list and this will be
fixed.

There is a high likelihood that there are other instances of this same
bug in the codebase.

llvm-svn: 165769

12 years agodocs: Improve HowToSetUpLLVMStyleRTTI.
Sean Silva [Thu, 11 Oct 2012 23:30:52 +0000 (23:30 +0000)]
docs: Improve HowToSetUpLLVMStyleRTTI.

* Fix confusing explanation regarding abstract classes.

* Clarify auto-upcasting and why `Shape` doesn't need a `classof()`.

* Add section `Rules of Thumb` with some quick summary tips.

llvm-svn: 165768

12 years agoRemove unnecessary classof()'s
Sean Silva [Thu, 11 Oct 2012 23:30:49 +0000 (23:30 +0000)]
Remove unnecessary classof()'s

isa<> et al. automatically infer when the cast is an upcast (including a
self-cast), so these are no longer necessary.

llvm-svn: 165767

12 years agodocs: Update HowToSetUpLLVMStyleRTTI.
Sean Silva [Thu, 11 Oct 2012 23:30:41 +0000 (23:30 +0000)]
docs: Update HowToSetUpLLVMStyleRTTI.

Recent changes to isa<>/dyn_cast<> have made unnecessary those classof()
of the form:

    static bool classof(const Foo *) { return true; }

Accordingly, remove mention of such classof() from the documentation.

llvm-svn: 165766

12 years agoCasting.h: Automatically handle isa<Base>(Derived).
Sean Silva [Thu, 11 Oct 2012 23:30:40 +0000 (23:30 +0000)]
Casting.h: Automatically handle isa<Base>(Derived).

Additionally, all such cases are handled with no dynamic check.

All `classof()` of the form

    class Foo {
      [...]
      static bool classof(const Bar *) { return true; }
      [...]
    }

where Foo is an ancestor of Bar are no longer necessary.
Don't write them!

Note: The exact test is `is_base_of<Foo, Bar>`, which is non-strict, so
that Foo is considered an ancestor of itself.

This leads to the following rule of thumb for LLVM-style RTTI:

    The argument type of `classof()` should be a strict ancestor.

For more information about implementing LLVM-style RTTI, see
docs/HowToSetUpLLVMStyleRTTI.rst

llvm-svn: 165765

12 years agoRemove buggy classof().
Sean Silva [Thu, 11 Oct 2012 23:30:38 +0000 (23:30 +0000)]
Remove buggy classof().

This classof() is effectively saying that a MachineCodeEmitter "is-a"
JITEmitter, but JITEmitter is in fact a descendant of
MachineCodeEmitter, so this is not semantically correct. Consequently,
none of the assertions that rely on these classof() actualy check
anything.

Remove the RTTI (which didn't actually check anything) and use
static_cast<> instead.

Post-Mortem Bug Analysis
========================

Cause of the bug
----------------

r55022 appears to be the source of the classof() and assertions removed
by this commit. It aimed at removing some dynamic_cast<> that were
solely in the assertions. A typical diff hunk from that commit looked
like:

  -  assert(dynamic_cast<JITEmitter*>(MCE) && "Unexpected MCE?");
  -  JITEmitter *JE = static_cast<JITEmitter*>(getCodeEmitter());
  +  assert(isa<JITEmitter>(MCE) && "Unexpected MCE?");
  +  JITEmitter *JE = cast<JITEmitter>(getCodeEmitter());

Hence, the source of the bug then seems to be an attempt to replace
dynamic_cast<> with LLVM-style RTTI without properly setting up the
class hierarchy for LLVM-style RTTI. The bug therefore appears to be
simply a "thinko".

What initially indicated the presence of the bug
------------------------------------------------

After implementing automatic upcasting for isa<>, classof() functions of
the form

  static bool classof(const Foo *) { return true; }

were removed, since they only serve the purpose of optimizing
statically-OK upcasts. A subsequent recompilation triggered a build
failure on the isa<> tests within the removed asserts, since the
automatic upcasting (correctly) failed to substitute this classof().

Key to pinning down the root cause of the bug
---------------------------------------------

After being alerted to the presence of the bug, some thought about the
semantics which were being asserted by the buggy classof() revealed that
it was incorrect.

How the bug could have been prevented
-------------------------------------

This bug could have been prevented by better documentation for how to
set up LLVM-style RTTI. This should be solved by the recently added
documentation HowToSetUpLLVMStyleRTTI. However, this bug suggests that
the documentation should clearly explain the contract that classof()
must fulfill. The HowToSetUpLLVMStyleRTTI already explains this
contract, but it is a little tucked away. A future patch will expand
that explanation and make it more prominent.

There does not appear to be a simple way to have the compiler prevent
this bug, since fundamentally it boiled down to a spurious classof()
where the programmer made an erroneous statement about the conversion.
This suggests that perhaps the interface to LLVM-style RTTI of classof()
is not the best. There is already some evidence for this, since in a
number of places Clang has classof() forward to classofKind(Kind K)
which evaluates the cast in terms of just the Kind. This could probably
be generalized to simply a `static const Kind MyKind;` field in leaf
classes and `static const Kind firstMyKind, lastMyKind;` for non-leaf
classes, and have the rest of the work be done inside Casting.h,
assuming that the Kind enum is laid out in a preorder traversal of the
inheritance tree.

llvm-svn: 165764

12 years agoProvide a fixit when taking the address of an unqualified member function.
David Blaikie [Thu, 11 Oct 2012 22:55:07 +0000 (22:55 +0000)]
Provide a fixit when taking the address of an unqualified member function.

This only applies if the type has a name. (we could potentially do something
crazy with decltype in C++11 to qualify members of unnamed types but that
seems excessive)

It might be nice to also suggest a fixit for "&this->i", "&foo->i",
and "&foo.i" but those expressions produce 'bound' member functions that have
a different AST representation & make error recovery a little trickier. Left
as future work.

llvm-svn: 165763

12 years agoclang/test/Index/index-module.m: Move XFAIL. It was line-number-sensitive.
NAKAMURA Takumi [Thu, 11 Oct 2012 22:48:22 +0000 (22:48 +0000)]
clang/test/Index/index-module.m: Move XFAIL. It was line-number-sensitive.

llvm-svn: 165762

12 years agoclang/test/Index/index-module.m: Mark it as XFAIL:win32 for now.
NAKAMURA Takumi [Thu, 11 Oct 2012 22:33:19 +0000 (22:33 +0000)]
clang/test/Index/index-module.m: Mark it as XFAIL:win32 for now.

llvm-svn: 165761

12 years agoclang/test/Index/index-pch-with-module.m: Tweak expressions for win32 pathsep.
NAKAMURA Takumi [Thu, 11 Oct 2012 22:33:14 +0000 (22:33 +0000)]
clang/test/Index/index-pch-with-module.m: Tweak expressions for win32 pathsep.

llvm-svn: 165760

12 years agoPGO: create metadata for switch only if it has more than one targets.
Manman Ren [Thu, 11 Oct 2012 22:28:34 +0000 (22:28 +0000)]
PGO: create metadata for switch only if it has more than one targets.

When all cases of a switch statement are dead, the weights vector only has one
element, and we will get an ssertion failure when calling createBranchWeights.

llvm-svn: 165759

12 years agoRemove extra semicolon.
Chad Rosier [Thu, 11 Oct 2012 22:26:44 +0000 (22:26 +0000)]
Remove extra semicolon.

llvm-svn: 165758

12 years agoRemove extra semicolons.
Chad Rosier [Thu, 11 Oct 2012 22:25:56 +0000 (22:25 +0000)]
Remove extra semicolons.

llvm-svn: 165757

12 years ago<rdar://problem/12042500>
Greg Clayton [Thu, 11 Oct 2012 22:05:13 +0000 (22:05 +0000)]
<rdar://problem/12042500>

Fixed an issue where we would try to launch an application twice and the second failure would cover up the first.

llvm-svn: 165756

12 years agoFix build warnings.
Greg Clayton [Thu, 11 Oct 2012 22:04:01 +0000 (22:04 +0000)]
Fix build warnings.

llvm-svn: 165755

12 years agoFixed the IR interaction layer to deal with a
Sean Callanan [Thu, 11 Oct 2012 22:00:52 +0000 (22:00 +0000)]
Fixed the IR interaction layer to deal with a
change in the LLDB target data API.

llvm-svn: 165754

12 years agoFix some typos 165739, spotted by Duncan.
Jan Wen Voung [Thu, 11 Oct 2012 21:45:16 +0000 (21:45 +0000)]
Fix some typos 165739, spotted by Duncan.

llvm-svn: 165753

12 years ago[ms-inline asm] Remove a bunch of parsing code from the front-end, which will be
Chad Rosier [Thu, 11 Oct 2012 21:44:41 +0000 (21:44 +0000)]
[ms-inline asm] Remove a bunch of parsing code from the front-end, which will be
reimplemented in the AsmParser where it belongs.

llvm-svn: 165752

12 years ago[ms-inline asm] Lookup the IdentifierInfo using the Idents table and remove the
Chad Rosier [Thu, 11 Oct 2012 21:28:29 +0000 (21:28 +0000)]
[ms-inline asm] Lookup the IdentifierInfo using the Idents table and remove the
now unused static helper function.

The test case needs to be remove temporarily until I can better filter memory
operands that aren't actual variable reference.

llvm-svn: 165751

12 years agoRevert 165732 for further review.
Micah Villmow [Thu, 11 Oct 2012 21:27:41 +0000 (21:27 +0000)]
Revert 165732 for further review.

llvm-svn: 165747

12 years agoDiagnose the expansion of ambiguous macro definitions. This can happen
Douglas Gregor [Thu, 11 Oct 2012 21:07:39 +0000 (21:07 +0000)]
Diagnose the expansion of ambiguous macro definitions. This can happen
only with modules, when two disjoint modules #define the same
identifier to different token sequences.

llvm-svn: 165746

12 years agoRemove OSAtomicChecker.
Ted Kremenek [Thu, 11 Oct 2012 20:58:21 +0000 (20:58 +0000)]
Remove OSAtomicChecker.

llvm-svn: 165744

12 years agoSwitch over to BodyFarm implementation of OSAtomicCompareAndSwap and
Ted Kremenek [Thu, 11 Oct 2012 20:58:18 +0000 (20:58 +0000)]
Switch over to BodyFarm implementation of OSAtomicCompareAndSwap and
objc_atomicCompareAndSwap.

llvm-svn: 165743

12 years agoTeach GetBaseType() about BlockPointerTypes.
Ted Kremenek [Thu, 11 Oct 2012 20:58:14 +0000 (20:58 +0000)]
Teach GetBaseType() about BlockPointerTypes.

llvm-svn: 165742

12 years agoAdd TargetTransformInfo to the clang driver.
Nadav Rotem [Thu, 11 Oct 2012 20:56:57 +0000 (20:56 +0000)]
Add TargetTransformInfo to the clang driver.

llvm-svn: 165741

12 years agoFixed an indentation issue that only shows up when dumping .o files that use linked...
Greg Clayton [Thu, 11 Oct 2012 20:42:53 +0000 (20:42 +0000)]
Fixed an indentation issue that only shows up when dumping .o files that use linked addresses (DWARF in .o files with debug map).

llvm-svn: 165740

12 years agoChange encoding of instruction operands in bitcode binaries to be relative
Jan Wen Voung [Thu, 11 Oct 2012 20:20:40 +0000 (20:20 +0000)]
Change encoding of instruction operands in bitcode binaries to be relative
to the instruction position.  The old encoding would give an absolute
ID which counts up within a function, and only resets at the next function.

I.e., Instead of having:

... = icmp eq i32 n-1, n-2
br i1 ..., label %bb1, label %bb2

it will now be roughly:

... = icmp eq i32 1, 2
br i1 1, label %bb1, label %bb2

This makes it so that ids remain relatively small and can be encoded
in fewer bits.

With this encoding, forward reference operands will be given
negative-valued IDs.  Use signed VBRs for the most common case
of forward references, which is phi instructions.

To retain backward compatibility we bump the bitcode version
from 0 to 1 to distinguish between the different encodings.

llvm-svn: 165739

12 years agoAdds Phabricator documentation. This is a first step that answers many questions...
Manuel Klimek [Thu, 11 Oct 2012 19:40:46 +0000 (19:40 +0000)]
Adds Phabricator documentation. This is a first step that answers many questions we have seen.

llvm-svn: 165736

12 years ago[libclang] Make sure the index_data.main_filename field is initialized
Argyrios Kyrtzidis [Thu, 11 Oct 2012 19:38:23 +0000 (19:38 +0000)]
[libclang] Make sure the index_data.main_filename field is initialized
in c-index-test. index_enteredMainFile is not invoked when indexing a
module file.

llvm-svn: 165735

12 years ago[libclang] Remove this test while I investigate why it is crashing on release+asserts.
Argyrios Kyrtzidis [Thu, 11 Oct 2012 19:21:21 +0000 (19:21 +0000)]
[libclang] Remove this test while I investigate why it is crashing on release+asserts.

llvm-svn: 165734

12 years agoAdd null check for malformed code.
Ted Kremenek [Thu, 11 Oct 2012 19:06:43 +0000 (19:06 +0000)]
Add null check for malformed code.

llvm-svn: 165733

12 years ago[libclang] Add tests for indexing modules and PCHs using modules.
Argyrios Kyrtzidis [Thu, 11 Oct 2012 19:00:44 +0000 (19:00 +0000)]
[libclang] Add tests for indexing modules and PCHs using modules.

llvm-svn: 165732

12 years agoFix build failure from r165722
Derek Schuff [Thu, 11 Oct 2012 18:21:13 +0000 (18:21 +0000)]
Fix build failure from r165722

llvm-svn: 165731

12 years ago<rdar://problem/12331741>
Greg Clayton [Thu, 11 Oct 2012 18:07:21 +0000 (18:07 +0000)]
<rdar://problem/12331741>

Dynamic type code must be efficient and fast. Now it is.

Added ObjC v1 support for getting the complete list of ISA values.

The main flow of the AppleObjCRuntime subclasses is now they must override "virtual bool UpdateISAToDescriptorMap_Impl();". This function will update the complete list of ISA values and create ClassDescriptorSP objects for each one. Now we have the complete list of valid ISA values which we can use for verification when doing dynamic typing.

Refactored a bunch of stuff so that the AppleObjCRuntime subclasses don't have to implement as many functions as they used to.

llvm-svn: 165730

12 years agoIntroduce a simple "hint" scheme to eliminate the quadratic behavior
Douglas Gregor [Thu, 11 Oct 2012 17:41:54 +0000 (17:41 +0000)]
Introduce a simple "hint" scheme to eliminate the quadratic behavior
associated with deserializing macro history for an identifier.

llvm-svn: 165729

12 years agoPatch from Andrew Kaylor that fixes Linux default host triple values.
Greg Clayton [Thu, 11 Oct 2012 17:38:58 +0000 (17:38 +0000)]
Patch from Andrew Kaylor that fixes Linux default host triple values.

llvm-svn: 165728

12 years agoMake the deserialization of PendingMacroIDs deterministic.
Douglas Gregor [Thu, 11 Oct 2012 17:31:34 +0000 (17:31 +0000)]
Make the deserialization of PendingMacroIDs deterministic.

llvm-svn: 165727

12 years agoAdd in the first iteration of support for llvm/clang/lldb to allow variable per addre...
Micah Villmow [Thu, 11 Oct 2012 17:21:41 +0000 (17:21 +0000)]
Add in the first iteration of support for llvm/clang/lldb to allow variable per address space pointer sizes to be optimized correctly.

llvm-svn: 165726

12 years ago-Warc-repeated-use-of-weak: fix a use-of-uninitialized and add a test case.
Jordan Rose [Thu, 11 Oct 2012 17:02:00 +0000 (17:02 +0000)]
-Warc-repeated-use-of-weak: fix a use-of-uninitialized and add a test case.

Fix-up for r165718, should get the buildbots back online.

llvm-svn: 165723

12 years agoProperly factor Native Client defines to support NaCl as an OS
Derek Schuff [Thu, 11 Oct 2012 16:55:58 +0000 (16:55 +0000)]
Properly factor Native Client defines to support NaCl as an OS
with x86/ARM architecture

llvm-svn: 165722

12 years agoPass an explicit operand number to addLiveIns.
Jakob Stoklund Olesen [Thu, 11 Oct 2012 16:46:07 +0000 (16:46 +0000)]
Pass an explicit operand number to addLiveIns.

Not all instructions define a virtual register in their first operand.
Specifically, INLINEASM has a different format.

<rdar://problem/12472811>

llvm-svn: 165721

12 years agoHandle gnu_inline in c++ in a gcc compatible way. Original patch by Tobias
Rafael Espindola [Thu, 11 Oct 2012 16:32:25 +0000 (16:32 +0000)]
Handle gnu_inline in c++ in a gcc compatible way. Original patch by Tobias
Grosser.

llvm-svn: 165720

12 years ago-Warc-repeated-use-of-weak: Don't warn on a single read followed by writes.
Jordan Rose [Thu, 11 Oct 2012 16:10:19 +0000 (16:10 +0000)]
-Warc-repeated-use-of-weak: Don't warn on a single read followed by writes.

This is a "safe" pattern, or at least one that cannot be helped by using
a strong local variable. However, if the single read is within a loop,
it should /always/ be treated as potentially dangerous.

<rdar://problem/12437490>

llvm-svn: 165719

12 years ago-Warc-repeated-use-of-weak: Check messages to property accessors as well.
Jordan Rose [Thu, 11 Oct 2012 16:06:21 +0000 (16:06 +0000)]
-Warc-repeated-use-of-weak: Check messages to property accessors as well.

Previously, [foo weakProp] was not being treated the same as foo.weakProp.
Now, for every explicit message send, we check if it's a property access,
and if so, if the property is weak. Then for every assignment of a
message, we have to do the same thing again.

This is a potentially expensive increase because determining whether a
method is a property accessor requires searching through the methods it
overrides. However, without it -Warc-repeated-use-of-weak will miss cases
from people who prefer not to use dot syntax. If this turns out to be
too expensive, we can try caching the result somewhere, or even lose
precision by not checking superclass methods. The warning is off-by-default,
though.

<rdar://problem/12407765>

llvm-svn: 165718

12 years ago[libclang] Improve AST serialization done by ASTUnit::Save().
Argyrios Kyrtzidis [Thu, 11 Oct 2012 16:05:00 +0000 (16:05 +0000)]
[libclang] Improve AST serialization done by ASTUnit::Save().

The ASTUnit needs to initialize an ASTWriter at the beginning of
parsing to fully handle serialization of a translation unit that
imports modules. Do this by introducing an option to enable it, which
corresponds to CXTranslationUnit_ForSerialization on the C API side.

llvm-svn: 165717

12 years agoObjCMethodDecl::findPropertyDecl: bail out early if not an instance method.
Jordan Rose [Thu, 11 Oct 2012 16:02:02 +0000 (16:02 +0000)]
ObjCMethodDecl::findPropertyDecl: bail out early if not an instance method.

Currently, Objective-C does not support class properties, even though it
allows calling class methods with dot syntax.

No intended functionality change; purely optimization.

llvm-svn: 165716

12 years agoMake X86_64ABIInfo clean for ABIs with 32 bit pointers, such as X32
Derek Schuff [Thu, 11 Oct 2012 15:52:22 +0000 (15:52 +0000)]
Make X86_64ABIInfo clean for ABIs with 32 bit pointers, such as X32
and Native Client

llvm-svn: 165715

12 years agoThis patch addresses PR13947.
Bill Schmidt [Thu, 11 Oct 2012 15:38:20 +0000 (15:38 +0000)]
This patch addresses PR13947.

For function calls on the 64-bit PowerPC SVR4 target, each parameter
is mapped to as many doublewords in the parameter save area as
necessary to hold the parameter.  The first 13 non-varargs
floating-point values are passed in registers; any additional
floating-point parameters are passed in the parameter save area.  A
single-precision floating-point parameter (32 bits) must be mapped to
the second (rightmost, low-order) word of its assigned doubleword
slot.

Currently LLVM violates this ABI requirement by mapping such a
parameter to the first (leftmost, high-order) word of its assigned
doubleword slot.  This is internally self-consistent but will not
interoperate correctly with libraries compiled with an ABI-compliant
compiler.

This patch corrects the problem by adjusting the parameter addressing
on both sides of the calling convention.

llvm-svn: 165714

12 years agoAdd test cases for correct parsing of register names in 32- and 64-bit modes.
David Chisnall [Thu, 11 Oct 2012 12:42:49 +0000 (12:42 +0000)]
Add test cases for correct parsing of register names in 32- and 64-bit modes.

llvm-svn: 165713

12 years agoclang/test/CodeGenCXX/microsoft-uuidof.cpp: Fix for -Asserts.
NAKAMURA Takumi [Thu, 11 Oct 2012 11:20:31 +0000 (11:20 +0000)]
clang/test/CodeGenCXX/microsoft-uuidof.cpp: Fix for -Asserts.

llvm-svn: 165712

12 years agoExpose move to/from coprocessor instructions in MIPS64 mode.
David Chisnall [Thu, 11 Oct 2012 10:21:34 +0000 (10:21 +0000)]
Expose move to/from coprocessor instructions in MIPS64 mode.

Note: [D]M{T,F}CP2 is just a recommended encoding.  Vendors often provide a
custom CP2 that interprets instructions differently and may wish to add their
own instructions that use this opcode.  We should ensure that this is easy to
do.  I will probably add a 'has custom CP{0-3}' subtarget flag to make this
easy: We want to avoid the GCC situation where every MIPS vendor makes a custom
fork that breaks every other MIPS CPU and so can't be merged upstream.

llvm-svn: 165711

12 years agoAdd codegen support for __uuidof().
Nico Weber [Thu, 11 Oct 2012 10:13:44 +0000 (10:13 +0000)]
Add codegen support for __uuidof().

llvm-svn: 165710

12 years agollvm/Analysis/Passes.h: Fix copypasto in createDependenceAnalysisPass().
NAKAMURA Takumi [Thu, 11 Oct 2012 08:26:52 +0000 (08:26 +0000)]
llvm/Analysis/Passes.h: Fix copypasto in createDependenceAnalysisPass().

llvm-svn: 165709

12 years agodependence analysis
Sebastian Pop [Thu, 11 Oct 2012 07:32:34 +0000 (07:32 +0000)]
dependence analysis

Patch from Preston Briggs <preston.briggs@gmail.com>.

This is an updated version of the dependence-analysis patch, including an MIV
test based on Banerjee's inequalities.

It's a fairly complete implementation of the paper

    Practical Dependence Testing
    Gina Goff, Ken Kennedy, and Chau-Wen Tseng
    PLDI 1991

It cannot yet propagate constraints between coupled RDIV subscripts (discussed
in Section 5.3.2 of the paper).

It's organized as a FunctionPass with a single entry point that supports testing
for dependence between two instructions in a function. If there's no dependence,
it returns null. If there's a dependence, it returns a pointer to a Dependence
which can be queried about details (what kind of dependence, is it loop
independent, direction and distance vector entries, etc). I haven't included
every imaginable feature, but there's a good selection that should be adequate
for supporting many loop transformations. Of course, it can be extended as
necessary.

Included in the patch file are many test cases, commented with C code showing
the loops and array references.

llvm-svn: 165708

12 years agoFollow the same routine to add target float expansion hook
Michael Liao [Thu, 11 Oct 2012 07:22:01 +0000 (07:22 +0000)]
Follow the same routine to add target float expansion hook

llvm-svn: 165707

12 years agoAdd prologue text for list of potential checkers.
Ted Kremenek [Thu, 11 Oct 2012 06:26:56 +0000 (06:26 +0000)]
Add prologue text for list of potential checkers.

llvm-svn: 165705

12 years agoWhen OptionValueFileSpec is given a filename starting
Jason Molenda [Thu, 11 Oct 2012 06:05:54 +0000 (06:05 +0000)]
When OptionValueFileSpec is given a filename starting
with ~, we need to realpath it.  Fixes the case where

settings set target.expr-prefix ~/lldb.prefix.header

wouldn't read this prefix header file.  <rdar://problem/12475676>

llvm-svn: 165704

12 years agoChange the scratch buffer for x86 assembly instructions in AssemblyParse_x86 from
Jason Molenda [Thu, 11 Oct 2012 06:04:37 +0000 (06:04 +0000)]
Change the scratch buffer for x86 assembly instructions in AssemblyParse_x86 from
malloc'ed heap to an llvm SmallVector.

llvm-svn: 165703

12 years agomisched: Handle "transient" non-instructions.
Andrew Trick [Thu, 11 Oct 2012 05:37:06 +0000 (05:37 +0000)]
misched: Handle "transient" non-instructions.

llvm-svn: 165701

12 years agoDon't crash when !tbaa.struct contents is invalid.
Nick Lewycky [Thu, 11 Oct 2012 02:05:23 +0000 (02:05 +0000)]
Don't crash when !tbaa.struct contents is invalid.

llvm-svn: 165693

12 years agoRevert r165661, "Patch by Shuxin Yang <shuxin.llvm@gmail.com>."
NAKAMURA Takumi [Thu, 11 Oct 2012 02:02:05 +0000 (02:02 +0000)]
Revert r165661, "Patch by Shuxin Yang <shuxin.llvm@gmail.com>."

It broke stage2 clang and test-suite/MultiSource/Benchmarks/mediabench/g721/g721encode.

llvm-svn: 165692

12 years agoGettingStarted.rst: s/&amp;/&/g
NAKAMURA Takumi [Thu, 11 Oct 2012 01:10:37 +0000 (01:10 +0000)]
GettingStarted.rst: s/&amp;/&/g

llvm-svn: 165690

12 years agoGettingStarted.rst: Fix the label to DeveloperPolicy.html.
NAKAMURA Takumi [Thu, 11 Oct 2012 01:10:27 +0000 (01:10 +0000)]
GettingStarted.rst: Fix the label to DeveloperPolicy.html.

llvm-svn: 165689

12 years agoclang/lib/Headers/CMakeLists.txt: Add f16cintrin.h.
NAKAMURA Takumi [Thu, 11 Oct 2012 01:10:04 +0000 (01:10 +0000)]
clang/lib/Headers/CMakeLists.txt: Add f16cintrin.h.

llvm-svn: 165688

12 years agoAdd the LLVM context to this c'tor. It will be needed in the future.
Bill Wendling [Thu, 11 Oct 2012 01:10:00 +0000 (01:10 +0000)]
Add the LLVM context to this c'tor. It will be needed in the future.

llvm-svn: 165687

12 years agoSupport a common idiom on how to build an Attributes class with a single attribute.
Bill Wendling [Thu, 11 Oct 2012 01:05:52 +0000 (01:05 +0000)]
Support a common idiom on how to build an Attributes class with a single attribute.

llvm-svn: 165686

12 years agoX86: add F16C support in Clang
Manman Ren [Thu, 11 Oct 2012 00:59:55 +0000 (00:59 +0000)]
X86: add F16C support in Clang

Support the following intrinsics:
  _mm_cvtph_ps, _mm256_cvtph_ps, _mm_cvtps_ph, _mm256_cvtps_ph

rdar://12407875

llvm-svn: 165685

12 years agoRemove the ASTDeserializationListener's MacroVisible() callback, which
Douglas Gregor [Thu, 11 Oct 2012 00:51:27 +0000 (00:51 +0000)]
Remove the ASTDeserializationListener's MacroVisible() callback, which
is no longer necessary, as well as the little bit of infrastructure in
the AST writer that used it.

llvm-svn: 165684

12 years agoRemove an unused bit from the serialized IdentifierInfo
Douglas Gregor [Thu, 11 Oct 2012 00:48:48 +0000 (00:48 +0000)]
Remove an unused bit from the serialized IdentifierInfo

llvm-svn: 165683

12 years agoDeserialize macro history when we deserialize an identifier that has
Douglas Gregor [Thu, 11 Oct 2012 00:46:49 +0000 (00:46 +0000)]
Deserialize macro history when we deserialize an identifier that has
macro history.

When deserializing macro history, we arrange history such that the
macros that have definitions (that haven't been #undef'd) and are
visible come at the beginning of the list, which is what the
preprocessor and other clients of Preprocessor::getMacroInfo()
expect. If additional macro definitions become visible later, they'll
be moved toward the front of the list. Note that it's possible to have
ambiguities, but we don't diagnose them yet.

There is a partially-implemented design decision here that, if a
particular identifier has been defined or #undef'd within the
translation unit, that definition (or #undef) hides any macro
definitions that come from imported modules. There's still a little
work to do to ensure that the right #undef'ing happens.

Additionally, we'll need to scope the update records for #undefs, so
they only kick in when the submodule containing that update record
becomes visible.

llvm-svn: 165682

12 years agoTeach set-xcode-analyzer that the new default value for ExecPath is CLANG_ANALYZER_EXEC.
Ted Kremenek [Thu, 11 Oct 2012 00:40:41 +0000 (00:40 +0000)]
Teach set-xcode-analyzer that the new default value for ExecPath is CLANG_ANALYZER_EXEC.

llvm-svn: 165681

12 years agoDon't crash if a .ll file contains a forward-reference that looks like a global
Nick Lewycky [Thu, 11 Oct 2012 00:38:25 +0000 (00:38 +0000)]
Don't crash if a .ll file contains a forward-reference that looks like a global
value but later turns out to be a function.

Unfortunately, we can't fold tests into a single file because we only get one
error out of llvm-as.

llvm-svn: 165680

12 years agoMinor cleanup for r165678; no functional change.
Eli Friedman [Thu, 11 Oct 2012 00:34:15 +0000 (00:34 +0000)]
Minor cleanup for r165678; no functional change.

llvm-svn: 165679

12 years agoMake sure we perform the variadic method check correctly for calls to a member operat...
Eli Friedman [Thu, 11 Oct 2012 00:30:58 +0000 (00:30 +0000)]
Make sure we perform the variadic method check correctly for calls to a member operator().  PR14057.

llvm-svn: 165678

12 years agoChange MachineInstrBuilder::addDisp to copy over target flags by default.
Evan Cheng [Thu, 11 Oct 2012 00:15:48 +0000 (00:15 +0000)]
Change MachineInstrBuilder::addDisp to copy over target flags by default.

llvm-svn: 165677

12 years agoReapply "[analyzer] Treat fields of unions as having symbolic offsets."
Jordan Rose [Wed, 10 Oct 2012 23:23:21 +0000 (23:23 +0000)]
Reapply "[analyzer] Treat fields of unions as having symbolic offsets."

This time, actually uncomment the code that's supposed to fix the problem.

This reverts r165671 / 8ceb837585ed973dc36fba8dfc57ef60fc8f2735.

llvm-svn: 165676

12 years agoFix a crash-on-invalid when parsing a reference to an invalid auto declaration
David Blaikie [Wed, 10 Oct 2012 23:15:05 +0000 (23:15 +0000)]
Fix a crash-on-invalid when parsing a reference to an invalid auto declaration

  auto x((unknown));
  int& y = x;

would crash because we were not flagging 'x' as an invalid declaration here.

llvm-svn: 165675

12 years agoobjective-C IRgen: When sending a method to 'super'
Fariborz Jahanian [Wed, 10 Oct 2012 23:11:18 +0000 (23:11 +0000)]
objective-C IRgen: When sending a method to 'super'
in a category class method, don't read 'isa' pointer. Instead,
save the desired OBJC_METACLASS_$_ClassName in
__DATA,__objc_superrefs and read that without reading any
isa pointers. // rdar://12459358

llvm-svn: 165674

12 years agoAdd isel patterns for v2f32 / v4f32 neon.vbsl intrinsics. rdar://12471808
Evan Cheng [Wed, 10 Oct 2012 23:06:34 +0000 (23:06 +0000)]
Add isel patterns for v2f32 / v4f32 neon.vbsl intrinsics. rdar://12471808

llvm-svn: 165673

12 years ago<rdar://problem/12462744> Implement a new SBDeclaration class to wrap an lldb_private...
Enrico Granata [Wed, 10 Oct 2012 22:54:17 +0000 (22:54 +0000)]
<rdar://problem/12462744> Implement a new SBDeclaration class to wrap an lldb_private::Declaration - make a GetDeclaration() API on SBValue to return a declaration. This will only work for vroot variables as they are they only objects for which we currently provide a valid Declaration

llvm-svn: 165672

12 years agoTemporarily Revert "[analyzer] Treat fields of unions as having symbolic offsets."
Eric Christopher [Wed, 10 Oct 2012 22:49:05 +0000 (22:49 +0000)]
Temporarily Revert "[analyzer] Treat fields of unions as having symbolic offsets."

Author: Jordan Rose <jordan_rose@apple.com>
Date:   Wed Oct 10 21:31:21 2012 +0000

    [analyzer] Treat fields of unions as having symbolic offsets.

    This allows only one field to be active at a time in RegionStore.
    This isn't quite the correct behavior for unions, but it at least
    would handle the case of "value goes in, value comes out" from the
    same field.

    RegionStore currently has a number of places where any access to a union
    results in UnknownVal being returned. However, it is clearly missing
    some cases, or the original issue wouldn't have occurred. It is probably
    now safe to remove those changes, but that's a potentially destabilizing
    change that should wait for more thorough testing.

    Fixes PR14054.

    git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@165660 91177308-0d34-0410-b5e6-96231b3b80d8

This reverts commit cf9030e480f77ab349672f00ad302e216c26c92c.

llvm-svn: 165671

12 years agoAdd getters for the MIPS TargetTransform classes
Nadav Rotem [Wed, 10 Oct 2012 22:45:53 +0000 (22:45 +0000)]
Add getters for the MIPS TargetTransform classes

llvm-svn: 165670

12 years agoRemove unused member variable introduced in r165665.
David Blaikie [Wed, 10 Oct 2012 22:38:21 +0000 (22:38 +0000)]
Remove unused member variable introduced in r165665.

llvm-svn: 165669

12 years agoFormatting and 80-col.
Eric Christopher [Wed, 10 Oct 2012 22:37:01 +0000 (22:37 +0000)]
Formatting and 80-col.

llvm-svn: 165668

12 years agoRevert "[Options] make Option a value type."
Eric Christopher [Wed, 10 Oct 2012 22:34:46 +0000 (22:34 +0000)]
Revert "[Options] make Option a value type."

Author: Michael J. Spencer <bigcheesegs@gmail.com>
Date:   Wed Oct 10 21:48:26 2012 +0000

    [Options] make Option a value type.

    git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@165663 91177308-0d34-0410-b5e6-96231b3b80d8

This reverts commit 0464fd5e4ce2193e786e5adcab6b828f9366dae3.

llvm-svn: 165667

12 years agoAdd -mattr=+altivec and remove XFAIL.
Bill Schmidt [Wed, 10 Oct 2012 22:25:11 +0000 (22:25 +0000)]
Add -mattr=+altivec and remove XFAIL.

llvm-svn: 165666

12 years agoAdd a new interface to allow IR-level passes to access codegen-specific information.
Nadav Rotem [Wed, 10 Oct 2012 22:04:55 +0000 (22:04 +0000)]
Add a new interface to allow IR-level passes to access codegen-specific information.

llvm-svn: 165665

12 years agoXFAIL for all targets pending investigation
Bill Schmidt [Wed, 10 Oct 2012 21:52:10 +0000 (21:52 +0000)]
XFAIL for all targets pending investigation

llvm-svn: 165664

12 years ago[Options] make Option a value type.
Michael J. Spencer [Wed, 10 Oct 2012 21:48:26 +0000 (21:48 +0000)]
[Options] make Option a value type.

llvm-svn: 165663

12 years agoMove the scratch buffer allocation for x86 instructions from being allocated each...
Jason Molenda [Wed, 10 Oct 2012 21:37:00 +0000 (21:37 +0000)]
Move the scratch buffer allocation for x86 instructions from being allocated each instruction,
to once in the AssemblyParse_x86 ctor.
an instruction

llvm-svn: 165662

12 years agoPatch by Shuxin Yang <shuxin.llvm@gmail.com>.
Nadav Rotem [Wed, 10 Oct 2012 21:31:55 +0000 (21:31 +0000)]
Patch by Shuxin Yang <shuxin.llvm@gmail.com>.

Original message:

The attached is the fix to radar://11663049. The optimization can be outlined by following rules:

   (select (x != c), e, c) -> select (x != c), e, x),
   (select (x == c), c, e) -> select (x == c), x, e)
where the <c> is an integer constant.

 The reason for this change is that : on x86, conditional-move-from-constant needs two instructions;
however, conditional-move-from-register need only one instruction.

  While the LowerSELECT() sounds to be the most convenient place for this optimization, it turns out to be a bad place. The reason is that by replacing the constant <c> with a symbolic value, it obscure some instruction-combining opportunities which would otherwise be very easy to spot. For that reason, I have to postpone the change to last instruction-combining phase.

  The change passes the test of "make check-all -C <build-root/test" and "make -C project/test-suite/SingleSource".

llvm-svn: 165661

12 years ago[analyzer] Treat fields of unions as having symbolic offsets.
Jordan Rose [Wed, 10 Oct 2012 21:31:21 +0000 (21:31 +0000)]
[analyzer] Treat fields of unions as having symbolic offsets.

This allows only one field to be active at a time in RegionStore.
This isn't quite the correct behavior for unions, but it at least
would handle the case of "value goes in, value comes out" from the
same field.

RegionStore currently has a number of places where any access to a union
results in UnknownVal being returned. However, it is clearly missing
some cases, or the original issue wouldn't have occurred. It is probably
now safe to remove those changes, but that's a potentially destabilizing
change that should wait for more thorough testing.

Fixes PR14054.

llvm-svn: 165660

12 years agoWhen generating spill and reload code for vector registers on PowerPC,
Bill Schmidt [Wed, 10 Oct 2012 21:25:01 +0000 (21:25 +0000)]
When generating spill and reload code for vector registers on PowerPC,
the compiler makes use of GPR0.  However, there are two flavors of
GPR0 defined by the target:  the 32-bit GPR0 (R0) and the 64-bit GPR0
(X0).  The spill/reload code makes use of R0 regardless of whether we
are generating 32- or 64-bit code.

This patch corrects the problem in the obvious manner, using X0 and
ADDI8 for 64-bit and R0 and ADDI for 32-bit.

llvm-svn: 165658