platform/upstream/llvm.git
11 years agoSwitch CodeGenOptions over to a .def file, like we do with LangOptions.
Douglas Gregor [Tue, 23 Oct 2012 20:05:01 +0000 (20:05 +0000)]
Switch CodeGenOptions over to a .def file, like we do with LangOptions.

llvm-svn: 166497

11 years agoWhen rebuilding a DependentScopeDeclRefExpr, perform a lookup into the scope
Richard Smith [Tue, 23 Oct 2012 19:56:01 +0000 (19:56 +0000)]
When rebuilding a DependentScopeDeclRefExpr, perform a lookup into the scope
even if it's dependent, in case it now names a member of the current instantiation.

llvm-svn: 166496

11 years ago<rdar://problem/12523238> Commit 1 of 3
Enrico Granata [Tue, 23 Oct 2012 19:54:09 +0000 (19:54 +0000)]
<rdar://problem/12523238> Commit 1 of 3
This commit enables the new HasChildren() feature for synthetic children providers
Namely, it hooks up the required bits and pieces so that individual synthetic children providers can implement a new (optional) has_children call
Default implementations have been provided where necessary so that any existing providers continue to work and behave correctly

Next steps are:
2) writing smart implementations of has_children for our providers whenever possible
3) make a test case

llvm-svn: 166495

11 years agoSilence -Wsign-compare
Matt Beaumont-Gay [Tue, 23 Oct 2012 19:46:36 +0000 (19:46 +0000)]
Silence -Wsign-compare

llvm-svn: 166494

11 years agoChange DenseMap to use a power of 2 growth if one is given instead of the next power...
Pete Cooper [Tue, 23 Oct 2012 19:34:36 +0000 (19:34 +0000)]
Change DenseMap to use a power of 2 growth if one is given instead of the next power of 2.  This was causing DenseMaps to grow 4x instead of 2x.  I'll keep an eye on the buildbots as this could impact performance

llvm-svn: 166493

11 years agoFixed bug in SmallDenseMap where it wouldn't leave enough space for an empty bucket...
Pete Cooper [Tue, 23 Oct 2012 18:47:35 +0000 (18:47 +0000)]
Fixed bug in SmallDenseMap where it wouldn't leave enough space for an empty bucket if the number of values was exactly equal to the small capacity.  This led to an infinite loop when finding a non-existent element

llvm-svn: 166492

11 years agoUse the AliasAnalysis isIdentifiedObj because it also understands mallocs and c+...
Nadav Rotem [Tue, 23 Oct 2012 18:44:18 +0000 (18:44 +0000)]
Use the AliasAnalysis isIdentifiedObj because it also understands mallocs and c++ news.

PR14158.

llvm-svn: 166491

11 years agoIgnore unreachable blocks when doing memory dependence analysis on non-local
Bill Wendling [Tue, 23 Oct 2012 18:37:11 +0000 (18:37 +0000)]
Ignore unreachable blocks when doing memory dependence analysis on non-local
loads. It's not really profitable and may result in GVN going into an infinite
loop when it hits constructs like this:

     %x = gep %some.type %x, ...

Found via an LTO build of LLVM.

llvm-svn: 166490

11 years ago[ms-inline asm] Update for r166433.
Chad Rosier [Tue, 23 Oct 2012 17:44:40 +0000 (17:44 +0000)]
[ms-inline asm] Update for r166433.

llvm-svn: 166489

11 years ago[ms-inline asm] Add an implementation of the offset operator. This is a follow
Chad Rosier [Tue, 23 Oct 2012 17:43:43 +0000 (17:43 +0000)]
[ms-inline asm] Add an implementation of the offset operator.  This is a follow
on patch to r166433.
rdar://12470317

llvm-svn: 166488

11 years agoAdd custom UINT_TO_FP from v4i8/v4i16/v8i8/v8i16 to v4f32/v8f32
Michael Liao [Tue, 23 Oct 2012 17:36:08 +0000 (17:36 +0000)]
Add custom UINT_TO_FP from v4i8/v4i16/v8i8/v8i16 to v4f32/v8f32

- Replace v4i8/v8i8 -> v8f32 DAG combine with custom lowering to reduce
  DAG combine overhead.
- Extend the support to v4i16/v8i16 as well.

llvm-svn: 166487

11 years agoEnable lowering ZERO_EXTEND/ANY_EXTEND to PMOVZX from SSE4.1
Michael Liao [Tue, 23 Oct 2012 17:34:00 +0000 (17:34 +0000)]
Enable lowering ZERO_EXTEND/ANY_EXTEND to PMOVZX from SSE4.1

llvm-svn: 166486

11 years agoGrammar.
Eric Christopher [Tue, 23 Oct 2012 17:19:15 +0000 (17:19 +0000)]
Grammar.

llvm-svn: 166485

11 years agoUse ilist rather than std::list for Node and Edge lists in the PBQP graph. This
Lang Hames [Tue, 23 Oct 2012 17:10:51 +0000 (17:10 +0000)]
Use ilist rather than std::list for Node and Edge lists in the PBQP graph. This
should fix an issue (described at http://stackoverflow.com/questions/10065384/instantiation-of-a-list-with-an-incomplete-type-in-a-typedef)
that was preventing LLVMCodeGen from building with libc++ in C++11 mode.

llvm-svn: 166484

11 years agoHandle -pthread, -pg and -shared correctly on bitrig.
Rafael Espindola [Tue, 23 Oct 2012 17:07:31 +0000 (17:07 +0000)]
Handle -pthread, -pg and -shared correctly on bitrig.
Patch by David Hill.

llvm-svn: 166483

11 years agoFix some mdoc nits
Sean Silva [Tue, 23 Oct 2012 16:35:44 +0000 (16:35 +0000)]
Fix some mdoc nits

Patch by Eitan Adler!

llvm-svn: 166482

11 years agoTest commit access
Quentin Colombet [Tue, 23 Oct 2012 16:03:18 +0000 (16:03 +0000)]
Test commit access

llvm-svn: 166481

11 years agoThis is another TLC patch for separating code for the Darwin and ELF ABIs
Bill Schmidt [Tue, 23 Oct 2012 15:51:16 +0000 (15:51 +0000)]
This is another TLC patch for separating code for the Darwin and ELF ABIs
for the PowerPC target, and factoring the results.  This will ease future
maintenance of both subtargets.

PPCTargetLowering::LowerCall_Darwin_Or_64SVR4() has grown a lot of special-case
code for the different ABIs, making maintenance difficult.  This is getting
worse as we repair errors in the 64-bit ELF ABI implementation, while avoiding
changes to the Darwin ABI logic.  This patch splits the routine into
LowerCall_Darwin() and LowerCall_64SVR4(), allowing both versions to be
significantly simplified.  I've factored out chunks of similar code where it
made sense to do so.  I also performed similar factoring on
LowerFormalArguments_Darwin() and LowerFormalArguments_64SVR4().

There are no functional changes in this patch, and therefore no new test
cases have been developed.

Built and tested on powerpc64-unknown-linux-gnu with no new regressions.

llvm-svn: 166480

11 years agoMake hasDeclaration() matcher work inside the memberExpr() matcher.
Daniel Jasper [Tue, 23 Oct 2012 15:46:39 +0000 (15:46 +0000)]
Make hasDeclaration() matcher work inside the memberExpr() matcher.

llvm-svn: 166479

11 years agoclang/test/PCH/pch-dir.c: Update a comment for msvc. msvc(*-win32) implies -std=c...
NAKAMURA Takumi [Tue, 23 Oct 2012 10:43:00 +0000 (10:43 +0000)]
clang/test/PCH/pch-dir.c: Update a comment for msvc. msvc(*-win32) implies -std=c++11.

llvm-svn: 166478

11 years agoImplements the thisExpr matcher.
Manuel Klimek [Tue, 23 Oct 2012 10:40:50 +0000 (10:40 +0000)]
Implements the thisExpr matcher.
Patch by Gabor Horvath.

llvm-svn: 166477

11 years agoFix typo that somehow escaped both testing and code inspection.
Duncan Sands [Tue, 23 Oct 2012 09:07:02 +0000 (09:07 +0000)]
Fix typo that somehow escaped both testing and code inspection.

llvm-svn: 166475

11 years agoTransform code like this
Duncan Sands [Tue, 23 Oct 2012 08:28:26 +0000 (08:28 +0000)]
Transform code like this
 %V = mul i64 %N, 4
 %t = getelementptr i8* bitcast (i32* %arr to i8*), i32 %V
into
 %t1 = getelementptr i32* %arr, i32 %N
 %t = bitcast i32* %t1 to i8*
incorporating the multiplication into the getelementptr.
This happens all the time in dragonegg, for example for
  int foo(int *A, int N) {
    return A[N];
  }
because gcc turns this into byte pointer arithmetic before it hits the plugin:
  D.1590_2 = (long unsigned int) N_1(D);
  D.1591_3 = D.1590_2 * 4;
  D.1592_5 = A_4(D) + D.1591_3;
  D.1589_6 = *D.1592_5;
  return D.1589_6;
The D.1592_5 line is a POINTER_PLUS_EXPR, which is turned into a getelementptr
on a bitcast of A_4 to i8*, so this becomes exactly the kind of IR that the
transform fires on.

An analogous transform (with no testcases!) already existed for bitcasts of
arrays, so I rewrote it to share code with this one.

llvm-svn: 166474

11 years agoclang/test/PCH/pch-dir.c: Mark it as XFAIL:msvc. It doesn't fail (virtually xpass...
NAKAMURA Takumi [Tue, 23 Oct 2012 07:47:51 +0000 (07:47 +0000)]
clang/test/PCH/pch-dir.c: Mark it as XFAIL:msvc. It doesn't fail (virtually xpass) on msvc.

llvm-svn: 166473

11 years agoWatchpoints remember the type of the expression or variable they were set with, and use
Jim Ingham [Tue, 23 Oct 2012 07:20:06 +0000 (07:20 +0000)]
Watchpoints remember the type of the expression or variable they were set with, and use
it to print the old and new values.
Temporarily disable the "out of scope" checking since it didn't work correctly, and was
not what people generally expected watchpoints to be doing.

llvm-svn: 166472

11 years agoclang/test/PCH/pch-dir.c: Relax expressions of path separators for Win32.
NAKAMURA Takumi [Tue, 23 Oct 2012 07:01:50 +0000 (07:01 +0000)]
clang/test/PCH/pch-dir.c: Relax expressions of path separators for Win32.

llvm-svn: 166471

11 years agoPer the C++ standard, we need to include the definition of llvm::Calculate in
Richard Smith [Tue, 23 Oct 2012 06:19:46 +0000 (06:19 +0000)]
Per the C++ standard, we need to include the definition of llvm::Calculate in
every TU where it's implicitly instantiated, even if there's an implicit
instantiation for the same types available in another TU.

llvm-svn: 166470

11 years agoIf the precompiled header named by "-include" is actually a directory,
Douglas Gregor [Tue, 23 Oct 2012 06:18:24 +0000 (06:18 +0000)]
If the precompiled header named by "-include" is actually a directory,
check each of the files within that directory to determine if any of
them is an AST file that matches the language and target options. If
so, the first matching AST file is loaded. This fixes a longstanding
discrepency with GCC's precompiled header implementation.

llvm-svn: 166469

11 years agoFix -Wunused-value to not warn on expressions that have unresolved lookups due
Matt Beaumont-Gay [Tue, 23 Oct 2012 06:15:26 +0000 (06:15 +0000)]
Fix -Wunused-value to not warn on expressions that have unresolved lookups due
to dependent arguments.

llvm-svn: 166468

11 years agoAdd a comment which explains why the assert fired and how to fix it.
Nadav Rotem [Tue, 23 Oct 2012 04:35:40 +0000 (04:35 +0000)]
Add a comment which explains why the assert fired and how to fix it.

llvm-svn: 166467

11 years ago[libclang] Add an environment variable to disable thread background priotity, for...
Argyrios Kyrtzidis [Tue, 23 Oct 2012 04:09:38 +0000 (04:09 +0000)]
[libclang] Add an environment variable to disable thread background priotity, for testing

llvm-svn: 166466

11 years agoChange how the UnwindAssemblyInstEmulation class tracks the setup of
Jason Molenda [Tue, 23 Oct 2012 03:08:31 +0000 (03:08 +0000)]
Change how the UnwindAssemblyInstEmulation class tracks the setup of
the function's prologue instructions so we can re-instate that prologue
if we hit an early return mid-function.  Add some additional heuristics
to differentiate between prologue and epilogue instruction sequences.

This fixes the specific problem of correctly unwinding through a function
which has an epilogue one instruction after the last prologue setup
instruction has completed.
<rdar://problem/12091139>

llvm-svn: 166465

11 years agoClean up help/usage messages for kdp-remote / gdb-remote a little bit.
Jason Molenda [Tue, 23 Oct 2012 03:05:16 +0000 (03:05 +0000)]
Clean up help/usage messages for kdp-remote / gdb-remote a little bit.

llvm-svn: 166464

11 years ago[ms-inline-asm] Add handling for errors coming out of the backend.
Eli Friedman [Tue, 23 Oct 2012 02:43:30 +0000 (02:43 +0000)]
[ms-inline-asm] Add handling for errors coming out of the backend.

llvm-svn: 166463

11 years agoFixing a compiler warning about has_children being used before being initialized
Enrico Granata [Tue, 23 Oct 2012 02:07:54 +0000 (02:07 +0000)]
Fixing a compiler warning about has_children being used before being initialized

llvm-svn: 166462

11 years agoDon't try to use inreg with 0 sized structs. Thanks to Eli for reporting the
Rafael Espindola [Tue, 23 Oct 2012 02:04:01 +0000 (02:04 +0000)]
Don't try to use inreg with 0 sized structs. Thanks to Eli for reporting the
regression.

llvm-svn: 166461

11 years ago<rdar://problem/12493007>
Greg Clayton [Tue, 23 Oct 2012 01:50:10 +0000 (01:50 +0000)]
<rdar://problem/12493007>

Added a new API call to help efficiently determine if a SBValue could have children:

     bool
     SBValue::MightHaveChildren ();

This is inteneded to be used bui GUI programs that need to show if a SBValue needs a disclosure triangle when displaying a hierarchical type in a tree view without having to complete the type (by calling SBValue::GetNumChildren()) as completing the type is expensive.

llvm-svn: 166460

11 years agoimplement setXX patterns
Reed Kotler [Tue, 23 Oct 2012 01:35:48 +0000 (01:35 +0000)]
implement setXX patterns

llvm-svn: 166459

11 years ago[Options] Fix two options I mistransformed.
Michael J. Spencer [Tue, 23 Oct 2012 01:25:21 +0000 (01:25 +0000)]
[Options] Fix two options I mistransformed.

llvm-svn: 166458

11 years agoImproved support for language types as command
Sean Callanan [Tue, 23 Oct 2012 00:50:09 +0000 (00:50 +0000)]
Improved support for language types as command
options:

- added help ("help language") listing the
  possible options;

- added the possibility of synonyms for language
  names, in this case "ObjC" for "Objective-C";
  and

- made matching against language names case
  insensitive.

This should improve discoverability.

<rdar://problem/12552359>

llvm-svn: 166457

11 years agoFix typo.
Julien Lerouge [Tue, 23 Oct 2012 00:38:15 +0000 (00:38 +0000)]
Fix typo.

llvm-svn: 166456

11 years agoUgly ugly hack for libstdc++-4.6 and libstdc++-4.7 compatibility. These
Richard Smith [Tue, 23 Oct 2012 00:32:41 +0000 (00:32 +0000)]
Ugly ugly hack for libstdc++-4.6 and libstdc++-4.7 compatibility. These
libraries have an incorrect definition of std::common_type (inherited from a
bug in the standard -- see LWG issue 2141), whereby they produce reference
types when they should not.

If we instantiate a typedef named std::common_type<...>::type, which is defined
in a system header as decltype(... ? ... : ...), and the decltype produces a
reference type, convert it to the non-reference type. (This doesn't affect any
LWG2141-conforming implementation of common_type, such as libc++'s, because the
default implementation of common_type<...>::type isn't supposed to produce a
reference type.)

This is horrible. I'm really sorry. :( Better ideas appreciated!

llvm-svn: 166455

11 years agoExplain why DenseMap is still used here instead of MapVector.
Julien Lerouge [Tue, 23 Oct 2012 00:23:46 +0000 (00:23 +0000)]
Explain why DenseMap is still used here instead of MapVector.

llvm-svn: 166454

11 years ago<rdar://problem/12500212> Test case for the new plugin feature
Enrico Granata [Tue, 23 Oct 2012 00:09:02 +0000 (00:09 +0000)]
<rdar://problem/12500212> Test case for the new plugin feature

llvm-svn: 166453

11 years agoHandle implicitly-included PCH files the same way as
Douglas Gregor [Mon, 22 Oct 2012 23:59:45 +0000 (23:59 +0000)]
Handle implicitly-included PCH files the same way as
implicitly-included PTH files during initialization, delaying the
mapping down to the "original source file" until after later in the
initialization process.

llvm-svn: 166452

11 years ago[ms-inline-asm] Implement _emit directive (which is roughly equivalent to .byte).
Eli Friedman [Mon, 22 Oct 2012 23:58:19 +0000 (23:58 +0000)]
[ms-inline-asm] Implement _emit directive (which is roughly equivalent to .byte).

<rdar://problem/12470345>.

llvm-svn: 166451

11 years agoAdded support for zero-length arrays at the end
Sean Callanan [Mon, 22 Oct 2012 23:56:48 +0000 (23:56 +0000)]
Added support for zero-length arrays at the end
of structures, and added a testcase.

<rdar://problem/12551591>

llvm-svn: 166450

11 years agoAllow clients of the AST reader to specify what kinds of AST load
Douglas Gregor [Mon, 22 Oct 2012 23:51:00 +0000 (23:51 +0000)]
Allow clients of the AST reader to specify what kinds of AST load
failures they know how to tolerate, e.g., out-of-date input files or
configuration/version mismatches. Suppress the corresponding
diagnostics if the client can handle it.

No clients actually use this functionality, yet.

llvm-svn: 166449

11 years agoWhen a block ends in an indirect branch, add its successors to the machine basic...
Bill Wendling [Mon, 22 Oct 2012 23:30:04 +0000 (23:30 +0000)]
When a block ends in an indirect branch, add its successors to the machine basic block.

The CFG of the machine function needs to know that the targets of the indirect
branch are successors to the indirect branch.
<rdar://problem/12529625>

llvm-svn: 166448

11 years agoCollapse ASTReader::ReadSLocEntryRecord() into its only caller,
Douglas Gregor [Mon, 22 Oct 2012 22:53:10 +0000 (22:53 +0000)]
Collapse ASTReader::ReadSLocEntryRecord() into its only caller,
ReadSLocEntry(). No functionality change.

llvm-svn: 166447

11 years agoDistinguish the various kinds of AST file loading failures:
Douglas Gregor [Mon, 22 Oct 2012 22:50:17 +0000 (22:50 +0000)]
Distinguish the various kinds of AST file loading failures:
file corruption, compiler version mismatch, target/language
configuration mismatch, out-of-date AST file. No functionality change
yet.

llvm-svn: 166446

11 years agoAdd support for annotated disassembly output for X86 and arm.
Kevin Enderby [Mon, 22 Oct 2012 22:31:46 +0000 (22:31 +0000)]
Add support for annotated disassembly output for X86 and arm.

Per the October 12, 2012 Proposal for annotated disassembly output sent out by
Jim Grosbach this set of changes implements this for X86 and arm.  The llvm-mc
tool now has a -mdis option to produced the marked up disassembly and a couple
of small example test cases have been added.

rdar://11764962

llvm-svn: 166445

11 years ago[Options] Add prefixes to options.
Michael J. Spencer [Mon, 22 Oct 2012 22:13:48 +0000 (22:13 +0000)]
[Options] Add prefixes to options.

Each option has a set of prefixes. When matching an argument such as
-funroll-loops. First the leading - is removed as it is a prefix. Then
a lower_bound search for "funroll-loops" is done against the option table by
option name. From there each option prefix + option name combination is tested
against the argument.

This allows us to support Microsoft style options where both / and - are valid
prefixes. It also simplifies the cases we already have where options come in
both - and -- forms. Almost every option for gnu-ld happens to have this form.

llvm-svn: 166444

11 years agoProper copyright notice
Enrico Granata [Mon, 22 Oct 2012 22:03:16 +0000 (22:03 +0000)]
Proper copyright notice

llvm-svn: 166443

11 years agoASTReader.cpp: Fix a warning. [-Wunused-variable]
NAKAMURA Takumi [Mon, 22 Oct 2012 21:50:39 +0000 (21:50 +0000)]
ASTReader.cpp: Fix a warning. [-Wunused-variable]

llvm-svn: 166442

11 years agoTestcase change for r166440.
Eli Friedman [Mon, 22 Oct 2012 20:50:45 +0000 (20:50 +0000)]
Testcase change for r166440.

llvm-svn: 166441

11 years ago[ms-inline asm] Don't rewrite out parts of an inline-asm skipped by .if 0 and friends.
Eli Friedman [Mon, 22 Oct 2012 20:50:25 +0000 (20:50 +0000)]
[ms-inline asm] Don't rewrite out parts of an inline-asm skipped by .if 0 and friends.
It's unnecessary and makes the generated assembly less faithful to the original source.

llvm-svn: 166440

11 years ago<rdar://problem/12524810>
Greg Clayton [Mon, 22 Oct 2012 20:49:35 +0000 (20:49 +0000)]
<rdar://problem/12524810>

Fixed a crasher where if an invalid SBTarget was passed to:

lldb::addr_t
SBAddress::GetLoadAddress (const SBTarget &target) const;

We would crash.

llvm-svn: 166439

11 years agoFix for PR13334. This prevents crashes that result from badly formed
Richard Trieu [Mon, 22 Oct 2012 20:28:48 +0000 (20:28 +0000)]
Fix for PR13334.  This prevents crashes that result from badly formed
expressions involving __has_include

llvm-svn: 166438

11 years ago[ms-inline asm] Add the isOffsetOf() function.
Chad Rosier [Mon, 22 Oct 2012 19:50:35 +0000 (19:50 +0000)]
[ms-inline asm] Add the isOffsetOf() function.
Part of rdar://12470317

llvm-svn: 166436

11 years agoIterating over a DenseMap<std::pair<BasicBlock*, unsigned>, PHINode*> is not
Julien Lerouge [Mon, 22 Oct 2012 19:43:56 +0000 (19:43 +0000)]
Iterating over a DenseMap<std::pair<BasicBlock*, unsigned>, PHINode*> is not
deterministic, replace it with a DenseMap<std::pair<unsigned, unsigned>,
PHINode*> (we already have a map from BasicBlock to unsigned).

<rdar://problem/12541389>

llvm-svn: 166435

11 years ago[ms-inline asm] Test case for r166433.
Chad Rosier [Mon, 22 Oct 2012 19:43:17 +0000 (19:43 +0000)]
[ms-inline asm] Test case for r166433.

llvm-svn: 166434

11 years ago[ms-inline asm] Add support for parsing the offset operator. Callback for
Chad Rosier [Mon, 22 Oct 2012 19:42:52 +0000 (19:42 +0000)]
[ms-inline asm] Add support for parsing the offset operator.  Callback for
CodeGen in the front-end not implemented yet.
rdar://12470317

llvm-svn: 166433

11 years ago<rdar://problem/12479701> Use the plain pydoc pager to work around Python help()...
Enrico Granata [Mon, 22 Oct 2012 19:09:28 +0000 (19:09 +0000)]
<rdar://problem/12479701> Use the plain pydoc pager to work around Python help() pagination conflicts with our I/O management

llvm-svn: 166432

11 years agoFix pre-commit refacto failure.
Daniel Dunbar [Mon, 22 Oct 2012 18:56:43 +0000 (18:56 +0000)]
Fix pre-commit refacto failure.

llvm-svn: 166431

11 years agodriver/Darwin: Follow up to last patch, M-class CPUs are AAPCS but not EABI.
Daniel Dunbar [Mon, 22 Oct 2012 18:51:13 +0000 (18:51 +0000)]
driver/Darwin: Follow up to last patch, M-class CPUs are AAPCS but not EABI.

llvm-svn: 166430

11 years agoEliminate the redundancy between source-file information in the source
Douglas Gregor [Mon, 22 Oct 2012 18:42:04 +0000 (18:42 +0000)]
Eliminate the redundancy between source-file information in the source
manager block and input-file information in the control block. The
source manager entries now point back into the control block. Input
files are now lazily deserialized (if validation is disabled). Reduces
Cocoa's PCH by the ~70k I added when I introduced the redundancy in
r166251.

llvm-svn: 166429

11 years agodriver/Darwin: Default to AAPCS for M-class CPUs.
Daniel Dunbar [Mon, 22 Oct 2012 18:30:51 +0000 (18:30 +0000)]
driver/Darwin: Default to AAPCS for M-class CPUs.

 - This is an assumption that is currently hardwired into the backend, we need
   to do this in order for the frontend and backend to agree.

llvm-svn: 166428

11 years agoDon't crash if the load/store pointer is not a GEP.
Nadav Rotem [Mon, 22 Oct 2012 18:27:56 +0000 (18:27 +0000)]
Don't crash if the load/store pointer is not a GEP.

Fix by Shivarama Rao <Shivarama.Rao@amd.com>

llvm-svn: 166427

11 years ago<rdar://problem/12437442>
Enrico Granata [Mon, 22 Oct 2012 18:18:36 +0000 (18:18 +0000)]
<rdar://problem/12437442>
Given our implementation of ValueObjects we could have a scenario where a ValueObject has a dynamic type of Foo* at one point, and then its dynamic type changes to Bar*
If Bar* has synthetic children enabled, by the time we figure that out, our public API is already vending SBValues wrapping a DynamicVO, instead of a SyntheticVO and there was
no trivial way for us to change the SP inside an SBValue on the fly
This checkin reimplements SBValue in terms of a wrapper, ValueImpl, that allows this substitutions on-the-fly by overriding GetSP() to do The Right Thing (TM)
As an additional bonus, GetNonSyntheticValue() now works, and we can get rid of the ForceDisableSyntheticChildren idiom in ScriptInterpreterPython
Lastly, this checkin makes sure the synthetic VOs get the correct m_value and m_data from their parents (prevented summaries from working in some cases)

llvm-svn: 166426

11 years agoAdd a testcase for the previous commit.
Nadav Rotem [Mon, 22 Oct 2012 18:16:55 +0000 (18:16 +0000)]
Add a testcase for the previous commit.

llvm-svn: 166425

11 years agoRevert r166407 because it caused analyzer tests to crash and broke self-host bots.
Argyrios Kyrtzidis [Mon, 22 Oct 2012 18:16:14 +0000 (18:16 +0000)]
Revert r166407 because it caused analyzer tests to crash and broke self-host bots.

llvm-svn: 166424

11 years agoBBVectorize should ignore unreachable blocks.
Hal Finkel [Mon, 22 Oct 2012 18:00:55 +0000 (18:00 +0000)]
BBVectorize should ignore unreachable blocks.

Unreachable blocks can have invalid instructions. For example,
jump threading can produce self-referential instructions in
unreachable blocks. Also, we should not be spending time
optimizing unreachable code. Fixes PR14133.

llvm-svn: 166423

11 years agoAdd the "ForceSizeOpt" attribute.
Nadav Rotem [Mon, 22 Oct 2012 17:33:31 +0000 (17:33 +0000)]
Add the "ForceSizeOpt" attribute.

Patch by Quentin Colombet <qcolombet@apple.com>

Original description:
"""
The attached patch is the first step to have a better control on Oz related optimizations.
The Oz optimization level focuses on code size, thus I propose to add an attribute called ForceSizeOpt.
"""

llvm-svn: 166422

11 years agoImplement hasParent()-matcher.
Daniel Jasper [Mon, 22 Oct 2012 16:26:51 +0000 (16:26 +0000)]
Implement hasParent()-matcher.

llvm-svn: 166421

11 years ago<rdar://problem/12473003>
Greg Clayton [Mon, 22 Oct 2012 16:19:56 +0000 (16:19 +0000)]
<rdar://problem/12473003>

Allow type searches to specify a type keyword when searching for type. Currently supported type keywords are: struct, class, union, enum, and typedef.

So now you can search for types with a string like "struct foo".

llvm-svn: 166420

11 years agoRename a variable.
Nadav Rotem [Mon, 22 Oct 2012 04:53:05 +0000 (04:53 +0000)]
Rename a variable.

llvm-svn: 166410

11 years agoVectorizer: optimize the generation of selects. If the condition is uniform, generate...
Nadav Rotem [Mon, 22 Oct 2012 04:38:00 +0000 (04:38 +0000)]
Vectorizer: optimize the generation of selects. If the condition is uniform, generate a scalar-cond select (i1 as selector).

llvm-svn: 166409

11 years agoUpdate the loop vectorizer docs.
Nadav Rotem [Mon, 22 Oct 2012 03:52:53 +0000 (03:52 +0000)]
Update the loop vectorizer docs.

llvm-svn: 166408

11 years agoReapply r166405, teaching tailcallelim to be smarter about nocapture, with a
Nick Lewycky [Mon, 22 Oct 2012 03:03:52 +0000 (03:03 +0000)]
Reapply r166405, teaching tailcallelim to be smarter about nocapture, with a
very small but very important bugfix:
  bool shouldExplore(Use *U) {
    Value *V = U->get();
    if (isa<CallInst>(V) || isa<InvokeInst>(V))
    [...]
should have read:
  bool shouldExplore(Use *U) {
    Value *V = U->getUser();
    if (isa<CallInst>(V) || isa<InvokeInst>(V))
Fixes PR14143!

llvm-svn: 166407

11 years agoRevert r166405, "Teach TailRecursionElimination to consider 'nocapture' when deciding...
NAKAMURA Takumi [Mon, 22 Oct 2012 00:48:51 +0000 (00:48 +0000)]
Revert r166405, "Teach TailRecursionElimination to consider 'nocapture' when deciding whether"

It broke selfhosting stage2 in several builders.

llvm-svn: 166406

11 years agoTeach TailRecursionElimination to consider 'nocapture' when deciding whether
Nick Lewycky [Sun, 21 Oct 2012 23:51:22 +0000 (23:51 +0000)]
Teach TailRecursionElimination to consider 'nocapture' when deciding whether
calls can be marked tail.

llvm-svn: 166405

11 years agoPR14141 (part of DR1351): An implicitly-deduced "any" exception specification
Richard Smith [Sun, 21 Oct 2012 23:00:34 +0000 (23:00 +0000)]
PR14141 (part of DR1351): An implicitly-deduced "any" exception specification
produces an exception of 'noexcept(false)' and is thus compatible with an
explicit exception specification of 'noexcept(false)'.

llvm-svn: 166404

11 years agoautoconf/cmake: Always require isl code generation.
Tobias Grosser [Sun, 21 Oct 2012 21:48:21 +0000 (21:48 +0000)]
autoconf/cmake: Always require isl code generation.

This change ensures that isl is only detected if it includes code generation
support. This allows us to remove a lot of conditional compilation and also
avoids missing test cases in case the feature is not available.

llvm-svn: 166403

11 years agocmake: Use suffix for shared modules instead of the one for shared libraries
Tobias Grosser [Sun, 21 Oct 2012 21:08:29 +0000 (21:08 +0000)]
cmake: Use suffix for shared modules instead of the one for shared libraries

On Linux there is no difference between shared modules and shared libaries, both
are '.so' files. However, on darwin only shared modules are '.so' files. Shared
libraries have the '.dynlib' suffix.

Fix test cases on darwin by expecting a shared module suffix for Polly instead
of a shared library suffix.

This fixes PR14135

Reported by:  Jack Howarth  <howarth@bromo.med.uc.edu>

llvm-svn: 166402

11 years agoDataLayout should use itself when calculating the size of a vector.
Hal Finkel [Sun, 21 Oct 2012 20:38:03 +0000 (20:38 +0000)]
DataLayout should use itself when calculating the size of a vector.

This is important for vectors of pointers because only DataLayout,
not the underlying vector type, knows how to calculate the size
of the pointers in the vector. Fixes PR14138.

llvm-svn: 166401

11 years agoFix typo, make test case slightly more reabable. Thanks to Dmitri Gribenko for
Lang Hames [Sun, 21 Oct 2012 19:56:13 +0000 (19:56 +0000)]
Fix typo, make test case slightly more reabable. Thanks to Dmitri Gribenko for
the suggestions.

llvm-svn: 166400

11 years agoRevert r166390 "LoopIdiom: Replace custom dependence analysis with LoopDependenceAnal...
Benjamin Kramer [Sun, 21 Oct 2012 19:31:16 +0000 (19:31 +0000)]
Revert r166390 "LoopIdiom: Replace custom dependence analysis with LoopDependenceAnalysis."

It passes all tests, produces better results than the old code but uses the
wrong pass, LoopDependenceAnalysis, which is old and unmaintained. "Why is it
still in tree?", you might ask. The answer is obviously: "To confuse developers."

Just swapping in the new dependency pass sends the pass manager into an infinte
loop, I'll try to figure out why tomorrow.

llvm-svn: 166399

11 years agoDon't crash when the Assignments vector is empty.
Jakob Stoklund Olesen [Sun, 21 Oct 2012 19:05:03 +0000 (19:05 +0000)]
Don't crash when the Assignments vector is empty.

Reported by Vincent Lejeune using an out-of-tree target.

llvm-svn: 166398

11 years agoRegisterPasses: Remove unreachable default case in switch
Tobias Grosser [Sun, 21 Oct 2012 18:31:27 +0000 (18:31 +0000)]
RegisterPasses: Remove unreachable default case in switch

llvm-svn: 166397

11 years agowww: Correct command line that loads polly into dragonegg
Tobias Grosser [Sun, 21 Oct 2012 17:33:00 +0000 (17:33 +0000)]
www: Correct command line that loads polly into dragonegg

Reported by:  Jack Howarth  <howarth@bromo.med.uc.edu>

llvm-svn: 166396

11 years agoAvoid an extra hash lookup when inserting a value into the widen map.
Anders Carlsson [Sun, 21 Oct 2012 16:26:35 +0000 (16:26 +0000)]
Avoid an extra hash lookup when inserting a value into the widen map.

llvm-svn: 166395

11 years agoIntroduce a separate file for CMake macros
Tobias Grosser [Sun, 21 Oct 2012 15:51:49 +0000 (15:51 +0000)]
Introduce a separate file for CMake macros

Contributed by:  Sameer Sahasrabuddhe <sameer.sahasrabuddhe@amd.com>

llvm-svn: 166394

11 years agoSimplify code. No functionality change.
Jakub Staszak [Sun, 21 Oct 2012 15:36:03 +0000 (15:36 +0000)]
Simplify code. No functionality change.

llvm-svn: 166393

11 years agoSimplify code. No functionality change.
Jakub Staszak [Sun, 21 Oct 2012 15:29:19 +0000 (15:29 +0000)]
Simplify code. No functionality change.

llvm-svn: 166392

11 years agoSilence warning about && in ||.
Benjamin Kramer [Sun, 21 Oct 2012 15:21:56 +0000 (15:21 +0000)]
Silence warning about && in ||.

llvm-svn: 166391

11 years agoLoopIdiom: Replace custom dependence analysis with LoopDependenceAnalysis.
Benjamin Kramer [Sun, 21 Oct 2012 15:03:07 +0000 (15:03 +0000)]
LoopIdiom: Replace custom dependence analysis with LoopDependenceAnalysis.

Requires a lot less code and complexity on loop-idiom's side and the more
precise analysis can catch more cases, like the one I included as a test case.
This also fixes the edge-case miscompilation from PR9481. I'm not entirely
sure that all cases are handled that the old checks handled but LDA will
certainly become smarter in the future.

llvm-svn: 166390

11 years agoAdd support of MIPS n32 ABI to the Clang driver. The fix builds correct library/objec...
Simon Atanasyan [Sun, 21 Oct 2012 11:44:57 +0000 (11:44 +0000)]
Add support of MIPS n32 ABI to the Clang driver. The fix builds correct library/object files paths and passes appropriate command line options to the linker if user provides -mabi=n32 option.

The patch reviewed by Rafael Espindola.

llvm-svn: 166389

11 years agoFix a bug in the vectorization of wide load/store operations.
Nadav Rotem [Sun, 21 Oct 2012 06:49:10 +0000 (06:49 +0000)]
Fix a bug in the vectorization of wide load/store operations.
We used a SCEV to detect that A[X] is consecutive. We assumed that X was
the induction variable. But X can be any expression that uses the induction
for example: X = i + 2;

llvm-svn: 166388

11 years agoAdd support for reduction variables that do not start at zero.
Nadav Rotem [Sun, 21 Oct 2012 05:52:51 +0000 (05:52 +0000)]
Add support for reduction variables that do not start at zero.
This is important for nested-loop reductions such as :

In the innermost loop, the induction variable does not start with zero:

for (i = 0 .. n)
 for (j = 0 .. m)
  sum += ...

llvm-svn: 166387