platform/upstream/llvm.git
11 years agoSpeculative build fix for r188206.
Hans Wennborg [Mon, 12 Aug 2013 22:02:09 +0000 (22:02 +0000)]
Speculative build fix for r188206.

The cmake-clang-x86_64 was upset:
error: 'template<class ImplClass, class RetTy> class clang::ConstStmtVisitor' used without template parameters

llvm-svn: 188211

11 years agoclang-cl: Support the /Fe option
Hans Wennborg [Mon, 12 Aug 2013 21:56:42 +0000 (21:56 +0000)]
clang-cl: Support the /Fe option

This is used to name the linked output file.

Differential Revision: http://llvm-reviews.chandlerc.com/D1344

llvm-svn: 188210

11 years agoFix pretty-printing for unnamed unions.
Eli Friedman [Mon, 12 Aug 2013 21:54:04 +0000 (21:54 +0000)]
Fix pretty-printing for unnamed unions.

This is just a couple of minor fixes to account for the existence
of ElaboratedType.

llvm-svn: 188209

11 years agoFix crash w/BlockDecl and invalid qualified decl.
Eli Friedman [Mon, 12 Aug 2013 21:54:01 +0000 (21:54 +0000)]
Fix crash w/BlockDecl and invalid qualified decl.

I'm not really satisfied with the ad-hoc nature of
Sema::diagnoseQualifiedDeclaration, but I'm not sure how to fix it.

Fixes <rdar://problem/14639501>.

llvm-svn: 188208

11 years agoPatch by Chris Wailes <chris.wailes@gmail.com>.
DeLesley Hutchins [Mon, 12 Aug 2013 21:20:55 +0000 (21:20 +0000)]
Patch by Chris Wailes <chris.wailes@gmail.com>.
Reviewed by delesley, dblaikie.

Add the annotations and code needed to support a basic 'consumed' analysis.

Summary:
This new analysis is based on academic literature on linear types.  It tracks
the state of a value, either as unconsumed, consumed, or unknown.  Methods are
then annotated as CallableWhenUnconsumed, and when an annotated method is
called while the value is in the 'consumed' state a warning is issued.  A value
may be tested in the conditional statement of an if-statement; when this occurs
we know the state of the value in the different branches, and this information
is added to our analysis.  The code is still highly experimental, and the names
of annotations or the algorithm may be subject to change.

llvm-svn: 188206

11 years agoAdd editor C++ filetype declaration no functionality change.
Michael Gottesman [Mon, 12 Aug 2013 21:10:23 +0000 (21:10 +0000)]
Add editor C++ filetype declaration no functionality change.

llvm-svn: 188205

11 years agoRevert r188188 and r188200.
Shuxin Yang [Mon, 12 Aug 2013 21:07:31 +0000 (21:07 +0000)]
Revert r188188 and r188200.

In order to appease people (in Apple) who accuse me for committing "huge change" (?) without proper review.

Thank Eric for fixing a compile-warning.

llvm-svn: 188204

11 years agoFixed SelectionDAGBuilder.h C++ filetype declaration to use the canonical C++ instead...
Michael Gottesman [Mon, 12 Aug 2013 21:02:02 +0000 (21:02 +0000)]
Fixed SelectionDAGBuilder.h C++ filetype declaration to use the canonical C++ instead of c++.

llvm-svn: 188203

11 years agoFixed another place in CodeGen where we had a typo in our editor C++ filetype declara...
Michael Gottesman [Mon, 12 Aug 2013 20:52:06 +0000 (20:52 +0000)]
Fixed another place in CodeGen where we had a typo in our editor C++ filetype declaration.

llvm-svn: 188202

11 years ago[branchfolding] Fix typo in C++ editor declaration.
Michael Gottesman [Mon, 12 Aug 2013 20:49:27 +0000 (20:49 +0000)]
[branchfolding] Fix typo in C++ editor declaration.

llvm-svn: 188201

11 years agoFix warning about unused member.
Eric Christopher [Mon, 12 Aug 2013 20:27:50 +0000 (20:27 +0000)]
Fix warning about unused member.

llvm-svn: 188200

11 years agoMove the addition of the dwo_id as late as possible after everything
Eric Christopher [Mon, 12 Aug 2013 20:27:48 +0000 (20:27 +0000)]
Move the addition of the dwo_id as late as possible after everything
has been finalized except for sizes and offsets. Update test accordingly.

llvm-svn: 188199

11 years agoMove stack protector names to the same place.
Bill Wendling [Mon, 12 Aug 2013 20:09:37 +0000 (20:09 +0000)]
Move stack protector names to the same place.

llvm-svn: 188198

11 years agoForgot to add unittests/Sema/ before committing r188196 :(
Kaelyn Uhrain [Mon, 12 Aug 2013 19:57:06 +0000 (19:57 +0000)]
Forgot to add unittests/Sema/ before committing r188196 :(

llvm-svn: 188197

11 years agoAdd hooks for typo correction to ExternalSemaSource, courtesy of Luke Zarko.
Kaelyn Uhrain [Mon, 12 Aug 2013 19:54:38 +0000 (19:54 +0000)]
Add hooks for typo correction to ExternalSemaSource, courtesy of Luke Zarko.

llvm-svn: 188196

11 years ago[stack protector] Fixed typo.
Michael Gottesman [Mon, 12 Aug 2013 19:44:09 +0000 (19:44 +0000)]
[stack protector] Fixed typo.

llvm-svn: 188195

11 years ago[stackprotector] Add in the stackprotector libcall.
Michael Gottesman [Mon, 12 Aug 2013 18:45:38 +0000 (18:45 +0000)]
[stackprotector] Add in the stackprotector libcall.

We support this libcall on all platforms except for OpenBSD (See
lib/Codegen/StackProtector.cpp).

llvm-svn: 188193

11 years agoNico Rieck: this patch series fixes visibility issues on Windows as explained in...
Howard Hinnant [Mon, 12 Aug 2013 18:38:34 +0000 (18:38 +0000)]
Nico Rieck:  this patch series fixes visibility issues on Windows as explained in <lists.cs.uiuc.edu/pipermail/cfe-dev/2013-August/031214.html>.

llvm-svn: 188192

11 years ago[stackprotector] Added intrinsic llvm.stackprotectorcheck.
Michael Gottesman [Mon, 12 Aug 2013 18:35:32 +0000 (18:35 +0000)]
[stackprotector] Added intrinsic llvm.stackprotectorcheck.

llvm-svn: 188191

11 years agoclang-cl: Expand warning about /TC and /TP override, and expand test
Hans Wennborg [Mon, 12 Aug 2013 18:34:17 +0000 (18:34 +0000)]
clang-cl: Expand warning about /TC and /TP override, and expand test

llvm-svn: 188190

11 years agoChange PowerPC to have the correct byte order.
Greg Clayton [Mon, 12 Aug 2013 18:34:04 +0000 (18:34 +0000)]
Change PowerPC to have the correct byte order.

llvm-svn: 188189

11 years agoMisc enhancements to LTO:
Shuxin Yang [Mon, 12 Aug 2013 18:29:43 +0000 (18:29 +0000)]
Misc enhancements to LTO:

  1. Add some helper classes for partitions. They are designed in a
     way such that the top-level LTO driver will not see much difference
     with or without partitioning.

  2. Introduce work-dir. Now all intermediate files generated during
     LTO phases will be saved under work-dir. User can specify the workdir
     via -lto-workdir=/path/to/dir. By default the work-dir will be
     erased before linker exit. To keep the workdir, do -lto-keep, or -lto-keep=1.

    TODO: Erase the workdir, if the linker exit prematurely.
      We are currently not able to remove directory on signal. The support
      routines simply ignore directory.

  3. Add one new API lto_codegen_get_files_need_remove().
     Linker and LTO plugin will communicate via this API about which files
    (including directories) need to removed before linker exit.

llvm-svn: 188188

11 years ago[PECOFF] Fixed base images now have the IMAGE_FILE_RELOCS_STRIPPED flag
Rui Ueyama [Mon, 12 Aug 2013 18:11:35 +0000 (18:11 +0000)]
[PECOFF] Fixed base images now have the IMAGE_FILE_RELOCS_STRIPPED flag

Patch by Ron Ofir.

llvm-svn: 188187

11 years agoFix PR16797 - Support PHINodes with multiple inputs from the same basic block.
Nadav Rotem [Mon, 12 Aug 2013 17:46:44 +0000 (17:46 +0000)]
Fix PR16797 - Support PHINodes with multiple inputs from the same basic block.
Do not generate new vector values for the same entries because we know that the incoming values
from the same block must be identical.

llvm-svn: 188185

11 years ago[Mips] MSA frontend option support
Jack Carter [Mon, 12 Aug 2013 17:20:29 +0000 (17:20 +0000)]
[Mips] MSA frontend option support

This patch adds -mmsa and -mno-msa to the options supported by
clang to enable and disable support for MSA.

When MSA is enabled, a predefined macro '__mips_msa' is defined to 1.

Patch by Daniel Sanders

llvm-svn: 188184

11 years agoFixes a bug when iterating on paths
Tareq A. Siraj [Mon, 12 Aug 2013 17:10:49 +0000 (17:10 +0000)]
Fixes a bug when iterating on paths

This fixes the incorrect implementation of iterating on file/directory
paths.

Differential Review: http://llvm-reviews.chandlerc.com/D1277

llvm-svn: 188183

11 years agoThis test passes on freebsd after r188178. Not exactly sure why.
Benjamin Kramer [Mon, 12 Aug 2013 16:29:25 +0000 (16:29 +0000)]
This test passes on freebsd after r188178. Not exactly sure why.

llvm-svn: 188182

11 years agoAdd intN vloadN() implementations for address spaces 3 and 4
Aaron Watry [Mon, 12 Aug 2013 14:42:51 +0000 (14:42 +0000)]
Add intN vloadN() implementations for address spaces 3 and 4

Not hooked up to R600 yet due to current lack of support, at least on EG.

Signed-off-by: Aaron Watry <awatry@gmail.com>
Reviewed-by: Tom Stellard <thomas.stellard@amd.com>
llvm-svn: 188181

11 years agoEnable assembly vload3 int/uint constant/global for R600
Aaron Watry [Mon, 12 Aug 2013 14:42:50 +0000 (14:42 +0000)]
Enable assembly vload3 int/uint constant/global for R600

It's supported by the R600 LLVM back-end now, at least for evergreen.

Signed-off-by: Aaron Watry <awatry@gmail.com>
Reviewed-by: Tom Stellard <thomas.stellard@amd.com>
llvm-svn: 188180

11 years agoAdd vload* for addrspace(2) and use as constant load for R600
Aaron Watry [Mon, 12 Aug 2013 14:42:49 +0000 (14:42 +0000)]
Add vload* for addrspace(2) and use as constant load for R600

Signed-off-by: Aaron Watry <awatry@gmail.com>
Reviewed-by: Tom Stellard <thomas.stellard@amd.com>
llvm-svn: 188179

11 years agoSourceManager intialization tweaks.
Benjamin Kramer [Mon, 12 Aug 2013 13:46:52 +0000 (13:46 +0000)]
SourceManager intialization tweaks.

- Open files before calling stat on them.
- Go through FileManager for getting the buffer of named pipes. It has the
  necessary plumbing to deal with "volatile" files.
- Print the cause when stdin reading fails. The only case I can imagine where
  this happens is when stdin is wired to a device file, so no test case.

llvm-svn: 188178

11 years ago[sanitizer] Intercept poll/ppoll.
Evgeniy Stepanov [Mon, 12 Aug 2013 13:19:53 +0000 (13:19 +0000)]
[sanitizer] Intercept poll/ppoll.

llvm-svn: 188177

11 years agoThis patch implements ei and di instructions for mips. Test cases are added.
Vladimir Medic [Mon, 12 Aug 2013 13:07:23 +0000 (13:07 +0000)]
This patch implements ei and di instructions for mips. Test cases are added.

llvm-svn: 188176

11 years agoclang-format: Improve stream-formatting.
Daniel Jasper [Mon, 12 Aug 2013 12:58:05 +0000 (12:58 +0000)]
clang-format: Improve stream-formatting.

Before:
  CHECK(controller->WriteProto(FLAGS_row_key, FLAGS_proto)) << "\""
                                                            << FLAGS_proto
                                                            << "\"";

After:
  SemaRef.Diag(Loc, diag::note_for_range_begin_end)
      << BEF << IsTemplate << Description << E->getType();

llvm-svn: 188175

11 years agoFix FileCheck --check-prefix lines.
Tim Northover [Mon, 12 Aug 2013 12:51:05 +0000 (12:51 +0000)]
Fix FileCheck --check-prefix lines.

Various tests had sprung up over the years which had --check-prefix=ABC on the
RUN line, but "CHECK-ABC:" later on. This happened to work before, but was
strictly incorrect. FileCheck is getting stricter soon though.

Patch by Ron Ofir.

llvm-svn: 188174

11 years agoFix FileCheck --check-prefix lines.
Tim Northover [Mon, 12 Aug 2013 12:43:26 +0000 (12:43 +0000)]
Fix FileCheck --check-prefix lines.

Various tests had sprung up over the years which had --check-prefix=ABC on the
RUN line, but "CHECK-ABC:" later on. This happened to work before, but was
strictly incorrect. FileCheck is getting stricter soon though.

Patch by Ron Ofir.

llvm-svn: 188173

11 years agoclang-format: Correctly format alias declarations.
Daniel Jasper [Mon, 12 Aug 2013 12:16:34 +0000 (12:16 +0000)]
clang-format: Correctly format alias declarations.

Before:
  template <class CallbackClass>
  using MyCallback = void(CallbackClass::*)(SomeObject * Data);");

After:
  template <class CallbackClass>
  using MyCallback = void (CallbackClass::*)(SomeObject *Data);");

Also fix three wrong indentations.

llvm-svn: 188172

11 years agoRemove unused SpecialCaseList constructors
Alexey Samsonov [Mon, 12 Aug 2013 11:50:44 +0000 (11:50 +0000)]
Remove unused SpecialCaseList constructors

llvm-svn: 188171

11 years agoUse new llvm::SpecialCaseList API in CodeGenModule
Alexey Samsonov [Mon, 12 Aug 2013 11:48:05 +0000 (11:48 +0000)]
Use new llvm::SpecialCaseList API in CodeGenModule

llvm-svn: 188170

11 years agoAdd SpecialCaseList::createOrDie() factory and use it in sanitizer passes
Alexey Samsonov [Mon, 12 Aug 2013 11:46:09 +0000 (11:46 +0000)]
Add SpecialCaseList::createOrDie() factory and use it in sanitizer passes

llvm-svn: 188169

11 years agoRemove CRs added in r187370.
Nico Weber [Mon, 12 Aug 2013 11:43:36 +0000 (11:43 +0000)]
Remove CRs added in r187370.

llvm-svn: 188168

11 years ago[sanitizer] Intercept getgroups.
Evgeniy Stepanov [Mon, 12 Aug 2013 11:01:40 +0000 (11:01 +0000)]
[sanitizer] Intercept getgroups.

llvm-svn: 188167

11 years agoRevert r188164: Stablize MCK_Reg ordering in AsmMatcherEmitter
Richard Sandiford [Mon, 12 Aug 2013 10:57:51 +0000 (10:57 +0000)]
Revert r188164: Stablize MCK_Reg ordering in AsmMatcherEmitter

Apparently caused a failure on Darwin

llvm-svn: 188166

11 years agoRemove all checking for the various terminfo headers (term.h and
Chandler Carruth [Mon, 12 Aug 2013 10:40:11 +0000 (10:40 +0000)]
Remove all checking for the various terminfo headers (term.h and
curses.h). Finding these headers is next to impossible. For example, on
Debian systems libtinfo-dev provides the terminfo reading library we
want, but *not* term.h. For the header, you have to use libncurses-dev.
And libncursesw-dev provides a *different* term.h in a different
location!

These headers aren't worth it. We want two functions the signatures of
which are clearly spec'ed in sys-v and other documentation. Just declare
them ourselves and call them. This should fix some debian builders and
provide better support for "minimal" debian systems that do want color
autodetection.

llvm-svn: 188165

11 years agoStablize MCK_Reg ordering in AsmMatcherEmitter
Richard Sandiford [Mon, 12 Aug 2013 10:39:45 +0000 (10:39 +0000)]
Stablize MCK_Reg ordering in AsmMatcherEmitter

clang bootstraps intermittently failed for me due a difference in
the MCK_Reg ordering in ARMGenAsmMatcher.inc.  E.g. in my latest
run the stage 1 and stage 3 versions were the same but the stage 2
one was different (though still functionally correct).  This meant
that the .o comparison failed.

MCK_Regs were assigned by iterating over a std::set< std::set<Record*> >,
and since std::set is sorted lexicographically, the order depended on the
order of the pointer values.  This patch replaces the pointer ordering
with LessRecordByID.

llvm-svn: 188164

11 years ago[SystemZ] Use CLC and IPM to implement memcmp
Richard Sandiford [Mon, 12 Aug 2013 10:28:10 +0000 (10:28 +0000)]
[SystemZ] Use CLC and IPM to implement memcmp

For now this is restricted to fixed-length comparisons with a length
in the range [1, 256], as for memcpy() and MVC.

llvm-svn: 188163

11 years ago[SystemZ] Add a definition of the CLC instruction
Richard Sandiford [Mon, 12 Aug 2013 10:17:33 +0000 (10:17 +0000)]
[SystemZ] Add a definition of the CLC instruction

llvm-svn: 188162

11 years ago[SystemZ] Add a definition of the IPM instruction
Richard Sandiford [Mon, 12 Aug 2013 10:05:58 +0000 (10:05 +0000)]
[SystemZ] Add a definition of the IPM instruction

llvm-svn: 188161

11 years agoTarget a minimal terminfo library rather than necessarily a full curses
Chandler Carruth [Mon, 12 Aug 2013 09:49:17 +0000 (09:49 +0000)]
Target a minimal terminfo library rather than necessarily a full curses
library for color support detection. This still will use a curses
library if that is all we have available on the system. This change
tries to use a smaller subset of the curses library, specifically the
subset that is on some systems split off into a separate library. For
example, if you install ncurses configured --with-tinfo, a 'libtinfo' is
install that provides just the terminfo querying functionality. That
library is now used instead of curses when it is available.

This happens to fix a build error on systems with that library because
when we tried to link ncurses into the binary, we didn't pull tinfo in
as well. =]

It should also provide an easy path for supporting the NetBSD
libterminfo library, but as I don't have access to a NetBSD system I'm
leaving adding that support to those folks.

llvm-svn: 188160

11 years agoAllow compatible extension attributes for tail calls
Tim Northover [Mon, 12 Aug 2013 09:45:46 +0000 (09:45 +0000)]
Allow compatible extension attributes for tail calls

If the tail-callee and caller give the same bits via the same signext/zeroext
attribute then a tail-call should be allowed, since the extension has already
been done by the callee.

llvm-svn: 188159

11 years agoRemove global construction. const char* is sufficient here.
Benjamin Kramer [Mon, 12 Aug 2013 09:37:29 +0000 (09:37 +0000)]
Remove global construction. const char* is sufficient here.

No functionality change.

llvm-svn: 188158

11 years agoRelax conditions of test added in r188156 to fix it on Windows
Alexey Samsonov [Mon, 12 Aug 2013 09:04:58 +0000 (09:04 +0000)]
Relax conditions of test added in r188156 to fix it on Windows

llvm-svn: 188157

11 years agoIntroduce factory methods for SpecialCaseList
Alexey Samsonov [Mon, 12 Aug 2013 07:49:36 +0000 (07:49 +0000)]
Introduce factory methods for SpecialCaseList

Summary:
Doing work in constructors is bad: this change suggests to
call SpecialCaseList::create(Path, Error) instead of
"new SpecialCaseList(Path)". Currently the latter may crash with
report_fatal_error, which is undesirable - sometimes we want to report
the error to user gracefully - for example, if he provides an incorrect
file as an argument of Clang's -fsanitize-blacklist flag.

Reviewers: pcc

Reviewed By: pcc

CC: llvm-commits
Differential Revision: http://llvm-reviews.chandlerc.com/D1327

llvm-svn: 188156

11 years agoFix big-endian handling of integer-to-vector bitcasts in InstCombine
Richard Sandiford [Mon, 12 Aug 2013 07:26:09 +0000 (07:26 +0000)]
Fix big-endian handling of integer-to-vector bitcasts in InstCombine

These functions used to assume that the lsb of an integer corresponds
to vector element 0, whereas for big-endian it's the other way around:
the msb is in the first element and the lsb is in the last element.

Fixes MultiSource/Benchmarks/mediabench/gsm/toast for z.

llvm-svn: 188155

11 years ago[PECOFF] Trim at most one character from imported symbols.
Rui Ueyama [Mon, 12 Aug 2013 04:10:00 +0000 (04:10 +0000)]
[PECOFF] Trim at most one character from imported symbols.

The import name is not always the same as the symbol name. If the name/type
field in the import header is NOPREFIX or UNDECORATE, we need to strip some
characters from symbol to get its import name.

The Microsoft PE/COFF spec is vague if symbol contains more than two
consecutive characters to be stripped. We used to strip all characters,
but it doesn't seem right as we couldn't link against the system library
because of this name mangling. Looks like we shouldn't strip more than one
character.

llvm-svn: 188154

11 years agoThis change fixes the formatting of statements such as catch (E& e).
Manuel Klimek [Mon, 12 Aug 2013 03:51:17 +0000 (03:51 +0000)]
This change fixes the formatting of statements such as catch (E& e).

Previously these were formatting as catch (E & e) because the inner parenthesis
was being marked as an expression.

Patch by Thomas Gibson-Robinson.

llvm-svn: 188153

11 years agoRevert r188150 to un-break the buildbot.
Rui Ueyama [Mon, 12 Aug 2013 03:02:23 +0000 (03:02 +0000)]
Revert r188150 to un-break the buildbot.

llvm-svn: 188152

11 years agoFix misindentation.
Richard Smith [Mon, 12 Aug 2013 02:53:18 +0000 (02:53 +0000)]
Fix misindentation.

llvm-svn: 188151

11 years ago[PECOFF] It's an error if subsystem is not specified.
Rui Ueyama [Mon, 12 Aug 2013 02:23:16 +0000 (02:23 +0000)]
[PECOFF] It's an error if subsystem is not specified.

llvm-svn: 188150

11 years agoDon't generate floating point stubs for mips16 code if the function
Reed Kotler [Sun, 11 Aug 2013 21:30:27 +0000 (21:30 +0000)]
Don't generate floating point stubs for mips16 code if the function
is actually an instrinsic that will not occur in libc. This list here
is not exhaustive but fixes the one places in test-suite where this occurs.
I have filed a bug against myself to research the full list and add them
to the array of such cases. In the future, actual stub generation will occur
in a later phase and we won't need this code because we will know at that time
during the compilation that in fact no helper function was even needed.

llvm-svn: 188149

11 years agoAVX-512: Added more tests for BROADCAST
Elena Demikhovsky [Sun, 11 Aug 2013 12:29:16 +0000 (12:29 +0000)]
AVX-512: Added more tests for BROADCAST

llvm-svn: 188148

11 years agoAVX-512: Added VPERM* instructons and MOV* zmm-to-zmm instructions.
Elena Demikhovsky [Sun, 11 Aug 2013 07:55:09 +0000 (07:55 +0000)]
AVX-512: Added VPERM* instructons and MOV* zmm-to-zmm instructions.
Added a test for shuffles using VPERM.

llvm-svn: 188147

11 years agoRe-instate r187323 which fast-tracks promotable allocas as soon as the
Chandler Carruth [Sun, 11 Aug 2013 02:17:11 +0000 (02:17 +0000)]
Re-instate r187323 which fast-tracks promotable allocas as soon as the
SROA-based analysis has enough information. This should work now that
both mem2reg *and* the SSAUpdater-based AllocaPromoter have been updated
to be able to promote the types of allocas that the SROA analysis
detects.

I've included tests for the AllocaPromoter that were only possible to
write once we fast-tracked promotable allocas without rewriting them.
This includes a test both for r187347 and r188145.

Original commit log for r187323:
"""
Now that mem2reg understands how to cope with a slightly wider set of uses of
an alloca, we can pre-compute promotability while analyzing an alloca for
splitting in SROA. That lets us short-circuit the common case of a bunch of
trivially promotable allocas. This cuts 20% to 30% off the run time of SROA for
typical frontend-generated IR sequneces I'm seeing. It gets the new SROA to
within 20% of ScalarRepl for such code. My current benchmark for these numbers
is PR15412, but it fits the general pattern of IR emitted by Clang so it should
be widely applicable.
"""

llvm-svn: 188146

11 years agoFinish fixing the SSAUpdater-based AllocaPromoter strategy in SROA to cope with
Chandler Carruth [Sun, 11 Aug 2013 01:56:15 +0000 (01:56 +0000)]
Finish fixing the SSAUpdater-based AllocaPromoter strategy in SROA to cope with
the more general set of patterns that are now handled by mem2reg and that we
can detect quickly while doing SROA's initial analysis. Notably, this allows it
to promote through no-op bitcast and GEP sequences. A core part of the
SSAUpdater approach is the ability to test whether a particular instruction is
part of the set being promoted. Testing this becomes significantly more complex
in the world where the operand to every load and store isn't the alloca itself.
I ended up using the approach of walking up the def-chain until we find the
alloca. I benchmarked this against keeping a set of pointer operands and
keeping a set of the loads and stores we care about, and this one seemed faster
although the difference was very small.

No test case yet because currently the rewriting always "fixes" the inputs to
not require this. The next patch which re-enables early promotion of easy cases
in SROA will include a test case that specifically exercises this aspect of the
alloca promoter.

llvm-svn: 188145

11 years agoReformat some bits of AllocaPromoter and simplify the name and type of
Chandler Carruth [Sun, 11 Aug 2013 01:03:18 +0000 (01:03 +0000)]
Reformat some bits of AllocaPromoter and simplify the name and type of
our visiting datastructures in the AllocaPromoter/SSAUpdater path of
SROA. Also shift the order if clears around to be more consistent.

No functionality changed here, this is just a cleanup.

llvm-svn: 188144

11 years agoIncorrect JAL instruction attributes caused the optimizer to make a wrong
Reed Kotler [Sat, 10 Aug 2013 22:18:22 +0000 (22:18 +0000)]
Incorrect JAL instruction attributes caused the optimizer to make a wrong
instruction move. Just affects static relocation. -static works fine now
with mips16 for the most part.

llvm-svn: 188143

11 years agoRevert r188119 "Kill some duplicated code for removing unreachable BBs."
Arnold Schwaighofer [Sat, 10 Aug 2013 20:16:06 +0000 (20:16 +0000)]
Revert r188119 "Kill some duplicated code for removing unreachable BBs."

It is breaking builbots with libgmalloc enabled on Mac OS X.

$ cd llvm ; mkdir release ; cd release
$ ../configure --enable-optimized â€”prefix=$PWD/install
$ make
$ make check
$ Release+Asserts/bin/llvm-lit -v --param use_gmalloc=1 --param \
  gmalloc_path=/usr/lib/libgmalloc.dylib \
  ../test/Instrumentation/DataFlowSanitizer/args-unreachable-bb.ll

llvm-svn: 188142

11 years ago[Sparc] Enable xword directive in sparcv9.
Venkatraman Govindaraju [Sat, 10 Aug 2013 20:13:20 +0000 (20:13 +0000)]
[Sparc] Enable xword directive in sparcv9.

llvm-svn: 188141

11 years agoTeach ValueTracking about address spaces
Matt Arsenault [Sat, 10 Aug 2013 17:34:08 +0000 (17:34 +0000)]
Teach ValueTracking about address spaces

llvm-svn: 188140

11 years agoOmit llvm:: before StringRef and SmallString. We have using directive in include...
Robert Wilhelm [Sat, 10 Aug 2013 13:29:01 +0000 (13:29 +0000)]
Omit  llvm:: before StringRef and SmallString. We have using directive in include/clang/Basic/LLVM.h.

llvm-svn: 188139

11 years agoOmit llvm:: before SmallVector and SmallVectorImpl. We have using directive in inclu...
Robert Wilhelm [Sat, 10 Aug 2013 12:33:24 +0000 (12:33 +0000)]
Omit  llvm:: before SmallVector and SmallVectorImpl. We have using directive in include/clang/Basic/LLVM.h.

llvm-svn: 188138

11 years agoFix to PR16225 (Assert-on-invalid: isa<LabelDecl>(D) && "declaration not instantiated...
Serge Pavlov [Sat, 10 Aug 2013 12:00:21 +0000 (12:00 +0000)]
Fix to PR16225 (Assert-on-invalid: isa<LabelDecl>(D) && "declaration not instantiated in this scope")

Differential Revision: http://llvm-reviews.chandlerc.com/D920

llvm-svn: 188137

11 years agoR600/SI: FMA is faster than fmul and fadd for f64
Niels Ole Salscheider [Sat, 10 Aug 2013 10:38:54 +0000 (10:38 +0000)]
R600/SI: FMA is faster than fmul and fadd for f64

llvm-svn: 188136

11 years agoR600/SI: Add FMA pattern
Niels Ole Salscheider [Sat, 10 Aug 2013 10:38:47 +0000 (10:38 +0000)]
R600/SI: Add FMA pattern

llvm-svn: 188135

11 years agoAdded source locs for angled parentheses in class/var template partial specs.
Enea Zaffanella [Sat, 10 Aug 2013 07:24:53 +0000 (07:24 +0000)]
Added source locs for angled parentheses in class/var template partial specs.

llvm-svn: 188134

11 years agoAvoid spurious error messages if parent template class cannot be instantiated
Serge Pavlov [Sat, 10 Aug 2013 05:54:47 +0000 (05:54 +0000)]
Avoid spurious error messages if parent template class cannot be instantiated

Differential Revision: http://llvm-reviews.chandlerc.com/D924

llvm-svn: 188133

11 years agoFix warning in builds without asserts.
Rafael Espindola [Sat, 10 Aug 2013 04:25:53 +0000 (04:25 +0000)]
Fix warning in builds without asserts.

llvm-svn: 188132

11 years agoAdd some missing convert_* functions
Tom Stellard [Sat, 10 Aug 2013 03:40:37 +0000 (03:40 +0000)]
Add some missing convert_* functions

llvm-svn: 188131

11 years agoImplement generic rint()
Tom Stellard [Sat, 10 Aug 2013 03:40:33 +0000 (03:40 +0000)]
Implement generic rint()

llvm-svn: 188130

11 years agoconfigure: Fix build when clang is installed to a non-standard prefix
Tom Stellard [Sat, 10 Aug 2013 03:40:26 +0000 (03:40 +0000)]
configure: Fix build when clang is installed to a non-standard prefix

llvm-svn: 188129

11 years agoSimplify now that llvm::sys::current_path checks $PWD.
Rafael Espindola [Sat, 10 Aug 2013 01:40:10 +0000 (01:40 +0000)]
Simplify now that llvm::sys::current_path checks $PWD.

llvm-svn: 188128

11 years ago[analyzer] Update Open Projects and Potential Checkers pages.
Jordan Rose [Sat, 10 Aug 2013 01:24:35 +0000 (01:24 +0000)]
[analyzer] Update Open Projects and Potential Checkers pages.

- va_list checker (PR16811 and PR16812)
- Model floating-point values
- Bound bitwise masking operations (PR16615)
- Bound C string length (PR16558 and others)

llvm-svn: 188127

11 years agoclang/test/Driver/cl-options.c: Suppress this on cygming due to -fno-builtin.
NAKAMURA Takumi [Sat, 10 Aug 2013 00:59:43 +0000 (00:59 +0000)]
clang/test/Driver/cl-options.c: Suppress this on cygming due to -fno-builtin.

llvm-svn: 188126

11 years agoCheck for $PWD in llvm::sys::current_path.
Rafael Espindola [Sat, 10 Aug 2013 00:50:57 +0000 (00:50 +0000)]
Check for $PWD in llvm::sys::current_path.

Some users (clang, libTooling) require this. After this patch we can remove
the calls to getenv("PWD") from clang.

llvm-svn: 188125

11 years agoFixed a case where GCC was emitting a DW_TAG_class_type that has a DW_AT_declaration...
Greg Clayton [Sat, 10 Aug 2013 00:09:35 +0000 (00:09 +0000)]
Fixed a case where GCC was emitting a DW_TAG_class_type that has a DW_AT_declaration set to true, yet the class actually contains a definition for the class in that DIE.

llvm-svn: 188124

11 years agoCorrectly profile CXXPseudoDestructorExprs.
Eli Friedman [Fri, 9 Aug 2013 23:37:05 +0000 (23:37 +0000)]
Correctly profile CXXPseudoDestructorExprs.

CXXPseudoDestructorExprs may not contain a type.  PR16852.

llvm-svn: 188123

11 years ago[objc-arc] Track if we encountered an additive overflow while computing {TopDown...
Michael Gottesman [Fri, 9 Aug 2013 23:22:27 +0000 (23:22 +0000)]
[objc-arc] Track if we encountered an additive overflow while computing {TopDown,BottomUp}PathCounts and do nothing if it occurred.

I fixed the aforementioned problems that came up on some of the linux boxes.
Major thanks to Nick Lewycky for his help debugging!

rdar://14590914

llvm-svn: 188122

11 years agoExpose LambdaIntroducer::DefaultLoc in the AST's LambdaExpr.
James Dennett [Fri, 9 Aug 2013 23:08:25 +0000 (23:08 +0000)]
Expose LambdaIntroducer::DefaultLoc in the AST's LambdaExpr.

Summary:
Source-centric tools need access to the location of a C++11
lambda expression's capture-default ('&' or '=') when it's present.
It's possible for them to find it by re-lexing and re-implementing
rules that Clang's parser has already applied, but the cost of storing
the SourceLocation and making it available to them is 32 bits per
LambdaExpr (a small delta, proportionally), and the simplification in
client code is significant.

Reviewers: rsmith

Reviewed By: rsmith

CC: cfe-commits, klimek, revane
Differential Revision: http://llvm-reviews.chandlerc.com/D1192

llvm-svn: 188121

11 years agoFix typo in template diffing docs.
Richard Trieu [Fri, 9 Aug 2013 22:52:48 +0000 (22:52 +0000)]
Fix typo in template diffing docs.

llvm-svn: 188120

11 years agoKill some duplicated code for removing unreachable BBs.
Peter Collingbourne [Fri, 9 Aug 2013 22:47:24 +0000 (22:47 +0000)]
Kill some duplicated code for removing unreachable BBs.

This moves removeUnreachableBlocksFromFn from SimplifyCFGPass.cpp
to Utils/Local.cpp and uses it to replace the implementation of
llvm::removeUnreachableBlocks, which appears to do a strict subset
of what removeUnreachableBlocksFromFn does.

Differential Revision: http://llvm-reviews.chandlerc.com/D1334

llvm-svn: 188119

11 years ago[tests] Add one more lit rename update I missed.
Daniel Dunbar [Fri, 9 Aug 2013 22:23:23 +0000 (22:23 +0000)]
[tests] Add one more lit rename update I missed.

llvm-svn: 188117

11 years ago[tests] Update to use lit_config and lit package, as appropriate.
Daniel Dunbar [Fri, 9 Aug 2013 22:14:01 +0000 (22:14 +0000)]
[tests] Update to use lit_config and lit package, as appropriate.

llvm-svn: 188116

11 years ago[tests] Update to use lit_config and lit package, as appropriate.
Daniel Dunbar [Fri, 9 Aug 2013 21:54:36 +0000 (21:54 +0000)]
[tests] Update to use lit_config and lit package, as appropriate.

llvm-svn: 188114

11 years agoDataFlowSanitizer: Remove unreachable BBs so IR continues to verify
Peter Collingbourne [Fri, 9 Aug 2013 21:42:53 +0000 (21:42 +0000)]
DataFlowSanitizer: Remove unreachable BBs so IR continues to verify
under the args ABI.

Differential Revision: http://llvm-reviews.chandlerc.com/D1316

llvm-svn: 188113

11 years agoFix for PR16570: when comparing two function pointers, discard qualifiers when
Richard Trieu [Fri, 9 Aug 2013 21:42:32 +0000 (21:42 +0000)]
Fix for PR16570: when comparing two function pointers, discard qualifiers when
comparing non-reference function parameters.  The qualifiers don't matter for
comparisons.

This is a re-commit of r187769, which was accidentially reverted in r187770,
with a simplification at the suggestion of Eli Friedman.

llvm-svn: 188112

11 years ago[lit] Remove old ExamplesTests directory.
Daniel Dunbar [Fri, 9 Aug 2013 21:39:36 +0000 (21:39 +0000)]
[lit] Remove old ExamplesTests directory.

 - The actual tests have better coverage than those, and they weren't useful
   anymore.

llvm-svn: 188110

11 years ago[lit] Move ManyTests examples to lit/examples/many-tests.
Daniel Dunbar [Fri, 9 Aug 2013 21:39:28 +0000 (21:39 +0000)]
[lit] Move ManyTests examples to lit/examples/many-tests.

llvm-svn: 188109

11 years ago[lit] Drop deprecated aliases for lit and old module names.
Daniel Dunbar [Fri, 9 Aug 2013 21:39:24 +0000 (21:39 +0000)]
[lit] Drop deprecated aliases for lit and old module names.

llvm-svn: 188108

11 years ago[lit] Update lit's own tests to use lit_config and lit package, as appropriate.
Daniel Dunbar [Fri, 9 Aug 2013 21:39:17 +0000 (21:39 +0000)]
[lit] Update lit's own tests to use lit_config and lit package, as appropriate.

llvm-svn: 188107

11 years agoAdd another intrinsic that LLVM gives an incorrect prototype to.
Reed Kotler [Fri, 9 Aug 2013 21:33:41 +0000 (21:33 +0000)]
Add another intrinsic that LLVM gives an incorrect prototype to.
I need to go through all the runtime routine list and see if there
are any more I need to add for mips16 floating point. Prototypes must
be correct or else I don't know to add a helper function call.

llvm-svn: 188106