platform/upstream/llvm.git
11 years agoImplement MachOObjectFile::getHeaderSize directly.
Rafael Espindola [Sun, 7 Apr 2013 19:31:49 +0000 (19:31 +0000)]
Implement MachOObjectFile::getHeaderSize directly.

llvm-svn: 178995

11 years agoImplement MachOObjectFile::getHeader directly.
Rafael Espindola [Sun, 7 Apr 2013 19:26:57 +0000 (19:26 +0000)]
Implement MachOObjectFile::getHeader directly.

llvm-svn: 178994

11 years agoImplement LowerCall_64 for the SPARC v9 64-bit ABI.
Jakob Stoklund Olesen [Sun, 7 Apr 2013 19:10:57 +0000 (19:10 +0000)]
Implement LowerCall_64 for the SPARC v9 64-bit ABI.

There is still no support for byval arguments (which I don't think are
needed) and varargs.

llvm-svn: 178993

11 years agoImplement MachOObjectFile::getHeaderSize and MachOObjectFile::getData.
Rafael Espindola [Sun, 7 Apr 2013 19:05:30 +0000 (19:05 +0000)]
Implement MachOObjectFile::getHeaderSize and MachOObjectFile::getData.

These were the last missing forwarding functions. Also consistently use
the forwarding functions instead of using MachOObj directly.

llvm-svn: 178992

11 years agoRemove LoadCommandInfo now that we always have a pointer to the command.
Rafael Espindola [Sun, 7 Apr 2013 18:42:06 +0000 (18:42 +0000)]
Remove LoadCommandInfo now that we always have a pointer to the command.

LoadCommandInfo was needed to keep a command and its offset in the file. Now
that we always have a pointer to the command, we don't need the offset.

llvm-svn: 178991

11 years agoAdd MachOObjectFile::LoadCommandInfo.
Rafael Espindola [Sun, 7 Apr 2013 18:08:12 +0000 (18:08 +0000)]
Add MachOObjectFile::LoadCommandInfo.

This avoids using MachOObject::getLoadCommandInfo.

llvm-svn: 178990

11 years agoUse getLoadCommandInfo instead of MachOObj->getLoadCommandInfo.
Rafael Espindola [Sun, 7 Apr 2013 17:41:59 +0000 (17:41 +0000)]
Use getLoadCommandInfo instead of MachOObj->getLoadCommandInfo.

llvm-svn: 178989

11 years agoConstruct MachOObject in MachOObjectFile's constructor.
Rafael Espindola [Sun, 7 Apr 2013 16:58:48 +0000 (16:58 +0000)]
Construct MachOObject in MachOObjectFile's constructor.

llvm-svn: 178988

11 years agoRemove unused argument.
Rafael Espindola [Sun, 7 Apr 2013 16:40:00 +0000 (16:40 +0000)]
Remove unused argument.

llvm-svn: 178987

11 years agoRemove MachOObjectFile::getObject.
Rafael Espindola [Sun, 7 Apr 2013 16:07:35 +0000 (16:07 +0000)]
Remove MachOObjectFile::getObject.

llvm-svn: 178986

11 years agoRemove two uses of getObject.
Rafael Espindola [Sun, 7 Apr 2013 15:46:05 +0000 (15:46 +0000)]
Remove two uses of getObject.

llvm-svn: 178985

11 years agoRemove usage of InMemoryStruct in getSymbol.
Rafael Espindola [Sun, 7 Apr 2013 15:35:18 +0000 (15:35 +0000)]
Remove usage of InMemoryStruct in getSymbol.

llvm-svn: 178984

11 years agoPPC Altivec load/store intrinsics can be marked IntrRead[Write]ArgMem
Hal Finkel [Sun, 7 Apr 2013 15:32:40 +0000 (15:32 +0000)]
PPC Altivec load/store intrinsics can be marked IntrRead[Write]ArgMem

llvm-svn: 178983

11 years agoPPC rotate instructions don't have unmodeled side effcts
Hal Finkel [Sun, 7 Apr 2013 15:06:53 +0000 (15:06 +0000)]
PPC rotate instructions don't have unmodeled side effcts

llvm-svn: 178982

11 years agoRemove a use of InMemoryStruct in llvm-readobj.
Rafael Espindola [Sun, 7 Apr 2013 15:05:12 +0000 (15:05 +0000)]
Remove a use of InMemoryStruct in llvm-readobj.

llvm-svn: 178981

11 years agoMake getObject const. Remove a const_cast.
Rafael Espindola [Sun, 7 Apr 2013 14:50:40 +0000 (14:50 +0000)]
Make getObject const. Remove a const_cast.

llvm-svn: 178980

11 years agoRemove last use of InMemoryStruct in llvm-objdump.
Rafael Espindola [Sun, 7 Apr 2013 14:40:18 +0000 (14:40 +0000)]
Remove last use of InMemoryStruct in llvm-objdump.

llvm-svn: 178979

11 years agoMost PPC M[TF]CR instructions do not have side effects
Hal Finkel [Sun, 7 Apr 2013 14:33:13 +0000 (14:33 +0000)]
Most PPC M[TF]CR instructions do not have side effects

llvm-svn: 178978

11 years agoRemove dead code.
Rafael Espindola [Sun, 7 Apr 2013 14:30:21 +0000 (14:30 +0000)]
Remove dead code.

llvm-svn: 178977

11 years agoRemove unused argument.
Rafael Espindola [Sun, 7 Apr 2013 14:25:39 +0000 (14:25 +0000)]
Remove unused argument.

llvm-svn: 178976

11 years agoSema: Don't crash when trying to emit a warning for a duplicate value in an invalid...
Benjamin Kramer [Sun, 7 Apr 2013 14:10:40 +0000 (14:10 +0000)]
Sema: Don't crash when trying to emit a warning for a duplicate value in an invalid enum.

Fixes PR15693. A null check on a pointer returned from cast<> is a very dubious
construct, do we have a checker for this somewhere?

llvm-svn: 178975

11 years agoFix PR15674 (and PR15603): a SROA think-o.
Chandler Carruth [Sun, 7 Apr 2013 11:47:54 +0000 (11:47 +0000)]
Fix PR15674 (and PR15603): a SROA think-o.

The fix for PR14972 in r177055 introduced a real think-o in the *store*
side, likely because I was much more focused on the load side. While we
can arbitrarily widen (or narrow) a loaded value, we can't arbitrarily
widen a value to be stored, as that changes the width of memory access!
Lock down the code path in the store rewriting which would do this to
only handle the intended circumstance.

All of the existing tests continue to pass, and I've added a test from
the PR.

llvm-svn: 178974

11 years agoPPC pre-increment load instructions do not have side effects
Hal Finkel [Sun, 7 Apr 2013 06:30:47 +0000 (06:30 +0000)]
PPC pre-increment load instructions do not have side effects

A few were missed in r178972.

llvm-svn: 178973

11 years agoPPC pre-increment load instructions do not have side effects
Hal Finkel [Sun, 7 Apr 2013 05:46:58 +0000 (05:46 +0000)]
PPC pre-increment load instructions do not have side effects

llvm-svn: 178972

11 years agoPPC MCRF instruction does not have side effects
Hal Finkel [Sun, 7 Apr 2013 05:16:57 +0000 (05:16 +0000)]
PPC MCRF instruction does not have side effects

llvm-svn: 178971

11 years agoPPC FMR instruction does not have side effects
Hal Finkel [Sun, 7 Apr 2013 04:56:16 +0000 (04:56 +0000)]
PPC FMR instruction does not have side effects

llvm-svn: 178970

11 years agoDW_FORM_sec_offset should be a relocation on platforms that use
Eric Christopher [Sun, 7 Apr 2013 03:43:09 +0000 (03:43 +0000)]
DW_FORM_sec_offset should be a relocation on platforms that use
a relocation across sections. Do this for DW_AT_stmt list in the
skeleton CU and check the relocations in the debug_info section.

Add a FIXME for multiple CUs.

llvm-svn: 178969

11 years ago[cmake] Avoid rel+asserts warnings when passing -UNDEBUG
Reid Kleckner [Sun, 7 Apr 2013 01:45:01 +0000 (01:45 +0000)]
[cmake] Avoid rel+asserts warnings when passing -UNDEBUG

MSVC 2012 gives warning D9025, "overriding /D NDEBUG with -UNDEBUG".
Removing the original definition of NDEBUG silences this.

llvm-svn: 178967

11 years agoImplement LowerReturn_64 for SPARC v9.
Jakob Stoklund Olesen [Sat, 6 Apr 2013 23:57:33 +0000 (23:57 +0000)]
Implement LowerReturn_64 for SPARC v9.

Integer return values are sign or zero extended by the callee, and
structs up to 32 bytes in size can be returned in registers.

The CC_Sparc64 CallingConv definition is shared between
LowerFormalArguments_64 and LowerReturn_64. Function arguments and
return values are passed in the same registers.

The inreg flag is also used for return values. This is required to handle
C functions returning structs containing floats and ints:

  struct ifp {
    int i;
    float f;
  };

  struct ifp f(void);

LLVM IR:

  define inreg { i32, float } @f() {
     ...
     ret { i32, float } %retval
  }

The ABI requires that %retval.i is returned in the high bits of %i0
while %retval.f goes in %f1.

Without the inreg return value attribute, %retval.i would go in %i0 and
%retval.f would go in %f3 which is a more efficient way of returning
%multiple values, but it is not ABI compliant for returning C structs.

llvm-svn: 178966

11 years agoSPARC v9 stack pointer bias.
Jakob Stoklund Olesen [Sat, 6 Apr 2013 21:38:57 +0000 (21:38 +0000)]
SPARC v9 stack pointer bias.

64-bit SPARC v9 processes use biased stack and frame pointers, so the
current function's stack frame is located at %sp+BIAS .. %fp+BIAS where
BIAS = 2047.

This makes more local variables directly accessible via [%fp+simm13]
addressing.

llvm-svn: 178965

11 years agoCache the VM page size that we get from task_vm_info so we don't
Jason Molenda [Sat, 6 Apr 2013 20:30:59 +0000 (20:30 +0000)]
Cache the VM page size that we get from task_vm_info so we don't
re-fetch the value.

llvm-svn: 178962

11 years agoImplement PPCInstrInfo::FoldImmediate
Hal Finkel [Sat, 6 Apr 2013 19:30:30 +0000 (19:30 +0000)]
Implement PPCInstrInfo::FoldImmediate

There are certain PPC instructions into which we can fold a zero immediate
operand. We can detect such cases by looking at the register class required
by the using operand (so long as it is not otherwise constrained).

llvm-svn: 178961

11 years agoPPC ISEL is a select and never has side effects
Hal Finkel [Sat, 6 Apr 2013 19:30:28 +0000 (19:30 +0000)]
PPC ISEL is a select and never has side effects

llvm-svn: 178960

11 years agoAdd a comment to TargetInstrInfo about FoldImmediate
Hal Finkel [Sat, 6 Apr 2013 19:30:20 +0000 (19:30 +0000)]
Add a comment to TargetInstrInfo about FoldImmediate

This comment documents the current behavior of the ARM implementation of this
callback, and also the soon-to-be-committed PPC version.

llvm-svn: 178959

11 years agoComplete formal arguments for the SPARC v9 64-bit ABI.
Jakob Stoklund Olesen [Sat, 6 Apr 2013 18:32:12 +0000 (18:32 +0000)]
Complete formal arguments for the SPARC v9 64-bit ABI.

All arguments are formally assigned to stack positions and then promoted
to floating point and integer registers. Since there are more floating
point registers than integer registers, this can cause situations where
floating point arguments are assigned to registers after integer
arguments that where assigned to the stack.

Use the inreg flag to indicate 32-bit fragments of structs containing
both float and int members.

The three-way shadowing between stack, integer, and floating point
registers requires custom argument lowering. The good news is that
return values are passed in the exact same way, and we can share the
code.

Still missing:

 - Update LowerReturn to handle structs returned in registers.
 - LowerCall.
 - Variadic functions.

llvm-svn: 178958

11 years agoAdd optional LOG_TASK logging for MachVMMemory::PageSize when the call succeeds,...
Jason Molenda [Sat, 6 Apr 2013 07:28:38 +0000 (07:28 +0000)]
Add optional LOG_TASK logging for MachVMMemory::PageSize when the call succeeds, too.

llvm-svn: 178955

11 years agoAdd optional LOG_TASK logging for MachVMMemory::PageSize() task_info call failure.
Jason Molenda [Sat, 6 Apr 2013 07:26:59 +0000 (07:26 +0000)]
Add optional LOG_TASK logging for MachVMMemory::PageSize() task_info call failure.

llvm-svn: 178954

11 years agoUpdate MachVMMemory::PageSize to get the page size of a specific process
Jason Molenda [Sat, 6 Apr 2013 07:16:15 +0000 (07:16 +0000)]
Update MachVMMemory::PageSize to get the page size of a specific process
if we have an updated task_info call available; else fall back to getting
the default host-wide page size.

Update all uses of the vm page size to get it via MachVMMemory::PageSize().

<rdar://problem/13477763>, <rdar://problem/13498504>

llvm-svn: 178953

11 years agoRemove nondeterminism introduced in r178950.
Richard Smith [Sat, 6 Apr 2013 07:07:44 +0000 (07:07 +0000)]
Remove nondeterminism introduced in r178950.

llvm-svn: 178952

11 years agoChange the default of 'platform.plugin.darwin-kernel.search-locally-for-kexts'
Jason Molenda [Sat, 6 Apr 2013 05:25:38 +0000 (05:25 +0000)]
Change the default of 'platform.plugin.darwin-kernel.search-locally-for-kexts'
to 'off' for a week or so while we test the behavior in different environments.

llvm-svn: 178951

11 years agoWhen an internal-linkage function or variable is declared within an extern "C"
Richard Smith [Sat, 6 Apr 2013 05:00:46 +0000 (05:00 +0000)]
When an internal-linkage function or variable is declared within an extern "C"
linkage specification, and is marked as __attribute__((used)), try to also give
it the unmangled name (by emitting an internal linkage alias) if nothing else
within the translation unit would use that name. This allows inline asm in that
translation unit to use the entity via its unmangled name, which people
apparently rely on.

llvm-svn: 178950

11 years agotypo
Nadav Rotem [Sat, 6 Apr 2013 04:24:12 +0000 (04:24 +0000)]
typo

llvm-svn: 178949

11 years agoRemove last use of InMemoryStruct from MachOObjectFile.cpp.
Rafael Espindola [Sat, 6 Apr 2013 03:50:05 +0000 (03:50 +0000)]
Remove last use of InMemoryStruct from MachOObjectFile.cpp.

llvm-svn: 178948

11 years agoDon't use InMemoryStruct<macho::SymtabLoadCommand>.
Rafael Espindola [Sat, 6 Apr 2013 03:31:08 +0000 (03:31 +0000)]
Don't use InMemoryStruct<macho::SymtabLoadCommand>.

This also required not using the RegisterStringTable API, which is also a
good thing.

llvm-svn: 178947

11 years agoDon't use InMemoryStruct in getSymbol64TableEntry.
Rafael Espindola [Sat, 6 Apr 2013 02:15:44 +0000 (02:15 +0000)]
Don't use InMemoryStruct in getSymbol64TableEntry.

llvm-svn: 178946

11 years agoDon't use InMemoryStruct in getSymbolTableEntry.
Rafael Espindola [Sat, 6 Apr 2013 01:59:05 +0000 (01:59 +0000)]
Don't use InMemoryStruct in getSymbolTableEntry.

llvm-svn: 178945

11 years ago[analyzer] When creating a trimmed graph, preserve whether a node is a sink.
Jordan Rose [Sat, 6 Apr 2013 01:42:02 +0000 (01:42 +0000)]
[analyzer] When creating a trimmed graph, preserve whether a node is a sink.

This is important because sometimes two nodes are identical, except the
second one is a sink.

This bug has probably been around for a while, but it wouldn't have been an
issue in the old report graph algorithm. I'm ashamed to say I actually looked
at this the first time around and thought it would never be a problem...and
then didn't include an assertion to back that up.

PR15684

llvm-svn: 178944

11 years agoDon't use InMemoryStruct in getRelocation.
Rafael Espindola [Sat, 6 Apr 2013 01:24:11 +0000 (01:24 +0000)]
Don't use InMemoryStruct in getRelocation.

llvm-svn: 178943

11 years ago[objcmt] Fix a mishandled conversion to objc directory literal.
Argyrios Kyrtzidis [Sat, 6 Apr 2013 01:13:17 +0000 (01:13 +0000)]
[objcmt] Fix a mishandled conversion to objc directory literal.

rdar://13181413

llvm-svn: 178942

11 years agoDwarf: use utostr on CUID to append to SmallString.
Manman Ren [Sat, 6 Apr 2013 01:02:38 +0000 (01:02 +0000)]
Dwarf: use utostr on CUID to append to SmallString.

We used to do "SmallString += CUID", which is incorrect, since CUID will
be truncated to a char.

rdar://problem/13573833

llvm-svn: 178941

11 years agoAdd VTune as an optional external dependency and add task tracking.
Michael J. Spencer [Sat, 6 Apr 2013 00:56:40 +0000 (00:56 +0000)]
Add VTune as an optional external dependency and add task tracking.

llvm-svn: 178940

11 years ago<rdar://problem/13325066> Destroy std::initializer_list temporaries whose lifetime...
Douglas Gregor [Sat, 6 Apr 2013 00:46:20 +0000 (00:46 +0000)]
<rdar://problem/13325066> Destroy std::initializer_list temporaries whose lifetime has been extended by reference binding.

llvm-svn: 178939

11 years ago[analyzer] Shorten the malloc checker’s leak message
Anna Zaks [Sat, 6 Apr 2013 00:41:36 +0000 (00:41 +0000)]
[analyzer] Shorten the malloc checker’s leak message

As per Ted’s suggestion!

llvm-svn: 178938

11 years agoRework how ObjC method inherit deprecated/availability.
Ted Kremenek [Sat, 6 Apr 2013 00:34:27 +0000 (00:34 +0000)]
Rework how ObjC method inherit deprecated/availability.

New rule:
- Method decls in @implementation are considered "redeclarations"
  and inherit deprecated/availability from the @interface.
- All other cases are consider overrides, which do not inherit
  deprecated/availability.  For example:

  (a) @interface redeclares a method in an adopted protocol.
  (b) A subclass redeclares a method in a superclass.
  (c) A protocol redeclares a method from another protocol it adopts.

The idea is that API authors should have the ability to easily
move availability/deprecated up and down a class/protocol hierarchy.
A redeclaration means that the availability/deprecation is a blank
slate.

Fixes <rdar://problem/13574571>

llvm-svn: 178937

11 years agoDon't call DisableBreakpointSite (i.e. don't try to remove the breakpoint from the...
Jim Ingham [Sat, 6 Apr 2013 00:16:39 +0000 (00:16 +0000)]
Don't call DisableBreakpointSite (i.e. don't try to remove the breakpoint from the target process) if the target
process is no longer alive.

<rdar://problem/13320991>

llvm-svn: 178936

11 years ago[analyzer] Reword error messages for nil keys and values of NSMutableDictionary.
Anna Zaks [Fri, 5 Apr 2013 23:50:18 +0000 (23:50 +0000)]
[analyzer] Reword error messages for nil keys and values of NSMutableDictionary.

llvm-svn: 178935

11 years ago[analyzer] Remove another redundancy from trackNullOrUndef
Anna Zaks [Fri, 5 Apr 2013 23:50:14 +0000 (23:50 +0000)]
[analyzer] Remove another redundancy from trackNullOrUndef

llvm-svn: 178934

11 years ago[analyzer] Fix null tracking for the given test case, by using the proper state and...
Anna Zaks [Fri, 5 Apr 2013 23:50:11 +0000 (23:50 +0000)]
[analyzer] Fix null tracking for the given test case, by using the proper state and removing redundant code.

llvm-svn: 178933

11 years agoRemoved trailing whitespace.
Michael Gottesman [Fri, 5 Apr 2013 23:46:45 +0000 (23:46 +0000)]
Removed trailing whitespace.

llvm-svn: 178932

11 years agoR600/SI: Add support for buffer stores v2
Tom Stellard [Fri, 5 Apr 2013 23:31:51 +0000 (23:31 +0000)]
R600/SI: Add support for buffer stores v2

v2:
  - Use the ADDR64 bit

Reviewed-by: Christian König <christian.koenig@amd.com>
llvm-svn: 178931

11 years agoR600/SI: Use same names for corresponding MUBUF operands and encoding fields
Tom Stellard [Fri, 5 Apr 2013 23:31:44 +0000 (23:31 +0000)]
R600/SI: Use same names for corresponding MUBUF operands and encoding fields

The code emitter knows how to encode operands whose name matches one of
the encoding fields.  If there is no match, the code emitter relies on
the order of the operand and field definitions to determine how operands
should be encoding.  Matching by order makes it easy to accidentally break
the instruction encodings, so we prefer to match by name.

Reviewed-by: Christian König <christian.koenig@amd.com>
llvm-svn: 178930

11 years agoR600: Add RV670 processor
Tom Stellard [Fri, 5 Apr 2013 23:31:40 +0000 (23:31 +0000)]
R600: Add RV670 processor

This is an R600 GPU with double support.

Reviewed-by: Christian König <christian.koenig@amd.com>
llvm-svn: 178929

11 years agoR600/SI: Add processor types for each SI variant
Tom Stellard [Fri, 5 Apr 2013 23:31:35 +0000 (23:31 +0000)]
R600/SI: Add processor types for each SI variant

Reviewed-by: Christian König <christian.koenig@amd.com>
llvm-svn: 178928

11 years agoR600/SI: Avoid generating S_MOVs with 64-bit immediates v2
Tom Stellard [Fri, 5 Apr 2013 23:31:20 +0000 (23:31 +0000)]
R600/SI: Avoid generating S_MOVs with 64-bit immediates v2

SITargetLowering::analyzeImmediate() was converting the 64-bit values
to 32-bit and then checking if they were an inline immediate.  Some
of these conversions caused this check to succeed and produced
S_MOV instructions with 64-bit immediates, which are illegal.

v2:
  - Clean up logic

Reviewed-by: Christian König <christian.koenig@amd.com>
llvm-svn: 178927

11 years agoEnable early if conversion on PPC
Hal Finkel [Fri, 5 Apr 2013 23:29:01 +0000 (23:29 +0000)]
Enable early if conversion on PPC

On cores for which we know the misprediction penalty, and we have
the isel instruction, we can profitably perform early if conversion.
This enables us to replace some small branch sequences with selects
and avoid the potential stalls from mispredicting the branches.

Enabling this feature required implementing canInsertSelect and
insertSelect in PPCInstrInfo; isel code in PPCISelLowering was
refactored to use these functions as well.

llvm-svn: 178926

11 years agoCorrect the PPC A2 misprediction penalty
Hal Finkel [Fri, 5 Apr 2013 23:28:58 +0000 (23:28 +0000)]
Correct the PPC A2 misprediction penalty

The manual states that there is a minimum of 13 cycles from when the
mispredicted branch is issued to when the correct branch target is
issued.

llvm-svn: 178925

11 years agoAdded support "__attribute__((__vector_size__(B)))" and "__attribute__((ext_vector_ty...
Greg Clayton [Fri, 5 Apr 2013 23:27:21 +0000 (23:27 +0000)]
Added support "__attribute__((__vector_size__(B)))" and "__attribute__((ext_vector_type(N)))".

Now we can:
1 - see the return value for functions that return types that use the "ext_vector_size"
2 - dump values that use the vector attributes ("expr $ymm0")
3 - modified the DWARF parser to correctly parse GNU vector types from the DWARF by turning them into clang::Type::ExtVector types instead of just standard arrays

llvm-svn: 178924

11 years agoWhen -Woverloaded-virtual is triggered, call HandleFunctionTypeMismatch to add
Richard Trieu [Fri, 5 Apr 2013 23:02:24 +0000 (23:02 +0000)]
When -Woverloaded-virtual is triggered, call HandleFunctionTypeMismatch to add
more information to the notes.  This information is already present on other
diagnostic messages that involves overloads.

llvm-svn: 178923

11 years agoAn objc_retain can serve as a use for a different pointer.
Michael Gottesman [Fri, 5 Apr 2013 22:54:32 +0000 (22:54 +0000)]
An objc_retain can serve as a use for a different pointer.

This is the counterpart to commit r160637, except it performs the action
in the bottomup portion of the data flow analysis.

llvm-svn: 178922

11 years agoProperly model precise lifetime when given an incomplete dataflow sequence.
Michael Gottesman [Fri, 5 Apr 2013 22:54:28 +0000 (22:54 +0000)]
Properly model precise lifetime when given an incomplete dataflow sequence.

The normal dataflow sequence in the ARC optimizer consists of the following
states:

    Retain -> CanRelease -> Use -> Release

The optimizer before this patch stored the uses that determine the lifetime of
the retainable object pointer when it bottom up hits a retain or when top down
it hits a release. This is correct for an imprecise lifetime scenario since what
we are trying to do is remove retains/releases while making sure that no
``CanRelease'' (which is usually a call) deallocates the given pointer before we
get to the ``Use'' (since that would cause a segfault).

If we are considering the precise lifetime scenario though, this is not
correct. In such a situation, we *DO* care about the previous sequence, but
additionally, we wish to track the uses resulting from the following incomplete
sequences:

  Retain -> CanRelease -> Release   (TopDown)
  Retain <- Use <- Release          (BottomUp)

*NOTE* This patch looks large but the most of it consists of updating
test cases. Additionally this fix exposed an additional bug. I removed
the test case that expressed said bug and will recommit it with the fix
in a little bit.

llvm-svn: 178921

11 years agoReorder the Platform plugin settings so that they're now
Jason Molenda [Fri, 5 Apr 2013 22:40:42 +0000 (22:40 +0000)]
Reorder the Platform plugin settings so that they're now

platform.plugin.darwin-kernel.kext-directories
platform.plugin.darwin-kernel.search-locally-for-kexts

and fix a few FileSpec handling issues for the kext-directories setting.

llvm-svn: 178920

11 years agoReapply r178845 with fix - Fix bug in PEI's virtual-register scavenging
Hal Finkel [Fri, 5 Apr 2013 22:31:56 +0000 (22:31 +0000)]
Reapply r178845 with fix - Fix bug in PEI's virtual-register scavenging

This fixes PEI as previously described, but correctly handles the case where
the instruction defining the virtual register to be scavenged is the first in
the block. Arnold provided me with a bugpoint-reduced test case, but even that
seems too large to use as a regression test. If I'm successful in cleaning it
up then I'll commit that as well.

Original commit message:

    This change fixes a bug that I introduced in r178058. After a register is
    scavenged using one of the available spills slots the instruction defining the
    virtual register needs to be moved to after the spill code. The scavenger has
    already processed the defining instruction so that registers killed by that
    instruction are available for definition in that same instruction. Unfortunately,
    after this, the scavenger needs to iterate through the spill code and then
    visit, again, the instruction that defines the now-scavenged register. In order
    to avoid confusion, the register scavenger needs the ability to 'back up'
    through the spill code so that it can again process the instructions in the
    appropriate order. Prior to this fix, once the scavenger reached the
    just-moved instruction, it would assert if it killed any registers because,
    having already processed the instruction, it believed they were undefined.

    Unfortunately, I don't yet have a small test case. Thanks to Pranav Bhandarkar
    for diagnosing the problem and testing this fix.

llvm-svn: 178919

11 years agoRevert "Correctly pass ownership of MemoryBuffers."
Michael J. Spencer [Fri, 5 Apr 2013 22:04:44 +0000 (22:04 +0000)]
Revert "Correctly pass ownership of MemoryBuffers."

llvm-svn: 178918

11 years agoUse the target options specified on a function to reset the back-end.
Bill Wendling [Fri, 5 Apr 2013 21:52:40 +0000 (21:52 +0000)]
Use the target options specified on a function to reset the back-end.

During LTO, the target options on functions within the same Module may
change. This would necessitate resetting some of the back-end. Do this for X86,
because it's a Friday afternoon.

llvm-svn: 178917

11 years agoRevert r178845 - Fix bug in PEI's virtual-register scavenging
Hal Finkel [Fri, 5 Apr 2013 21:30:40 +0000 (21:30 +0000)]
Revert r178845 - Fix bug in PEI's virtual-register scavenging

Reverting because this breaks one of the LTO builders. Original commit message:

    This change fixes a bug that I introduced in r178058. After a register is
    scavenged using one of the available spills slots the instruction defining the
    virtual register needs to be moved to after the spill code. The scavenger has
    already processed the defining instruction so that registers killed by that
    instruction are available for definition in that same instruction. Unfortunately,
    after this, the scavenger needs to iterate through the spill code and then
    visit, again, the instruction that defines the now-scavenged register. In order
    to avoid confusion, the register scavenger needs the ability to 'back up'
    through the spill code so that it can again process the instructions in the
    appropriate order. Prior to this fix, once the scavenger reached the
    just-moved instruction, it would assert if it killed any registers because,
    having already processed the instruction, it believed they were undefined.

    Unfortunately, I don't yet have a small test case. Thanks to Pranav Bhandarkar
    for diagnosing the problem and testing this fix.

llvm-svn: 178916

11 years agoTidy up a bit. No functional change.
Jim Grosbach [Fri, 5 Apr 2013 21:20:12 +0000 (21:20 +0000)]
Tidy up a bit. No functional change.

llvm-svn: 178915

11 years agoCorrectly pass ownership of MemoryBuffers.
Michael J. Spencer [Fri, 5 Apr 2013 21:08:30 +0000 (21:08 +0000)]
Correctly pass ownership of MemoryBuffers.

llvm-svn: 178914

11 years agoFix uninitialized variables. Found by ubsan.
Michael J. Spencer [Fri, 5 Apr 2013 21:07:44 +0000 (21:07 +0000)]
Fix uninitialized variables. Found by ubsan.

llvm-svn: 178913

11 years agoDisable the optimization about promoting vector-element-access with symbolic index.
Shuxin Yang [Fri, 5 Apr 2013 21:07:08 +0000 (21:07 +0000)]
Disable the optimization about promoting vector-element-access with symbolic index.

This optimization is unstable at this moment; it
  1) block us on a very important application
  2) PR15200
  3) test6 and test7 in test/Transforms/ScalarRepl/dynamic-vector-gep.ll
     (the CHECK command compare the output against wrong result)

   I personally believe this optimization should not have any impact on the
autovectorized code, as auto-vectorizer is supposed to put gather/scatter
in a "right" way.  Although in theory downstream optimizaters might reveal
some gather/scatter optimization opportunities, the chance is quite slim.

   For the hand-crafted vectorizing code, in term of redundancy elimination,
load-CSE, copy-propagation and DSE can collectively achieve the same result,
but in much simpler way. On the other hand, these optimizers are able to
improve the code in a incremental way; in contrast, SROA is sort of all-or-none
approach. However, SROA might slighly win in stack size, as it tries to figure
out a stretch of memory tightenly cover the area accessed by the dynamic index.

 rdar://13174884
 PR15200

llvm-svn: 178912

11 years ago[libclang] Fix cursor visitation to not ignore template arguments in out-of-line...
Argyrios Kyrtzidis [Fri, 5 Apr 2013 21:04:10 +0000 (21:04 +0000)]
[libclang] Fix cursor visitation to not ignore template arguments in out-of-line member functions.

rdar://13535645

llvm-svn: 178911

11 years ago[mips] XFAIL test-interp-vec-loadstore.ll in an attempt to turn builder
Akira Hatanaka [Fri, 5 Apr 2013 20:54:46 +0000 (20:54 +0000)]
[mips] XFAIL test-interp-vec-loadstore.ll in an attempt to turn builder
llvm-mips-linux green.

llvm-mips-linux runs on a big endian machine. This test passes if I change 'e'
to 'E' in the target data layout string.

llvm-svn: 178910

11 years ago<rdar://problem/13551789> Fix a race in the LockFileManager.
Douglas Gregor [Fri, 5 Apr 2013 20:53:57 +0000 (20:53 +0000)]
<rdar://problem/13551789> Fix a race in the LockFileManager.

It's possible for the lock file to disappear and the owning process to
return before we're able to see the generated file. Spin for a little
while to see if it shows up before failing.

llvm-svn: 178909

11 years ago<rdar://problem/13551789> Fix yet another race in unique_file.
Douglas Gregor [Fri, 5 Apr 2013 20:48:36 +0000 (20:48 +0000)]
<rdar://problem/13551789> Fix yet another race in unique_file.

If the directory that will contain the unique file doesn't exist when
we tried to create the file, but another process creates it before we
get a chance to try creating it, we would bail out rather than try to
create the unique file.

llvm-svn: 178908

11 years agoFix UseNullptr fails to replace explict casts surrounded by another implicit
Ariel J. Bernal [Fri, 5 Apr 2013 20:32:36 +0000 (20:32 +0000)]
Fix UseNullptr fails to replace explict casts surrounded by another implicit
cast

UseNullptr previously matched the implicit cast to const pointer as well as
the explicit cast within that has an implicit cast to nullptr as a descendant.

-Refactored UseNullptr to avoid special-casing certain kinds of cast sequences
-Added test cases.

llvm-svn: 178907

11 years agoAdd an error to check that all program scope variables are in the constant address...
Tanya Lattner [Fri, 5 Apr 2013 20:14:50 +0000 (20:14 +0000)]
Add an error to check that all program scope variables are in the constant address space in OpenCL.

llvm-svn: 178906

11 years ago[Support][FileSystem] Fix identify_magic for big endian ELF.
Michael J. Spencer [Fri, 5 Apr 2013 20:10:04 +0000 (20:10 +0000)]
[Support][FileSystem] Fix identify_magic for big endian ELF.

llvm-svn: 178905

11 years agoMove yaml2obj to tools too.
Rafael Espindola [Fri, 5 Apr 2013 20:00:35 +0000 (20:00 +0000)]
Move yaml2obj to tools too.

llvm-svn: 178904

11 years agodoce parsing: adding few more headerdoc tags.
Fariborz Jahanian [Fri, 5 Apr 2013 19:40:53 +0000 (19:40 +0000)]
doce parsing: adding few more headerdoc tags.
// rdar://12379114

llvm-svn: 178903

11 years agoCommitting change left out of r178900
Edwin Vane [Fri, 5 Apr 2013 19:25:15 +0000 (19:25 +0000)]
Committing change left out of r178900

llvm-svn: 178902

11 years agoFix symbol dependency errors introduced with libmigrateCore
Edwin Vane [Fri, 5 Apr 2013 19:18:13 +0000 (19:18 +0000)]
Fix symbol dependency errors introduced with libmigrateCore

With cpp11-migrate core functionality moved to a separate library (for enabling
unit tests) this library contained code that referenced symbols that are still
in the main binary. On some platforms, the shared library build broke as a
result. This revision fixes the dependency problem and is safe for the eventual
lib-ification of the transforms as well.

llvm-svn: 178901

11 years agoUpdating cpp11-migrate unit tests
Edwin Vane [Fri, 5 Apr 2013 19:17:36 +0000 (19:17 +0000)]
Updating cpp11-migrate unit tests

With the lib-ification of cpp11-migrate, real unit tests can be written.
Replacing dummy tests with some simple tests for the Transform public
interface.

llvm-svn: 178900

11 years ago[analyzer] Eliminates all the cases with unknown family.
Anton Yartsev [Fri, 5 Apr 2013 19:08:04 +0000 (19:08 +0000)]
[analyzer] Eliminates all the cases with unknown family.

Now treat AF_None family as impossible in isTrackedFamily()

llvm-svn: 178899

11 years agoTry to appease the atom buildbots
Manman Ren [Fri, 5 Apr 2013 19:06:10 +0000 (19:06 +0000)]
Try to appease the atom buildbots

llvm-svn: 178898

11 years ago<rdar://problem/13563628>
Enrico Granata [Fri, 5 Apr 2013 18:49:06 +0000 (18:49 +0000)]
<rdar://problem/13563628>

Introducing a negative cache for ObjCLanguageRuntime::LookupInCompleteClassCache()
This helps speed up the (common) case of us looking for classes that are hidden deep within Cocoa internals and repeatedly failing at finding type information for them.
In order for this to work, we need to clean this cache whenever debug information is added. A new symbols loaded event is added that is triggered with add-dsym (before modules loaded would be triggered for both adding modules and adding symbols).
Interested parties can register for this event. Internally, we make sure to clean the negative cache whenever symbols are added.
Lastly, ClassDescriptor::IsTagged() has been refactored to GetTaggedPointerInfo() that also (optionally) returns info and value bits. In this way, data formatters can share tagged pointer code instead of duplicating the required arithmetic.

llvm-svn: 178897

11 years agoDefine versions of Section that are explicitly marked as little endian.
Rafael Espindola [Fri, 5 Apr 2013 18:45:28 +0000 (18:45 +0000)]
Define versions of Section that are explicitly marked as little endian.

These should really be templated like ELF, but this is a start.

llvm-svn: 178896

11 years agoAdded two debug logging messages to VisitInstructionsTopDown to match VisitInstructio...
Michael Gottesman [Fri, 5 Apr 2013 18:26:08 +0000 (18:26 +0000)]
Added two debug logging messages to VisitInstructionsTopDown to match VisitInstructionsBottomUp.

llvm-svn: 178895

11 years agoDon't use InMemoryStruct in getSection and getSection64.
Rafael Espindola [Fri, 5 Apr 2013 18:18:19 +0000 (18:18 +0000)]
Don't use InMemoryStruct in getSection and getSection64.

llvm-svn: 178894

11 years agoCleaned up whitespace and made debug logging less verbose.
Michael Gottesman [Fri, 5 Apr 2013 18:10:41 +0000 (18:10 +0000)]
Cleaned up whitespace and made debug logging less verbose.

llvm-svn: 178893

11 years agoFix bug in __libcpp_db::__iterator_copy. Add debug test for swaping lists.
Howard Hinnant [Fri, 5 Apr 2013 17:58:52 +0000 (17:58 +0000)]
Fix bug in __libcpp_db::__iterator_copy.  Add debug test for swaping lists.

llvm-svn: 178892

11 years ago[analyzer] Re-enable cplusplus.NewDelete (but not NewDeleteLeaks).
Jordan Rose [Fri, 5 Apr 2013 17:55:07 +0000 (17:55 +0000)]
[analyzer] Re-enable cplusplus.NewDelete (but not NewDeleteLeaks).

As mentioned in the previous commit message, the use-after-free and
double-free warnings for 'delete' are worth enabling even while the
leak warnings still have false positives.

llvm-svn: 178891