platform/upstream/llvm.git
11 years agoFix the bootstrap of CompilerRT with host compilers that don't support
Chandler Carruth [Sat, 13 Oct 2012 02:30:10 +0000 (02:30 +0000)]
Fix the bootstrap of CompilerRT with host compilers that don't support
emulating 128-bit arithmetic on 32-bit x86 targets. This should get the
bootstrap back for GCC 4.6 at least.

Suggestions on better ways to do the detection here are welcome...

llvm-svn: 165863

11 years agoMake sure we always use lldb::tid_t for thread IDs so we don't truncate a 64 bit...
Greg Clayton [Sat, 13 Oct 2012 02:11:55 +0000 (02:11 +0000)]
Make sure we always use lldb::tid_t for thread IDs so we don't truncate a 64 bit thread ID.

llvm-svn: 165862

11 years ago<rdar://problem/12491387>
Greg Clayton [Sat, 13 Oct 2012 02:07:45 +0000 (02:07 +0000)]
<rdar://problem/12491387>

I added the ability for a process plug-in to implement custom commands. All the lldb_private::Process plug-in has to do is override:

virtual CommandObject *
GetPluginCommandObject();

This object returned should be a multi-word command that vends LLDB commands. There is a sample implementation in ProcessGDBRemote that is hollowed out. It is intended to be used for sending a custom packet, though the body of the command execute function has yet to be implemented!

llvm-svn: 165861

11 years agoDon't neglect to "return *this".
Argyrios Kyrtzidis [Sat, 13 Oct 2012 02:03:45 +0000 (02:03 +0000)]
Don't neglect to "return *this".

llvm-svn: 165860

11 years agoUpdate for r165858.
Chad Rosier [Sat, 13 Oct 2012 00:26:22 +0000 (00:26 +0000)]
Update for r165858.

llvm-svn: 165859

11 years ago[ms-inline asm] Remove the MatchInstruction() function. Previously, this was
Chad Rosier [Sat, 13 Oct 2012 00:26:04 +0000 (00:26 +0000)]
[ms-inline asm]  Remove the MatchInstruction() function.  Previously, this was
the interface between the front-end and the MC layer when parsing inline
assembly.  Unfortunately, this is too deep into the parsing stack. Specifically,
we're unable to handle target-independent assembly (i.e., assembly directives,
labels, etc.).  Note the MatchAndEmitInstruction() isn't the correct
abstraction either.  I'll be exposing target-independent hooks shortly, so this
is really just a cleanup.

llvm-svn: 165858

11 years ago<rdar://problem/12490588>
Greg Clayton [Sat, 13 Oct 2012 00:20:27 +0000 (00:20 +0000)]
<rdar://problem/12490588>

From SBType, we can now get a lldb::BasicType enumeration out of an existing type.

llvm-svn: 165857

11 years agoProvide an SSL context ref in case SLL is needed for communication.
Greg Clayton [Sat, 13 Oct 2012 00:18:18 +0000 (00:18 +0000)]
Provide an SSL context ref in case SLL is needed for communication.

llvm-svn: 165856

11 years agoCheck section type rather than assuming it's code when emitting sections while proces...
Andrew Kaylor [Fri, 12 Oct 2012 23:53:16 +0000 (23:53 +0000)]
Check section type rather than assuming it's code when emitting sections while processing relocations.

llvm-svn: 165854

11 years agoARM: tail-call inside a function where part of a byval argument is on caller's
Manman Ren [Fri, 12 Oct 2012 23:39:43 +0000 (23:39 +0000)]
ARM: tail-call inside a function where part of a byval argument is on caller's
local frame causes problem.

For example:
void f(StructToPass s) {
  g(&s, sizeof(s));
}
will cause problem with tail-call since part of s is passed via registers and
saved in f's local frame. When g tries to access s, part of s may be corrupted
since f's local frame is popped out before the tail-call.

The current fix is to disable tail-call if getVarArgsRegSaveSize is not 0 for
the caller. This is a conservative approach, if we can prove the address of
s or part of s is not taken and passed to g, it should be okay to perform
tail-call.

rdar://12442472

llvm-svn: 165853

11 years ago<rdar://problem/12490558>
Greg Clayton [Fri, 12 Oct 2012 23:32:11 +0000 (23:32 +0000)]
<rdar://problem/12490558>

SBProcess::SetSelectedThreadByID() had a "uint32_t tid" parameter which would truncate 64 bit thread IDs (lldb::tid_t is 64 bit).

llvm-svn: 165852

11 years ago[ms-inline asm] Remove a bunch of parsing code from the front-end.
Chad Rosier [Fri, 12 Oct 2012 23:32:10 +0000 (23:32 +0000)]
[ms-inline asm] Remove a bunch of parsing code from the front-end.

llvm-svn: 165851

11 years agoAdd TargetInfo for r600.
Eli Friedman [Fri, 12 Oct 2012 23:32:00 +0000 (23:32 +0000)]
Add TargetInfo for r600.

Patch by Tom Stellard.

llvm-svn: 165850

11 years agoMake -mms-bitfields behave consistently.
Eli Friedman [Fri, 12 Oct 2012 23:29:20 +0000 (23:29 +0000)]
Make -mms-bitfields behave consistently.

Patch by Jeremiah Zanin.

llvm-svn: 165849

11 years ago<rdar://problem/12489931>
Greg Clayton [Fri, 12 Oct 2012 23:24:05 +0000 (23:24 +0000)]
<rdar://problem/12489931>

Memory write wasn't working (assert was firing) when writing memory.

llvm-svn: 165848

11 years ago[ms-inline asm] Capitalize per coding standard.
Chad Rosier [Fri, 12 Oct 2012 23:09:25 +0000 (23:09 +0000)]
[ms-inline asm] Capitalize per coding standard.

llvm-svn: 165847

11 years agoFix buildbots: -misched=shuffle is only available in +Asserts builds.
Jakob Stoklund Olesen [Fri, 12 Oct 2012 23:01:33 +0000 (23:01 +0000)]
Fix buildbots: -misched=shuffle is only available in +Asserts builds.

llvm-svn: 165846

11 years agoARM: Mark VSELECT as 'expand'.
Jim Grosbach [Fri, 12 Oct 2012 22:59:21 +0000 (22:59 +0000)]
ARM: Mark VSELECT as 'expand'.

The backend already pattern matches to form VBSL when it can. We may want to
teach it to use the vbsl intrinsics at some point to prevent machine licm from
mucking with this, but using the Expand is completely correct.

http://llvm.org/bugs/show_bug.cgi?id=13831
http://llvm.org/bugs/show_bug.cgi?id=13961

Patch by Peter Couperus <peter.couperus@st.com>.

llvm-svn: 165845

11 years ago-fcatch-undefined-behavior: Runtime library support for trapping conversions to or
Richard Smith [Fri, 12 Oct 2012 22:57:15 +0000 (22:57 +0000)]
-fcatch-undefined-behavior: Runtime library support for trapping conversions to or
from a floating-point type where the source value is not in the range of
representable values of the destination type.

llvm-svn: 165844

11 years ago-fcatch-undefined-behavior: Trap undefined behavior due to conversions to or
Richard Smith [Fri, 12 Oct 2012 22:57:06 +0000 (22:57 +0000)]
-fcatch-undefined-behavior: Trap undefined behavior due to conversions to or
from a floating-point type where the source value is not in the range of
representable values of the destination type.

llvm-svn: 165843

11 years agoMove assertion to not crash tests.
Ted Kremenek [Fri, 12 Oct 2012 22:56:45 +0000 (22:56 +0000)]
Move assertion to not crash tests.

llvm-svn: 165842

11 years agoSilence static analyzer issue by documenting that in this context
Ted Kremenek [Fri, 12 Oct 2012 22:56:42 +0000 (22:56 +0000)]
Silence static analyzer issue by documenting that in this context
that a DeclRefExpr can never return a null decl.  We possibly should
hoist this into getDecl() itself.

llvm-svn: 165841

11 years agoSilence null dereference warnings by documenting context-specific
Ted Kremenek [Fri, 12 Oct 2012 22:56:40 +0000 (22:56 +0000)]
Silence null dereference warnings by documenting context-specific
invariants using assertions.

llvm-svn: 165840

11 years agoFurther harden checking that scan-view isn't serving up pages outside
Ted Kremenek [Fri, 12 Oct 2012 22:56:38 +0000 (22:56 +0000)]
Further harden checking that scan-view isn't serving up pages outside
the server root.

llvm-svn: 165839

11 years agoFix potential crash in ObjCContainersChecker by properly validating
Ted Kremenek [Fri, 12 Oct 2012 22:56:36 +0000 (22:56 +0000)]
Fix potential crash in ObjCContainersChecker by properly validating
the number of arguments.

llvm-svn: 165838

11 years agoSilence dead store warning. It is conceptually possible we will
Ted Kremenek [Fri, 12 Oct 2012 22:56:33 +0000 (22:56 +0000)]
Silence dead store warning.  It is conceptually possible we will
add more code that references SourceFile, so removing the dead store
doesn't seem appropriate for the long term.

llvm-svn: 165837

11 years agoFix potential null deference in CFG printer.
Ted Kremenek [Fri, 12 Oct 2012 22:56:31 +0000 (22:56 +0000)]
Fix potential null deference in CFG printer.

llvm-svn: 165836

11 years agoRemove dead store.
Ted Kremenek [Fri, 12 Oct 2012 22:56:26 +0000 (22:56 +0000)]
Remove dead store.

llvm-svn: 165835

11 years agoUpdate for r165833.
Chad Rosier [Fri, 12 Oct 2012 22:53:52 +0000 (22:53 +0000)]
Update for r165833.

llvm-svn: 165834

11 years ago[ms-inline asm] Use the new API introduced in r165830 in lieu of the
Chad Rosier [Fri, 12 Oct 2012 22:53:36 +0000 (22:53 +0000)]
[ms-inline asm] Use the new API introduced in r165830 in lieu of the
MapAndConstraints vector.  Also remove the unused Kind argument.

llvm-svn: 165833

11 years agoFix -ast-print for uses of operator->.
Eli Friedman [Fri, 12 Oct 2012 22:45:14 +0000 (22:45 +0000)]
Fix -ast-print for uses of operator->.

Patch by Grzegorz Jablonski.

llvm-svn: 165832

11 years ago[ms-inline asm] Add a few data members and member functions to the
Chad Rosier [Fri, 12 Oct 2012 22:15:11 +0000 (22:15 +0000)]
[ms-inline asm] Add a few data members and member functions to the
MCParsedAsmOperand class in support of ms-style inline assembly.

llvm-svn: 165830

11 years agoFix warnings introduced by r165826.
DeLesley Hutchins [Fri, 12 Oct 2012 21:49:04 +0000 (21:49 +0000)]
Fix warnings introduced by r165826.

llvm-svn: 165829

11 years agoUse MACOSX_DEPLOYMENT_TARGET when it is set. <rdar://problem/12433905>
Bob Wilson [Fri, 12 Oct 2012 21:48:14 +0000 (21:48 +0000)]
Use MACOSX_DEPLOYMENT_TARGET when it is set. <rdar://problem/12433905>

llvm-svn: 165828

11 years agoCorrecting enum values mentioned in comments.
Andrew Kaylor [Fri, 12 Oct 2012 21:47:49 +0000 (21:47 +0000)]
Correcting enum values mentioned in comments.
Patch by Ashok Thirumurthi.

llvm-svn: 165827

11 years agoThread-safety analysis: support multiple thread-safety attributes on
DeLesley Hutchins [Fri, 12 Oct 2012 21:38:12 +0000 (21:38 +0000)]
Thread-safety analysis: support multiple thread-safety attributes on
declarations.

llvm-svn: 165826

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

llvm-svn: 165825

11 years agoUse a transposed algorithm for handleMove().
Jakob Stoklund Olesen [Fri, 12 Oct 2012 21:31:57 +0000 (21:31 +0000)]
Use a transposed algorithm for handleMove().

Completely update one interval at a time instead of collecting live
range fragments to be updated. This avoids building data structures,
except for a single SmallPtrSet of updated intervals.

Also share code between handleMove() and handleMoveIntoBundle().

Add support for moving dead defs across other live values in the
interval. The MI scheduler can do that.

llvm-svn: 165824

11 years agoFixed build problems with LLDB on Mac OS X,
Sean Callanan [Fri, 12 Oct 2012 21:31:06 +0000 (21:31 +0000)]
Fixed build problems with LLDB on Mac OS X,
specifically related to the deployment settings.
Also some minor alphabetization.

<rdar://problem/12433905>

llvm-svn: 165823

11 years agoAdd missing header from 165821
Douglas Gregor [Fri, 12 Oct 2012 21:17:34 +0000 (21:17 +0000)]
Add missing header from 165821

llvm-svn: 165822

11 years agoSanitize the names of modules determined based on the names of headers
Douglas Gregor [Fri, 12 Oct 2012 21:15:50 +0000 (21:15 +0000)]
Sanitize the names of modules determined based on the names of headers
or directories, to make sure that they are identifiers that are not
keywords in any dialect. Fixes <rdar://problem/12489495>.

llvm-svn: 165821

11 years agoMake SBDeclaration.h a public header in the LLDB.framework.
Greg Clayton [Fri, 12 Oct 2012 20:31:06 +0000 (20:31 +0000)]
Make SBDeclaration.h a public header in the LLDB.framework.

llvm-svn: 165820

11 years agoRemove XFAIL,fix test
Bill Schmidt [Fri, 12 Oct 2012 20:16:26 +0000 (20:16 +0000)]
Remove XFAIL,fix test

llvm-svn: 165819

11 years agoXFAIL pending further investigation
Bill Schmidt [Fri, 12 Oct 2012 20:07:31 +0000 (20:07 +0000)]
XFAIL pending further investigation

llvm-svn: 165818

11 years agoFix typo correction of one qualified name to another.
David Blaikie [Fri, 12 Oct 2012 20:00:44 +0000 (20:00 +0000)]
Fix typo correction of one qualified name to another.

When suggesting "foo::bar" as a correction for "fob::bar" we mistakenly
replaced only "bar" with "foo::bar" producing "fob::foo::bar" which was broken.

This corrects that replacement in as many places as I could find & provides
test cases for all those cases I could find a test case for. There are a couple
that don't seem to be reachable (one looks entirely dead, the other just
doesn't seem to ever get called with a namespace to namespace change).

Review by Richard Smith ( http://llvm-reviews.chandlerc.com/D57 ).

llvm-svn: 165817

11 years agoThis patch addresses PR13948.
Bill Schmidt [Fri, 12 Oct 2012 19:26:17 +0000 (19:26 +0000)]
This patch addresses PR13948.

For 64-bit PowerPC SVR4, an aggregate containing only one
floating-point field (float, double, or long double) must be passed in
a register as though just that field were present.  This patch
addresses the issue during Clang code generation by specifying in the
ABIArgInfo for the argument that the underlying type is passed
directly in a register.  The included test case verifies flat and
nested structs for the three data types.

llvm-svn: 165816

11 years agoHave scan-view guard against serving up pages outside the root directory.
Ted Kremenek [Fri, 12 Oct 2012 19:16:31 +0000 (19:16 +0000)]
Have scan-view guard against serving up pages outside the root directory.

llvm-svn: 165815

11 years agoAdd bitcode instruction encoding documentation for module version
Jan Wen Voung [Fri, 12 Oct 2012 18:13:17 +0000 (18:13 +0000)]
Add bitcode instruction encoding documentation for module version
0 and 1.  Followup to 165739.

llvm-svn: 165814

11 years agoFix coalescing with IMPLICIT_DEF values.
Jakob Stoklund Olesen [Fri, 12 Oct 2012 18:03:04 +0000 (18:03 +0000)]
Fix coalescing with IMPLICIT_DEF values.

PHIElimination inserts IMPLICIT_DEF instructions to guarantee that all
PHI predecessors have a live-out value. These IMPLICIT_DEF values are
not considered to be real interference when coalescing virtual
registers:

  %vreg1 = IMPLICIT_DEF
  %vreg2 = MOV32r0

When joining %vreg1 and %vreg2, the IMPLICIT_DEF instruction and its
value number should simply be erased since the %vreg2 value number now
provides a live-out value for the PHI predecesor block.

llvm-svn: 165813

11 years agoChange (!list.size() == 0) to (!list.empty()). No functional change.
Richard Trieu [Fri, 12 Oct 2012 17:57:35 +0000 (17:57 +0000)]
Change (!list.size() == 0) to (!list.empty()).  No functional change.

llvm-svn: 165812

11 years agoChange (!ptr != 0) to (!ptr) to make the code more readable.
Richard Trieu [Fri, 12 Oct 2012 17:48:40 +0000 (17:48 +0000)]
Change (!ptr != 0) to (!ptr) to make the code more readable.
No functional change.

llvm-svn: 165811

11 years agoHandle a "#pragma options align" inside a class.
Argyrios Kyrtzidis [Fri, 12 Oct 2012 17:39:59 +0000 (17:39 +0000)]
Handle a "#pragma options align" inside a class.

llvm-svn: 165810

11 years agoSet default CPU for Darwin targets with LTO. <rdar://problem/12457841>
Bob Wilson [Fri, 12 Oct 2012 17:39:25 +0000 (17:39 +0000)]
Set default CPU for Darwin targets with LTO. <rdar://problem/12457841>

This is a temporary hack until Bill's project to record command line options
in the LLVM IR is ready. Clang currently sets a default CPU but that isn't
recorded anywhere and it doesn't get used in the final LTO compilation.

llvm-svn: 165809

11 years agoBunch of cleanups for warnings found by the llvm static analyzer.
Jim Ingham [Fri, 12 Oct 2012 17:34:26 +0000 (17:34 +0000)]
Bunch of cleanups for warnings found by the llvm static analyzer.

llvm-svn: 165808

11 years agoAdd dump support for comments coming from
Fariborz Jahanian [Fri, 12 Oct 2012 17:28:36 +0000 (17:28 +0000)]
Add dump support for comments coming from
overridden symbols. OK'ed off-line by Doug.
// rdar://12378793

llvm-svn: 165807

11 years agoPatch from Daniel Malea that cleans up the process parameters for Process/Thread...
Greg Clayton [Fri, 12 Oct 2012 16:23:23 +0000 (16:23 +0000)]
Patch from Daniel Malea that cleans up the process parameters for Process/Thread classes for POSIX and Linux.

llvm-svn: 165806

11 years agoPatch from Andrew Kaylor that centralized where the info for:
Greg Clayton [Fri, 12 Oct 2012 16:15:28 +0000 (16:15 +0000)]
Patch from Andrew Kaylor that centralized where the info for:

ConstString Host::GetVendorString();
ConstString Host::GetOSString();

comes from. It now all comes from the Host::GetArchitecture (eSystemDefaultArchitecture) like the Apple build was doing to minimize the number of places that need to be updated when Host::GetArchitecture () is called.

llvm-svn: 165805

11 years agoModified patch from Matt Kopec that makes sure the run lock is acquired when attachin...
Greg Clayton [Fri, 12 Oct 2012 16:10:12 +0000 (16:10 +0000)]
Modified patch from Matt Kopec that makes sure the run lock is acquired when attaching and makes sure the pid is being set on linux in the process info.

llvm-svn: 165804

11 years agollvm/test/CodeGen/PowerPC/2012-10-12-bitcast.ll: Try to fix failure on non-ppc hosts...
NAKAMURA Takumi [Fri, 12 Oct 2012 16:01:08 +0000 (16:01 +0000)]
llvm/test/CodeGen/PowerPC/2012-10-12-bitcast.ll: Try to fix failure on non-ppc hosts, to add -mattr=+altivec.

llvm-svn: 165803

11 years agoFix big-endian codegen bug in DAGTypeLegalizer::ExpandRes_BITCAST
Ulrich Weigand [Fri, 12 Oct 2012 15:42:58 +0000 (15:42 +0000)]
Fix big-endian codegen bug in DAGTypeLegalizer::ExpandRes_BITCAST

On PowerPC, a bitcast of <16 x i8> to i128 may run through a code
path in ExpandRes_BITCAST that attempts to do an intermediate
bitcast to a <4 x i32> vector, and then construct the Hi and Lo parts
of the resulting i128 by pairing up two of those i32 vector elements
each.  The code already recognizes that on a big-endian system, the
first two vector elements form the Hi part, and the final two vector
elements form the Lo part (vice-versa from the little-endian situation).

However, we also need to take endianness into account when forming each
of those separate pairs:  on a big-endian system, vector element 0 is
the *high* part of the pair making up the Hi part of the result, and
vector element 1 is the low part of the pair.  The code currently always
uses vector element 0 as the low part and vector element 1 as the high
part, as is appropriate for little-endian platforms only.

This patch fixes this by swapping the vector elements as they are
paired up as appropriate.

llvm-svn: 165802

11 years agoc-index-test.c: /* Use C style comment. */
NAKAMURA Takumi [Fri, 12 Oct 2012 14:25:52 +0000 (14:25 +0000)]
c-index-test.c: /* Use C style comment. */

llvm-svn: 165797

11 years agoExceptionDemo.cpp: Use Function::setDoesNotReturn(). Attributes stuff was updated.
NAKAMURA Takumi [Fri, 12 Oct 2012 14:11:48 +0000 (14:11 +0000)]
ExceptionDemo.cpp: Use Function::setDoesNotReturn(). Attributes stuff was updated.

llvm-svn: 165796

11 years agoExceptionDemo.cpp: Whitespace.
NAKAMURA Takumi [Fri, 12 Oct 2012 14:11:43 +0000 (14:11 +0000)]
ExceptionDemo.cpp: Whitespace.

llvm-svn: 165795

11 years agoclang/test/Index/index-module.m: Tweak expressions to fit Win32 paths.
NAKAMURA Takumi [Fri, 12 Oct 2012 14:11:32 +0000 (14:11 +0000)]
clang/test/Index/index-module.m: Tweak expressions to fit Win32 paths.

llvm-svn: 165794

12 years agoRemove unused variable.
Benjamin Kramer [Fri, 12 Oct 2012 14:01:58 +0000 (14:01 +0000)]
Remove unused variable.

llvm-svn: 165793

12 years agoAdd powerpc-ibm-aix to Triple. Patch by Kai.
Duncan Sands [Fri, 12 Oct 2012 11:08:57 +0000 (11:08 +0000)]
Add powerpc-ibm-aix to Triple.  Patch by Kai.

llvm-svn: 165792

12 years agoAdd float-abi and softfloat options to lli
Tim Northover [Fri, 12 Oct 2012 09:55:13 +0000 (09:55 +0000)]
Add float-abi and softfloat options to lli

Patch by Amara Emerson.

llvm-svn: 165791

12 years agoJITTest.cpp: Use LLVM_ATTRIBUTE_USED, rather than __attribute__ directly!
NAKAMURA Takumi [Fri, 12 Oct 2012 08:09:29 +0000 (08:09 +0000)]
JITTest.cpp: Use LLVM_ATTRIBUTE_USED, rather than __attribute__ directly!

llvm-svn: 165790

12 years agowww: Clarify that GMP is LGPL licensed
Tobias Grosser [Fri, 12 Oct 2012 07:44:38 +0000 (07:44 +0000)]
www: Clarify that GMP is LGPL licensed

llvm-svn: 165789

12 years ago[PCH] We only need to record C++ overridden methods once for the canonical decl.
Argyrios Kyrtzidis [Fri, 12 Oct 2012 05:31:40 +0000 (05:31 +0000)]
[PCH] We only need to record C++ overridden methods once for the canonical decl.

llvm-svn: 165788

12 years agoShuffle the virtual destructor down to the base. This should actually pacify
Nick Lewycky [Fri, 12 Oct 2012 04:28:25 +0000 (04:28 +0000)]
Shuffle the virtual destructor down to the base. This should actually pacify
-Wnon-virtual-dtor for real.

llvm-svn: 165787

12 years agoGive this class full of virtual functions a virtual destructor. Classes love
Nick Lewycky [Fri, 12 Oct 2012 04:13:25 +0000 (04:13 +0000)]
Give this class full of virtual functions a virtual destructor. Classes love
virtual destructors.

llvm-svn: 165786

12 years agoIndenting.
Eric Christopher [Fri, 12 Oct 2012 02:04:47 +0000 (02:04 +0000)]
Indenting.

llvm-svn: 165785

12 years agofix warning
Sebastian Pop [Fri, 12 Oct 2012 02:04:32 +0000 (02:04 +0000)]
fix warning

DependenceAnalysis.cpp:1164:32: warning: implicit truncation from 'int' to bitfield changes value from -5 to 3
      [-Wconstant-conversion]
    Result.DV[Level].Direction &= ~Dependence::DVEntry::GT;
                               ^  ~~~~~~~~~~~~~~~~~~~~~~~~

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

llvm-svn: 165784

12 years agoDiv, Rem int/unsigned int
Reed Kotler [Fri, 12 Oct 2012 02:01:09 +0000 (02:01 +0000)]
Div, Rem int/unsigned int

llvm-svn: 165783

12 years agodocs: Update example to conform to coding standards.
Sean Silva [Fri, 12 Oct 2012 01:55:51 +0000 (01:55 +0000)]
docs: Update example to conform to coding standards.

llvm-svn: 165782

12 years agoMark function as 'used' so that LTO doesn't try to get rid of it.
Bill Wendling [Fri, 12 Oct 2012 01:44:08 +0000 (01:44 +0000)]
Mark function as 'used' so that LTO doesn't try to get rid of it.

llvm-svn: 165781

12 years agoRevert r165777, "Mark function as 'used' so that LTO doesn't try to get rid of it."
NAKAMURA Takumi [Fri, 12 Oct 2012 01:34:07 +0000 (01:34 +0000)]
Revert r165777, "Mark function as 'used' so that LTO doesn't try to get rid of it."

llvm-svn: 165780

12 years agodocs: Minor clean up of Phabricator documentation.
Sean Silva [Fri, 12 Oct 2012 01:21:24 +0000 (01:21 +0000)]
docs: Minor clean up of Phabricator documentation.

llvm-svn: 165779

12 years agoLegalizer optimize a pair of div / mod to a call to divrem libcall if they are
Evan Cheng [Fri, 12 Oct 2012 01:15:47 +0000 (01:15 +0000)]
Legalizer optimize a pair of div / mod to  a call to divrem libcall if they are
not legal. However, it should use a div instruction + mul + sub if divide is
legal. The rem legalization code was missing a check and incorrectly uses a
divrem libcall even when div is legal.

rdar://12481395

llvm-svn: 165778

12 years agoMark function as 'used' so that LTO doesn't try to get rid of it.
Bill Wendling [Fri, 12 Oct 2012 01:15:17 +0000 (01:15 +0000)]
Mark function as 'used' so that LTO doesn't try to get rid of it.

llvm-svn: 165777

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

llvm-svn: 165776

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

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

llvm-svn: 165775

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

llvm-svn: 165774

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

llvm-svn: 165773

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

llvm-svn: 165772

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

llvm-svn: 165771

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

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

llvm-svn: 165770

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

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

Bug analysis:

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

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

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

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

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

llvm-svn: 165769

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

* Fix confusing explanation regarding abstract classes.

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

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

llvm-svn: 165768

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

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

llvm-svn: 165767

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

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

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

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

llvm-svn: 165766

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

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

All `classof()` of the form

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

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

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

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

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

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

llvm-svn: 165765

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

llvm-svn: 165764

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

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

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

llvm-svn: 165763

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

llvm-svn: 165762

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

llvm-svn: 165761

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

llvm-svn: 165760

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

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

llvm-svn: 165759

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

llvm-svn: 165758