platform/upstream/llvm.git
11 years agolit/ShUtil.py: Deprecate '!' in shell expression. It is not sh-compatible.
NAKAMURA Takumi [Fri, 25 Jan 2013 06:30:36 +0000 (06:30 +0000)]
lit/ShUtil.py: Deprecate '!' in shell expression. It is not sh-compatible.

llvm-svn: 173421

11 years agoSchedDFS: Initial support for nested subtrees.
Andrew Trick [Fri, 25 Jan 2013 06:02:44 +0000 (06:02 +0000)]
SchedDFS: Initial support for nested subtrees.

This is mostly refactoring, along with adding an instruction count
within the subtrees and ensuring we only look at data edges.

llvm-svn: 173420

11 years agoclang/test: Drop "REQUIRES:shell" in three tests. They can run on win32.
NAKAMURA Takumi [Fri, 25 Jan 2013 06:02:11 +0000 (06:02 +0000)]
clang/test: Drop "REQUIRES:shell" in three tests. They can run on win32.

llvm-svn: 173419

11 years agoclang/test/CodeGenCXX/debug-info-static-member.cpp: Appease targetting msvc to add...
NAKAMURA Takumi [Fri, 25 Jan 2013 05:58:53 +0000 (05:58 +0000)]
clang/test/CodeGenCXX/debug-info-static-member.cpp: Appease targetting msvc to add explicit -target x86_64-unknown-unknown.

with -target i686-win32, you will see;

debug-info-static-member.cpp:11:22: error: in-class initializer for static data member of type 'const float' requires 'constexpr' specifier [-Wstatic-float-init]
  const static float const_b = 3.14;
                     ^         ~~~~
  constexpr

llvm-svn: 173418

11 years agoSwitch this code away from Value::isUsedInBasicBlock. That code either
Chandler Carruth [Fri, 25 Jan 2013 05:40:09 +0000 (05:40 +0000)]
Switch this code away from Value::isUsedInBasicBlock. That code either
loops over instructions in the basic block or the use-def list of the
value, neither of which are really efficient when repeatedly querying
about values in the same basic block.

What's more, we already know that the CondBB is small, and so we can do
a much more efficient test by counting the uses in CondBB, and seeing if
those account for all of the uses.

Finally, we shouldn't blanket fail on any such instruction, instead we
should conservatively assume that those instructions are part of the
cost.

Note that this actually fixes a bug in the pass because
isUsedInBasicBlock has a really terrible bug in it. I'll fix that in my
next commit, but the fix for it would make this code suddenly take the
compile time hit I thought it already was taking, so I wanted to go
ahead and migrate this code to a faster & better pattern.

The bug in isUsedInBasicBlock was also causing other tests to test the
wrong thing entirely: for example we weren't actually disabling
speculation for floating point operations as intended (and tested), but
the test passed because we failed to speculate them due to the
isUsedInBasicBlock failure.

llvm-svn: 173417

11 years agoCreate clang/test/Driver/lit.local.cfg.
NAKAMURA Takumi [Fri, 25 Jan 2013 05:09:37 +0000 (05:09 +0000)]
Create clang/test/Driver/lit.local.cfg.

These files had been ignored.

  - clang_f_opts.h
  - debug-comp-dir.S
  - debug-main-file.S

llvm-svn: 173416

11 years agoDrop "REQUIRES:shell" in tests. They can run on win32.
NAKAMURA Takumi [Fri, 25 Jan 2013 04:33:40 +0000 (04:33 +0000)]
Drop "REQUIRES:shell" in tests. They can run on win32.

llvm-svn: 173415

11 years agoSync 'in class initialization of static const double' extension up with GCC,
Richard Smith [Fri, 25 Jan 2013 04:22:16 +0000 (04:22 +0000)]
Sync 'in class initialization of static const double' extension up with GCC,
and split it out of -Wgnu into its own warning flag.

 * In C++11, this is now a hard error (GCC has no extension here in C++11 mode).
   The error can be disabled with -Wno-static-float-init, and has a fixit to
   add 'constexpr'.

 * In C++98, this is still an ExtWarn, but is now controlled by
   -Wstatic-float-init as well as -Wgnu.

llvm-svn: 173414

11 years agoMISched: Add SchedDFSResult to ScheduleDAGMI to formalize the
Andrew Trick [Fri, 25 Jan 2013 04:01:04 +0000 (04:01 +0000)]
MISched: Add SchedDFSResult to ScheduleDAGMI to formalize the
interface and allow other strategies to select it.

llvm-svn: 173413

11 years ago[Frontend] Remove another IsUserSpecified member variable that is now unused.
Daniel Dunbar [Fri, 25 Jan 2013 01:50:47 +0000 (01:50 +0000)]
[Frontend] Remove another IsUserSpecified member variable that is now unused.

llvm-svn: 173412

11 years ago[Frontend] Drop the isUserSupplied argument to InitHeaderSearch, it is unused.
Daniel Dunbar [Fri, 25 Jan 2013 01:50:39 +0000 (01:50 +0000)]
[Frontend] Drop the isUserSupplied argument to InitHeaderSearch, it is unused.

llvm-svn: 173411

11 years ago[Frontend] The -iwithprefix option belongs in the After category, according to
Daniel Dunbar [Fri, 25 Jan 2013 01:50:34 +0000 (01:50 +0000)]
[Frontend] The -iwithprefix option belongs in the After category, according to
GCC docs.
 - Found by inspection.

llvm-svn: 173410

11 years ago[Lex] Remove DirectoryLookup.UserSpecified, which is unused.
Daniel Dunbar [Fri, 25 Jan 2013 01:50:28 +0000 (01:50 +0000)]
[Lex] Remove DirectoryLookup.UserSpecified, which is unused.

llvm-svn: 173409

11 years agoSerialization/GlobalModuleIndex.cpp: Fixup r173405, <cstdio>
NAKAMURA Takumi [Fri, 25 Jan 2013 01:47:07 +0000 (01:47 +0000)]
Serialization/GlobalModuleIndex.cpp: Fixup r173405, <cstdio>

llvm-svn: 173408

11 years agoThis patch implements parsing the .word
Jack Carter [Fri, 25 Jan 2013 01:31:34 +0000 (01:31 +0000)]
This patch implements parsing the .word
directive for the Mips assembler.

Contributer: Vladimir Medic

llvm-svn: 173407

11 years ago<rdar://problem/13072285>
Jason Molenda [Fri, 25 Jan 2013 01:05:30 +0000 (01:05 +0000)]
<rdar://problem/13072285>

Change the GDBRemoteRegisterContext::AddRegister function to take
its RegisterInfo argument by value instead of using a reference -
it will modify the object and modifying the contents of the
g_register_infos table in GDBRemoteRegisterContext.cpp can cause a
crash the next time we step through it.

llvm-svn: 173406

11 years agoImplement the reader of the global module index and wire it into the
Douglas Gregor [Fri, 25 Jan 2013 01:03:03 +0000 (01:03 +0000)]
Implement the reader of the global module index and wire it into the
AST reader.

The global module index tracks all of the identifiers known to a set
of module files. Lookup of those identifiers looks first in the global
module index, which returns the set of module files in which that
identifier can be found. The AST reader only needs to look into those
module files and any module files not known to the global index (e.g.,
because they were (re)built after the global index), reducing the
number of on-disk hash tables to visit. For an example source I'm
looking at, we go from 237844 total identifier lookups into on-disk
hash tables down to 126817.

Unfortunately, this does not translate into a performance advantage.
At best, it's a wash once the global module index has been built, but
that's ignore the cost of building the global module index (which
is itself fairly large). Profiles show that the global module index
code is far less efficient than it should be; optimizing it might give
enough of an advantage to justify its continued inclusion.

llvm-svn: 173405

11 years agoRename the -cc1 option "-generate-module-index" to
Douglas Gregor [Fri, 25 Jan 2013 00:45:27 +0000 (00:45 +0000)]
Rename the -cc1 option "-generate-module-index" to
"-fmodules-global-index" and expand its behavior to include both the
use and generation of the global module index.

llvm-svn: 173404

11 years agoTrack the number of lookups and hits into the on-disk hash tables for
Douglas Gregor [Fri, 25 Jan 2013 00:38:33 +0000 (00:38 +0000)]
Track the number of lookups and hits into the on-disk hash tables for
identifiers within the AST file reader.

llvm-svn: 173403

11 years agoUpdate test scripts and Makefiles to allow testing with GCC:
Daniel Malea [Fri, 25 Jan 2013 00:31:48 +0000 (00:31 +0000)]
Update test scripts and Makefiles to allow testing with GCC:
- introduce new variable ARCHFLAG in make/Makefile.rules to switch between "-arch" on Mac and "-m" everywhere else
- update testcase makefiles to use LD_EXTRAS instead of LDFLAGS (the former interacts with Makefile.rules badly)
- special treatment for gcc 4.6: replace "-std=c++11" with "-std=c++0x" as the former is not handled correctly
- remove hardcoded "-arch" from test Makefile

This patch should not have any effect on lldb on Mac OS X.

llvm-svn: 173402

11 years ago[mips] Set flag neverHasSideEffects flag on some of the floating point instructions.
Akira Hatanaka [Fri, 25 Jan 2013 00:20:39 +0000 (00:20 +0000)]
[mips] Set flag neverHasSideEffects flag on some of the floating point instructions.

llvm-svn: 173401

11 years agoClarify comment: "diagnose" is better than "warn" when emitting an error.
Jordan Rose [Fri, 25 Jan 2013 00:20:28 +0000 (00:20 +0000)]
Clarify comment: "diagnose" is better than "warn" when emitting an error.

Thanks, Dmitri.

llvm-svn: 173400

11 years agoSchedDFS: Refactor and tweak the subtree selection criteria.
Andrew Trick [Fri, 25 Jan 2013 00:12:57 +0000 (00:12 +0000)]
SchedDFS: Refactor and tweak the subtree selection criteria.

For sanity, create a root when NumDataSuccs >= 4. Splitting large
subtrees will no longer be detrimental after my next checkin to handle
nested tree. A magic number of 4 is fine because single subtrees
seldom rejoin more than this. It makes subtrees easier to visualize
and heuristics more sane.

llvm-svn: 173399

11 years agoSchedDFS: Constify interface.
Andrew Trick [Fri, 25 Jan 2013 00:12:55 +0000 (00:12 +0000)]
SchedDFS: Constify interface.

llvm-svn: 173398

11 years agoClean up: since we have FunctionDecl::IsInline, make it store the right value
Richard Smith [Fri, 25 Jan 2013 00:08:28 +0000 (00:08 +0000)]
Clean up: since we have FunctionDecl::IsInline, make it store the right value
for template instantiations, and use it to simplify the implementation of
FunctionDecl::isInlined().

This incidentally changes the result of isInlined on a declared-but-not-defined
non-inline member function from true to false. This is sort of a bug fix, but
currently isInlined is only called on function definitions, so it has no visible
effects.

llvm-svn: 173397

11 years agoFileCheck'ize test
Dmitri Gribenko [Fri, 25 Jan 2013 00:06:54 +0000 (00:06 +0000)]
FileCheck'ize test

llvm-svn: 173396

11 years agoAvoid creating duplicate CFG edges in the IfConversion pass.
Jakob Stoklund Olesen [Thu, 24 Jan 2013 23:59:08 +0000 (23:59 +0000)]
Avoid creating duplicate CFG edges in the IfConversion pass.

Patch by Stefan Hepp.

llvm-svn: 173395

11 years agoMark test cases affected by PR 15036 (GCC-generated DWARF causes parser crash)
Daniel Malea [Thu, 24 Jan 2013 23:52:09 +0000 (23:52 +0000)]
Mark test cases affected by PR 15036 (GCC-generated DWARF causes parser crash)
- Add new decorator "@skipIfGcc" to lldbtest.py

llvm-svn: 173394

11 years agoFileCheck'ize test
Dmitri Gribenko [Thu, 24 Jan 2013 23:44:04 +0000 (23:44 +0000)]
FileCheck'ize test

llvm-svn: 173393

11 years ago[analyzer] Fixup for r173385 and r173386 - initialize the members.
Anna Zaks [Thu, 24 Jan 2013 23:40:17 +0000 (23:40 +0000)]
[analyzer] Fixup for r173385 and r173386 - initialize the members.

llvm-svn: 173392

11 years agoFileCheck'ize test
Dmitri Gribenko [Thu, 24 Jan 2013 23:34:51 +0000 (23:34 +0000)]
FileCheck'ize test

llvm-svn: 173391

11 years agoDon't listen for EXC_RESOURCE exceptions, those should really be handled by the system
Jim Ingham [Thu, 24 Jan 2013 23:33:19 +0000 (23:33 +0000)]
Don't listen for EXC_RESOURCE exceptions, those should really be handled by the system
handler.  Also put in string translations for a couple of exceptions we were missing.

llvm-svn: 173390

11 years agoFileCheck'ize test
Dmitri Gribenko [Thu, 24 Jan 2013 23:29:37 +0000 (23:29 +0000)]
FileCheck'ize test

llvm-svn: 173389

11 years agoFixes text of diagnostics in integer overflow patch.
Fariborz Jahanian [Thu, 24 Jan 2013 23:24:32 +0000 (23:24 +0000)]
Fixes text of diagnostics in integer overflow patch.

llvm-svn: 173388

11 years agoFileCheck'ize test/SemaCXX/qualified-names-print.cpp and merge it to other
Dmitri Gribenko [Thu, 24 Jan 2013 23:21:11 +0000 (23:21 +0000)]
FileCheck'ize test/SemaCXX/qualified-names-print.cpp and merge it to other
-ast-print tests

llvm-svn: 173387

11 years ago[analyzer] Add "-analyzer-config mode=[deep|shallow] ".
Anna Zaks [Thu, 24 Jan 2013 23:15:34 +0000 (23:15 +0000)]
[analyzer] Add "-analyzer-config mode=[deep|shallow] ".

The idea is to introduce a higher level "user mode" option for
different use scenarios. For example, if one wants to run the analyzer
for a small project each time the code is built, they would use
the "shallow" mode.

The user mode option will influence the default settings for the
lower-level analyzer options. For now, this just influences the ipa
modes, but we plan to find more optimal settings for them.

llvm-svn: 173386

11 years ago[analyzer] Replace "-analyzer-ipa" with "-analyzer-config ipa".
Anna Zaks [Thu, 24 Jan 2013 23:15:30 +0000 (23:15 +0000)]
[analyzer] Replace "-analyzer-ipa" with "-analyzer-config ipa".

The idea is to eventually place all analyzer options under
"analyzer-config". In addition, this lays the ground for introduction of
a high-level analyzer mode option, which will influence the
default setting for IPAMode.

llvm-svn: 173385

11 years ago[analyzer] refactor: access IPAMode through the accessor.
Anna Zaks [Thu, 24 Jan 2013 23:15:25 +0000 (23:15 +0000)]
[analyzer] refactor: access IPAMode through the accessor.

llvm-svn: 173384

11 years agoscan-build: Add a --keep-empty option for better testing.
Jordan Rose [Thu, 24 Jan 2013 23:07:59 +0000 (23:07 +0000)]
scan-build: Add a --keep-empty option for better testing.

SATestBuild expects to compare output directories for each invocation of
scan-build that it runs, but scan-build clears out empty directories by
default. We were coincidentally not getting that behavior until r173294.

llvm-svn: 173383

11 years agoMoving Cost Tables up to share with other targets
Renato Golin [Thu, 24 Jan 2013 23:01:00 +0000 (23:01 +0000)]
Moving Cost Tables up to share with other targets

llvm-svn: 173382

11 years ago[Driver] Run the pass manager.
Michael J. Spencer [Thu, 24 Jan 2013 22:52:42 +0000 (22:52 +0000)]
[Driver] Run the pass manager.

llvm-svn: 173381

11 years agoMove SimpleAtoms.h to ReaderWriter.
Michael J. Spencer [Thu, 24 Jan 2013 22:52:25 +0000 (22:52 +0000)]
Move SimpleAtoms.h to ReaderWriter.

llvm-svn: 173380

11 years agoFileCheck-ify some debug info scope related tests.
David Blaikie [Thu, 24 Jan 2013 22:47:48 +0000 (22:47 +0000)]
FileCheck-ify some debug info scope related tests.

llvm-svn: 173379

11 years agoremoved duplicated comment.
Fariborz Jahanian [Thu, 24 Jan 2013 22:26:55 +0000 (22:26 +0000)]
removed duplicated comment.

llvm-svn: 173378

11 years agoPatch to check for integer overflow. It has been
Fariborz Jahanian [Thu, 24 Jan 2013 22:11:45 +0000 (22:11 +0000)]
Patch to check for integer overflow. It has been
commented on and approved by Richard Smith.

llvm-svn: 173377

11 years agoMove 'convertUTF8Sequence' helper into the C++ section of the header file.
Jordan Rose [Thu, 24 Jan 2013 21:48:50 +0000 (21:48 +0000)]
Move 'convertUTF8Sequence' helper into the C++ section of the header file.

It's annotated as "inline", but ConvertUTF.c should still be able to compile
as C89.

llvm-svn: 173376

11 years ago[mips] Do not emit i32 padding if target ABI is O32. This was causing backend
Akira Hatanaka [Thu, 24 Jan 2013 21:47:33 +0000 (21:47 +0000)]
[mips] Do not emit i32 padding if target ABI is O32. This was causing backend
to pass floating point arguments to be passed in integer registers.

llvm-svn: 173375

11 years agoAdded comment to ObjCARC elaborating what is meant by the term 'Provenance' in 'Prove...
Michael Gottesman [Thu, 24 Jan 2013 21:35:00 +0000 (21:35 +0000)]
Added comment to ObjCARC elaborating what is meant by the term 'Provenance' in 'Provenance Analysis'.

llvm-svn: 173374

11 years agoTest fix-it ranges for Unicode characters.
Jordan Rose [Thu, 24 Jan 2013 21:19:51 +0000 (21:19 +0000)]
Test fix-it ranges for Unicode characters.

Also, remove stray -fdiagnostics-parseable-fixits from ucn-pp-identifier.

llvm-svn: 173373

11 years agoSkip 32-bit testing of check_public_api_headers (on all platforms, not just Mac OS X)
Daniel Malea [Thu, 24 Jan 2013 21:01:12 +0000 (21:01 +0000)]
Skip 32-bit testing of check_public_api_headers (on all platforms, not just Mac OS X)
- since the test program needs to link with LLDB, the test is invalid in 32-bit mode.

llvm-svn: 173372

11 years agoAdd a fixit for \U1234 -> \u1234.
Jordan Rose [Thu, 24 Jan 2013 20:50:52 +0000 (20:50 +0000)]
Add a fixit for \U1234 -> \u1234.

llvm-svn: 173371

11 years agoAs an extension, treat Unicode whitespace characters as whitespace.
Jordan Rose [Thu, 24 Jan 2013 20:50:50 +0000 (20:50 +0000)]
As an extension, treat Unicode whitespace characters as whitespace.

llvm-svn: 173370

11 years agoHandle universal character names and Unicode characters outside of literals.
Jordan Rose [Thu, 24 Jan 2013 20:50:46 +0000 (20:50 +0000)]
Handle universal character names and Unicode characters outside of literals.

This is a missing piece for C99 conformance.

This patch handles UCNs by adding a '\\' case to LexTokenInternal and
LexIdentifier -- if we see a backslash, we tentatively try to read in a UCN.
If the UCN is not syntactically well-formed, we fall back to the old
treatment: a backslash followed by an identifier beginning with 'u' (or 'U').

Because the spelling of an identifier with UCNs still has the UCN in it, we
need to convert that to UTF-8 in Preprocessor::LookUpIdentifierInfo.

Of course, valid code that does *not* use UCNs will see only a very minimal
performance hit (checks after each identifier for non-ASCII characters,
checks when converting raw_identifiers to identifiers that they do not
contain UCNs, and checks when getting the spelling of an identifier that it
does not contain a UCN).

This patch also adds basic support for actual UTF-8 in the source. This is
treated almost exactly the same as UCNs except that we consider stray
Unicode characters to be mistakes and offer a fixit to remove them.

llvm-svn: 173369

11 years agoUnify diagnostics for \x, \u, and \U without any following hex digits.
Jordan Rose [Thu, 24 Jan 2013 20:50:13 +0000 (20:50 +0000)]
Unify diagnostics for \x, \u, and \U without any following hex digits.

llvm-svn: 173368

11 years agoFail these tests in a way that doesn't cause unexpected successes, per Daniel's
Chad Rosier [Thu, 24 Jan 2013 20:46:39 +0000 (20:46 +0000)]
Fail these tests in a way that doesn't cause unexpected successes, per Daniel's
suggestion.

llvm-svn: 173367

11 years agoStart cleanup of PPC register definitions using foreach loops.
Hal Finkel [Thu, 24 Jan 2013 20:43:18 +0000 (20:43 +0000)]
Start cleanup of PPC register definitions using foreach loops.

No functionality change intended.

This captures the first two cases GPR32/64. For the others, we need
an addition operator (if we have one, I've not yet found it).

Based on a suggestion made by Tom Stellard in the AArch64 review!

llvm-svn: 173366

11 years agoTemporarily XFAIL this test; the compiler will segfault if the target-specific
Chad Rosier [Thu, 24 Jan 2013 20:33:35 +0000 (20:33 +0000)]
Temporarily XFAIL this test; the compiler will segfault if the target-specific
parser is not included in the compiler. Thanks to Renato for discovering the
underlying issue.

llvm-svn: 173365

11 years ago[ms-inline asm] Add an error when trying to compile MS-style inline assembly
Chad Rosier [Thu, 24 Jan 2013 20:24:34 +0000 (20:24 +0000)]
[ms-inline asm] Add an error when trying to compile MS-style inline assembly
for an unsupported architecture.
rdar://13063988

llvm-svn: 173364

11 years agoMarking test cases with @expectedFailureLinux as per recently opened bugs
Daniel Malea [Thu, 24 Jan 2013 19:47:06 +0000 (19:47 +0000)]
Marking test cases with @expectedFailureLinux as per recently opened bugs
- PR 15038: missing wide char support on Linux
- PR 14600 - Exception state registers not supported on Linux
- PR 15039: SBProcess.GetSTDOUT() returns an empty buffer
- PR 15037: stop-hooks sometimes fail to fire on Linux

llvm-svn: 173363

11 years agoPR14426 (breakpoint hit count incorrect) is resolved.
Daniel Malea [Thu, 24 Jan 2013 19:35:57 +0000 (19:35 +0000)]
PR14426 (breakpoint hit count incorrect) is resolved.

llvm-svn: 173362

11 years ago[driver] Associate a JobAction with each result file. This enables the driver
Chad Rosier [Thu, 24 Jan 2013 19:14:47 +0000 (19:14 +0000)]
[driver] Associate a JobAction with each result file.  This enables the driver
to delete result files for only those commands that fail.
Part of rdar://12984531

llvm-svn: 173361

11 years ago[bugpoint] make tool selection messages unique
Saleem Abdulrasool [Thu, 24 Jan 2013 16:49:14 +0000 (16:49 +0000)]
[bugpoint] make tool selection messages unique

Change messages to help identify which interpreter was actually selected (safe
vs testing).

Signed-off-by: Saleem Abdulrasool <compnerd@compnerd.org>
Reviewed-by: Chandler Carruth <chandlerc@gmail.com>
llvm-svn: 173360

11 years ago[bugpoint] set Message after tool configuration
Saleem Abdulrasool [Thu, 24 Jan 2013 16:49:12 +0000 (16:49 +0000)]
[bugpoint] set Message after tool configuration

Set the message returned after the GCC runner has been constructed as otherwise
the message will be overwritten by the construction of the runner, resulting in
misleading messages.

Signed-off-by: Saleem Abdulrasool <compnerd@compnerd.org>
Reviewed-by: Chandler Carruth <chandlerc@gmail.com>
llvm-svn: 173359

11 years agoPR14922: when printing an attribute, use the real syntax of the attribute (GNU, C...
Michael Han [Thu, 24 Jan 2013 16:46:58 +0000 (16:46 +0000)]
PR14922: when printing an attribute, use the real syntax of the attribute (GNU, C++11, MS Declspec) instead of hardcoded GNU syntax.

Introduce a spelling index to Attr class, which is an index into the attribute spelling list of an attribute defined in Attr.td.
This index will determine the actual spelling used by an attribute, as it incorporates both the syntax and naming of the attribute.
When constructing an attribute AST node, the spelling index is computed based on attribute kind, scope (if it's a C++11 attribute), and
name, then passed to Attr that will use the index to print itself.

Thanks to Richard Smith for the idea and review.

llvm-svn: 173358

11 years agoReapply chandlerc's r173342 now that the miscompile it was triggering is fixed.
Benjamin Kramer [Thu, 24 Jan 2013 16:44:25 +0000 (16:44 +0000)]
Reapply chandlerc's r173342 now that the miscompile it was triggering is fixed.

Original commit message:
Plug TTI into the speculation logic, giving it a real cost interface
that can be specialized by targets.

The goal here is not to be more aggressive, but to just be more accurate
with very obvious cases. There are instructions which are known to be
truly free and which were not being modeled as such in this code -- see
the regression test which is distilled from an inner loop of zlib.

Everywhere the TTI cost model is insufficiently conservative I've added
explicit checks with FIXME comments to go add proper modelling of these
cost factors.

If this causes regressions, the likely solution is to make TTI even more
conservative in its cost estimates, but test cases will help here.

llvm-svn: 173357

11 years agoConstantFolding: Add a missing folding that leads to a miscompile.
Benjamin Kramer [Thu, 24 Jan 2013 16:28:28 +0000 (16:28 +0000)]
ConstantFolding: Add a missing folding that leads to a miscompile.

We use constant folding to see if an intrinsic evaluates to the same value as a
constant that we know. If we don't take the undefinedness into account we get a
value that doesn't match the actual implementation, and miscompiled code.

This was uncovered by Chandler's simplifycfg changes.

llvm-svn: 173356

11 years agounittests/SupportTests/Initialize.MultipleThreads: Enable pthread_attr_setstack(3...
NAKAMURA Takumi [Thu, 24 Jan 2013 15:29:27 +0000 (15:29 +0000)]
unittests/SupportTests/Initialize.MultipleThreads: Enable pthread_attr_setstack(3) only on Linux.

I got blamed on darwin11;
unittests/Support/ManagedStatic.cpp:35: error: 'pthread_attr_setstack' was not declared in this scope

llvm-svn: 173355

11 years agoFix a non-conformant OpenCL test case.
Joey Gouly [Thu, 24 Jan 2013 15:24:54 +0000 (15:24 +0000)]
Fix a non-conformant OpenCL test case.
Program scope variables must be declared in the constant address space
and are required to be initialized.

llvm-svn: 173354

11 years agoProperly remove this test file, that I copied over to test/SemaOpenCL in r173352.
Joey Gouly [Thu, 24 Jan 2013 15:19:51 +0000 (15:19 +0000)]
Properly remove this test file, that I copied over to test/SemaOpenCL in r173352.

llvm-svn: 173353

11 years agoFix an OpenCL test case that was OpenCL conformant.
Joey Gouly [Thu, 24 Jan 2013 15:14:22 +0000 (15:14 +0000)]
Fix an OpenCL test case that was OpenCL conformant.
It had program scope variables that were not in the constant address space,
make them to be function scope variables instead.
Also move the test to the SemaOpenCL directory.

llvm-svn: 173352

11 years agounittests/SupportTests/Initialize.MultipleThreads: Appease --vg-leak to allocate...
NAKAMURA Takumi [Thu, 24 Jan 2013 14:44:02 +0000 (14:44 +0000)]
unittests/SupportTests/Initialize.MultipleThreads: Appease --vg-leak to allocate stack explicitly for glibc.

llvm-svn: 173350

11 years agolli/RecordingMemoryManager: Free allocated sections in the destructor to satisfy...
NAKAMURA Takumi [Thu, 24 Jan 2013 14:12:12 +0000 (14:12 +0000)]
lli/RecordingMemoryManager: Free allocated sections in the destructor to satisfy --vg-leak!

FIXME: It could be generalized in MemoryManager.
llvm-svn: 173349

11 years agotsan: return the old fake numbers from malloc stats (some code already depends on...
Dmitry Vyukov [Thu, 24 Jan 2013 14:07:19 +0000 (14:07 +0000)]
tsan: return the old fake numbers from malloc stats (some code already depends on them)

llvm-svn: 173348

11 years ago[Sanitizer] use stub InternalSymbolizer on platforms where we don't have weak hooks
Alexey Samsonov [Thu, 24 Jan 2013 14:01:59 +0000 (14:01 +0000)]
[Sanitizer] use stub InternalSymbolizer on platforms where we don't have weak hooks

llvm-svn: 173347

11 years agotsan: suppress reports using both stacks
Dmitry Vyukov [Thu, 24 Jan 2013 13:50:32 +0000 (13:50 +0000)]
tsan: suppress reports using both stacks

llvm-svn: 173346

11 years agotsan: allow a front-end to provide default suppressions
Dmitry Vyukov [Thu, 24 Jan 2013 13:50:10 +0000 (13:50 +0000)]
tsan: allow a front-end to provide default suppressions

llvm-svn: 173345

11 years ago[Sanitizer] Add skeleton for InternalSymbolizer that can be used by providing callbac...
Alexey Samsonov [Thu, 24 Jan 2013 13:42:45 +0000 (13:42 +0000)]
[Sanitizer] Add skeleton for InternalSymbolizer that can be used by providing callbacks __sanitizer_symbolize_{code,data}

llvm-svn: 173344

11 years agoRevert r173342 temporarily. It appears to cause a very late miscompile
Chandler Carruth [Thu, 24 Jan 2013 13:24:24 +0000 (13:24 +0000)]
Revert r173342 temporarily. It appears to cause a very late miscompile
of stage2 in a bootstrap. Still investigating....

llvm-svn: 173343

11 years agoPlug TTI into the speculation logic, giving it a real cost interface
Chandler Carruth [Thu, 24 Jan 2013 12:39:29 +0000 (12:39 +0000)]
Plug TTI into the speculation logic, giving it a real cost interface
that can be specialized by targets.

The goal here is not to be more aggressive, but to just be more accurate
with very obvious cases. There are instructions which are known to be
truly free and which were not being modeled as such in this code -- see
the regression test which is distilled from an inner loop of zlib.

Everywhere the TTI cost model is insufficiently conservative I've added
explicit checks with FIXME comments to go add proper modelling of these
cost factors.

If this causes regressions, the likely solution is to make TTI even more
conservative in its cost estimates, but test cases will help here.

llvm-svn: 173342

11 years agoAddress a large chunk of this FIXME by accumulating the cost for
Chandler Carruth [Thu, 24 Jan 2013 12:05:17 +0000 (12:05 +0000)]
Address a large chunk of this FIXME by accumulating the cost for
unfolded constant expressions rather than checking each one
independently.

llvm-svn: 173341

11 years agoSwitch the constant expression speculation cost evaluation away from
Chandler Carruth [Thu, 24 Jan 2013 11:53:01 +0000 (11:53 +0000)]
Switch the constant expression speculation cost evaluation away from
a cost fuction that seems both a bit ad-hoc and also poorly suited to
evaluating constant expressions.

Notably, it is missing any support for trivial expressions such as
'inttoptr'. I could fix this routine, but it isn't clear to me all of
the constraints its other users are operating under.

The core protection that seems relevant here is avoiding the formation
of a select instruction wich a further chain of select operations in
a constant expression operand. Just explicitly encode that constraint.

Also, update the comments and organization here to make it clear where
this needs to go -- this should be driven off of real cost measurements
which take into account the number of constants expressions and the
depth of the constant expression tree.

llvm-svn: 173340

11 years agoRephrase the speculating scan of the conditional BB to be phrased in
Chandler Carruth [Thu, 24 Jan 2013 11:52:58 +0000 (11:52 +0000)]
Rephrase the speculating scan of the conditional BB to be phrased in
terms of cost rather than hoisting a single instruction.

This does *not* change the cost model! We still set the cost threshold
at 1 here, it's just that we track it by accumulating cost rather than
by storing an instruction.

The primary advantage is that we no longer leave no-op intrinsics in the
basic block. For example, this will now move both debug info intrinsics
and a single instruction, instead of only moving the instruction and
leaving a basic block with nothing bug debug info intrinsics in it, and
those intrinsics now no longer ordered correctly with the hoisted value.

Instead, we now splice the entire conditional basic block's instruction
sequence.

This also places the code for checking the safety of hoisting next to
the code computing the cost.

Currently, the only observable side-effect of this change is that debug
info intrinsics are no longer abandoned. I'm not sure how to craft
a test case for this, and my real goal was the refactoring, but I'll
talk to Dave or Eric about how to add a test case for this.

llvm-svn: 173339

11 years ago[asan] fix 32-bit builds
Kostya Serebryany [Thu, 24 Jan 2013 10:43:50 +0000 (10:43 +0000)]
[asan] fix 32-bit builds

llvm-svn: 173338

11 years agoSimplify the PHI node operand rewriting.
Chandler Carruth [Thu, 24 Jan 2013 10:40:51 +0000 (10:40 +0000)]
Simplify the PHI node operand rewriting.

Previously, the code would scan the PHI nodes and build up a small
setvector of candidate value pairs in phi nodes to go and rewrite. Once
certain the rewrite could be performed, the code walks the set, and for
each one re-scans the entire PHI node list looking for nodes to rewrite
operands.

Instead, scan the PHI nodes once to check for hazards, and then scan it
a second time to rewrite the operands to selects. No set vector, and
a max of two scans.

The only downside is that we might form identical selects, but
instcombine or anything else should fold those easily, and it seems
unlikely to happen often.

llvm-svn: 173337

11 years ago[asan] run-time tests for adaptive redzones
Kostya Serebryany [Thu, 24 Jan 2013 10:36:11 +0000 (10:36 +0000)]
[asan] run-time tests for adaptive redzones

llvm-svn: 173336

11 years ago[asan] adaptive redzones for globals (the larger the global the larger is the redzone)
Kostya Serebryany [Thu, 24 Jan 2013 10:35:40 +0000 (10:35 +0000)]
[asan] adaptive redzones for globals (the larger the global the larger is the redzone)

llvm-svn: 173335

11 years agoGive the basic block variables here names based on the if-then-end
Chandler Carruth [Thu, 24 Jan 2013 09:59:39 +0000 (09:59 +0000)]
Give the basic block variables here names based on the if-then-end
structure being analyzed. No functionality changed.

llvm-svn: 173334

11 years ago[ASan] fix compilation on Mac by adding a missing pwrite parameter.
Alexander Potapenko [Thu, 24 Jan 2013 09:15:08 +0000 (09:15 +0000)]
[ASan] fix compilation on Mac by adding a missing pwrite parameter.

llvm-svn: 173333

11 years agotsan: implement malloc stats querying
Dmitry Vyukov [Thu, 24 Jan 2013 09:08:03 +0000 (09:08 +0000)]
tsan: implement malloc stats querying

llvm-svn: 173332

11 years agoLift a cheap early exit test above loops and other complex early exit
Chandler Carruth [Thu, 24 Jan 2013 08:22:40 +0000 (08:22 +0000)]
Lift a cheap early exit test above loops and other complex early exit
tests. No need to pay the high cost when we're never going to do
anything.

No functionality changed.

llvm-svn: 173331

11 years agoclang/GlobalModuleIndex: Don't open the same file twice. Use raw_fd_ostream(fd, ...
NAKAMURA Takumi [Thu, 24 Jan 2013 08:20:11 +0000 (08:20 +0000)]
clang/GlobalModuleIndex: Don't open the same file twice. Use raw_fd_ostream(fd, ...) instead.

FIXME: PathV2::unique_file() is assumed to open the file with binary mode on win32.
llvm-svn: 173330

11 years agoSpiff up the comment on this method, making the example a bit more
Chandler Carruth [Thu, 24 Jan 2013 08:05:06 +0000 (08:05 +0000)]
Spiff up the comment on this method, making the example a bit more
pretty in doxygen, adding some of the details actually present in
a classic example where this matters (a loop from gzip and many other
compression algorithms), and a cautionary note about the risks inherent
in the transform. This has come up on the mailing lists recently, and
I suspect folks reading this code could benefit from going and looking
at the MI pass that can really deal with these issues.

llvm-svn: 173329

11 years agoasan/tsan: fix pwrite interceptors
Dmitry Vyukov [Thu, 24 Jan 2013 07:44:21 +0000 (07:44 +0000)]
asan/tsan: fix pwrite interceptors

llvm-svn: 173328

11 years agotsan: also test asan during presubmit checks, because sanitizer_common changes can...
Dmitry Vyukov [Thu, 24 Jan 2013 07:43:55 +0000 (07:43 +0000)]
tsan: also test asan during presubmit checks, because sanitizer_common changes can affect it

llvm-svn: 173327

11 years agoclang/test/Modules/global_index.m: XFAILing on win32 when investigating for now.
NAKAMURA Takumi [Thu, 24 Jan 2013 07:04:14 +0000 (07:04 +0000)]
clang/test/Modules/global_index.m: XFAILing on win32 when investigating for now.

llvm-svn: 173326

11 years agoMipsISelLowering.cpp: Fill unreachable paths to fix warnings. [-Wsometimes-uninitialized]
NAKAMURA Takumi [Thu, 24 Jan 2013 06:08:06 +0000 (06:08 +0000)]
MipsISelLowering.cpp: Fill unreachable paths to fix warnings. [-Wsometimes-uninitialized]

FIXME: Could they, unreachable(s), be removed?
FIXME: I could prefer the coding standards...
llvm-svn: 173325

11 years agoMipsISelLowering.cpp: Fix a warning, take two. [-Wunused-variable]
NAKAMURA Takumi [Thu, 24 Jan 2013 05:54:23 +0000 (05:54 +0000)]
MipsISelLowering.cpp: Fix a warning, take two. [-Wunused-variable]

...and fix a typo, s/#ifdef/#ifndef/

llvm-svn: 173324

11 years agoMipsISelLowering.cpp: Fix a warning. [-Wunused-variable]
NAKAMURA Takumi [Thu, 24 Jan 2013 05:47:29 +0000 (05:47 +0000)]
MipsISelLowering.cpp: Fix a warning. [-Wunused-variable]

llvm-svn: 173323

11 years agoRemove trailing whitespace.
Craig Topper [Thu, 24 Jan 2013 05:22:40 +0000 (05:22 +0000)]
Remove trailing whitespace.

llvm-svn: 173322

11 years agoAdd asserts to SmallVector so that calls to front() and back() only succeed
Richard Trieu [Thu, 24 Jan 2013 04:29:24 +0000 (04:29 +0000)]
Add asserts to SmallVector so that calls to front() and back() only succeed
if the vector is not empty.  This will ensure that calls to these functions
will reference elements in the vector.

llvm-svn: 173321