opencl/llvm.git
7 years agoFix a type error that crept into r202313.
Adrian Prantl [Wed, 26 Feb 2014 23:46:39 +0000 (23:46 +0000)]
Fix a type error that crept into r202313.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202317 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoRemove unnecessary llvm:: qualification.
Eric Christopher [Wed, 26 Feb 2014 23:27:16 +0000 (23:27 +0000)]
Remove unnecessary llvm:: qualification.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202316 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoUse regnum regex in an XCore test case.
Andrew Trick [Wed, 26 Feb 2014 23:22:49 +0000 (23:22 +0000)]
Use regnum regex in an XCore test case.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202315 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoDebug info: Refactor AsmPrinter::EmitDwarfRegOp to make the control flow
Adrian Prantl [Wed, 26 Feb 2014 23:03:37 +0000 (23:03 +0000)]
Debug info: Refactor AsmPrinter::EmitDwarfRegOp to make the control flow
more obvious.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202313 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoR600: Remove unnecessary build_vector pattern.
Matt Arsenault [Wed, 26 Feb 2014 23:00:58 +0000 (23:00 +0000)]
R600: Remove unnecessary build_vector pattern.

It is already fully handled in AMDGPUISelDAGToDAG.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202312 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoVery temporarily XFAILing a test. Will be fixed shortly.
Andrew Trick [Wed, 26 Feb 2014 22:39:59 +0000 (22:39 +0000)]
Very temporarily XFAILing a test. Will be fixed shortly.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202310 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoFix broken FileCheck prefixes
Nico Rieck [Wed, 26 Feb 2014 22:29:11 +0000 (22:29 +0000)]
Fix broken FileCheck prefixes

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202308 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoAdd a limit to the heuristic that register allocates instructions in local order.
Andrew Trick [Wed, 26 Feb 2014 22:07:26 +0000 (22:07 +0000)]
Add a limit to the heuristic that register allocates instructions in local order.

This handles pathological cases in which we see 2x increase in spill
code for large blocks (~50k instructions). I don't have a unit test
for this behavior.

Fixes rdar://16072279.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202304 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoUse an install name dir of @executable_path/../lib instead of @rpath.
Rafael Espindola [Wed, 26 Feb 2014 21:51:28 +0000 (21:51 +0000)]
Use an install name dir of @executable_path/../lib instead of @rpath.

Using @executable_path/../lib matches what we have on Makefiles and works
with older versions of OS X too.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202302 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoLower unsigned vsetcc to psubus in certain cases
Quentin Colombet [Wed, 26 Feb 2014 21:39:12 +0000 (21:39 +0000)]
Lower unsigned vsetcc to psubus in certain cases

The current approach to lower a vsetult is to flip the sign bit of the
operands, swap the operands and then use a (signed) pcmpgt.  psubus (unsigned
saturating subtract) can be used to emulate a vsetult more efficiently:

+    case ISD::SETULT: {
+      // If the comparison is against a constant we can turn this into a
+      // setule.  With psubus, setule does not require a swap.  This is
+      // beneficial because the constant in the register is no longer
+      // destructed as the destination so it can be hoisted out of a loop.

I also enable lowering via psubus in a few other cases where it's clearly
beneficial: setule and setuge if minu/maxu cannot be used.

rdar://problem/14338765

Patch by Adam Nemet <anemet@apple.com>.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202301 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoDon't mix the plain and keyword signatures of target_link_libraries.
Rafael Espindola [Wed, 26 Feb 2014 20:39:28 +0000 (20:39 +0000)]
Don't mix the plain and keyword signatures of target_link_libraries.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202299 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoSilencing an MSVC signed comparison warning.
Aaron Ballman [Wed, 26 Feb 2014 20:22:20 +0000 (20:22 +0000)]
Silencing an MSVC signed comparison warning.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202295 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoFix the aggressive anti-dep breaker's subregister definition handling
Hal Finkel [Wed, 26 Feb 2014 20:20:30 +0000 (20:20 +0000)]
Fix the aggressive anti-dep breaker's subregister definition handling

The aggressive anti-dependency breaker scans instructions, bottom-up, within the
scheduling region in order to find opportunities where register renaming can
be used to break anti-dependencies.

Unfortunately, the aggressive anti-dep breaker was treating a register definition
as defining all of that register's aliases (including super registers). This behavior
is incorrect when the super register is live and there are other definitions of
subregisters of the super register.

For example, given the following sequence:

%CR2EQ<def> = CROR %CR3UN, %CR3UN<kill>
%CR2GT<def> = IMPLICIT_DEF
%X4<def> = MFOCRF8 %CR2

the analysis of the first subregister definition would work as expected:
Anti:   %CR2GT<def> = IMPLICIT_DEF
        Def Groups: CR2GT=g194->g0(via CR2)
        Antidep reg: CR2GT (zero group)
        Use Groups:

but the analysis of the second one would not:
Anti:   %CR2EQ<def> = CROR %CR3UN, %CR3UN<kill>
        Def Groups: CR2EQ=g195
        Antidep reg: CR2EQ
        Rename Candidates for Group g195: ...

because, when processing the %CR2GT<def>, we'd mark all super registers of
%CR2GT (%CR2 in this case) as defined. As a result, when processing
%CR2EQ<def>, %CR2 no longer appears to be live, and %CR2EQ<def>'s group is not
%unioned with the %CR2 group.

I don't have an in-tree test case for this yet (and even if I did, I don't have
a small one).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202294 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoGlobalOpt: Apply fastcc to internal x86_thiscallcc functions
Reid Kleckner [Wed, 26 Feb 2014 19:57:30 +0000 (19:57 +0000)]
GlobalOpt: Apply fastcc to internal x86_thiscallcc functions

We should apply fastcc whenever profitable.  We can expand this list,
but there are lots of conventions with performance implications that we
don't want to change.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202293 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoRelax COFF string table check
Nico Rieck [Wed, 26 Feb 2014 19:51:44 +0000 (19:51 +0000)]
Relax COFF string table check

COFF object files with 0 as string table size are currently rejected. This
prevents us from reading object files written by tools like cvtres that
violate the PECOFF spec and write 0 instead of 4 for the size of an empty
string table.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202292 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoFix broken FileCheck prefix
Nico Rieck [Wed, 26 Feb 2014 19:51:08 +0000 (19:51 +0000)]
Fix broken FileCheck prefix

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202291 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoUse the overloaded std::abs rather than C's abs(int) to address Clang's -Wabsolute...
David Blaikie [Wed, 26 Feb 2014 19:12:28 +0000 (19:12 +0000)]
Use the overloaded std::abs rather than C's abs(int) to address Clang's -Wabsolute-value

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202286 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoUse count 0.
Rafael Espindola [Wed, 26 Feb 2014 17:57:35 +0000 (17:57 +0000)]
Use count 0.

Thanks to Roman Divacky for the suggestion.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202283 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoFix typo. Thanks to Roman Divacky for noticing it.
Rafael Espindola [Wed, 26 Feb 2014 17:05:38 +0000 (17:05 +0000)]
Fix typo. Thanks to Roman Divacky for noticing it.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202277 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoCompare DataLayout by Value, not by pointer.
Rafael Espindola [Wed, 26 Feb 2014 17:02:08 +0000 (17:02 +0000)]
Compare DataLayout by Value, not by pointer.

This fixes spurious warnings in llvm-link about the datalayout not matching.

Thanks to Zalman Stern for reporting the bug!

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202276 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoUse a sorted array to store the information about a few address spaces.
Rafael Espindola [Wed, 26 Feb 2014 16:58:35 +0000 (16:58 +0000)]
Use a sorted array to store the information about a few address spaces.

We don't have any test with more than 6 address spaces, so a DenseMap is
probably not the correct answer.

An unsorted array would also be OK, but we have to sort it for printing anyway.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202275 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoMove these functions out of line. A DenseMap lookup is not a simple operation.
Rafael Espindola [Wed, 26 Feb 2014 16:49:40 +0000 (16:49 +0000)]
Move these functions out of line. A DenseMap lookup is not a simple operation.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202274 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoFix PR18165: LSR must avoid scaling factors that exceed the limit on truncated use.
Andrew Trick [Wed, 26 Feb 2014 16:31:56 +0000 (16:31 +0000)]
Fix PR18165: LSR must avoid scaling factors that exceed the limit on truncated use.

Patch by Michael Zolotukhin!

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202273 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agollvm-symbolizer: use dynamic symbol table if the regular one is stripped.
Alexey Samsonov [Wed, 26 Feb 2014 13:10:01 +0000 (13:10 +0000)]
llvm-symbolizer: use dynamic symbol table if the regular one is stripped.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202265 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoMove getELFDynamicSymbolIterators to a public header.
Alexey Samsonov [Wed, 26 Feb 2014 12:51:19 +0000 (12:51 +0000)]
Move getELFDynamicSymbolIterators to a public header.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202264 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[CMake] BUILD_SHARED_LIBS: Fixup for r202261: Give PULIC to system_libs in LLVMSupport.
NAKAMURA Takumi [Wed, 26 Feb 2014 12:18:55 +0000 (12:18 +0000)]
[CMake] BUILD_SHARED_LIBS: Fixup for r202261: Give PULIC to system_libs in LLVMSupport.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202263 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoEnsure bitcode encoding of instructions and their operands stays stable.
Michael Kuperstein [Wed, 26 Feb 2014 12:06:36 +0000 (12:06 +0000)]
Ensure bitcode encoding of instructions and their operands stays stable.
This includes instructions with aggregate operands (insert/extract), instructions with vector operands (insert/extract/shuffle), binary arithmetic and bitwise instructions, conversion instructions and terminators.

Work was done by lama.saba@intel.com.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202262 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[CMake] Work around to use target_link_libraries(PUBLIC) in BUILD_SHARED_LIBS mode.
NAKAMURA Takumi [Wed, 26 Feb 2014 11:58:11 +0000 (11:58 +0000)]
[CMake] Work around to use target_link_libraries(PUBLIC) in BUILD_SHARED_LIBS mode.

FIXME: It may be PRIVATE since SO knows its dependent libs.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202261 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[CMake] Move LLVMBUILD_LIB_DEPS stuff from add_llvm_library (and LLVm-Config) to...
NAKAMURA Takumi [Wed, 26 Feb 2014 11:58:01 +0000 (11:58 +0000)]
[CMake] Move LLVMBUILD_LIB_DEPS stuff from add_llvm_library (and LLVm-Config) to llvm_add_library to centralize target_link_libraries.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202260 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoAArch64: simplify tbl/tbx polymorphism
Tim Northover [Wed, 26 Feb 2014 11:55:09 +0000 (11:55 +0000)]
AArch64: simplify tbl/tbx polymorphism

The table argument is always 128-bit (and interpreted as <16 x i8>) so the
extra specifier for it is just clutter.

No user-visible behaviour change, so no tests.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202258 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoARMv8 IfConversion must skip narrow instructions that a) define CPSR and b) wouldn...
Artyom Skrobov [Wed, 26 Feb 2014 11:27:28 +0000 (11:27 +0000)]
ARMv8 IfConversion must skip narrow instructions that a) define CPSR and b) wouldn't affect CPSR in an IT block

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202257 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoStop test/CodeGen/ARM/a15.ll targetting non-ARM targets.
Daniel Sanders [Wed, 26 Feb 2014 11:26:18 +0000 (11:26 +0000)]
Stop test/CodeGen/ARM/a15.ll targetting non-ARM targets.

Summary:
Fixes an issue where a test attempts to use -mcpu=cortex-a15 on non-ARM targets.
This triggers an assertion on MIPS since it doesn't know what ABI to use by default for
unrecognized processors.

Reviewers: rengolin

Reviewed By: rengolin

CC: llvm-commits, aemerson, rengolin
Differential Revision: http://llvm-reviews.chandlerc.com/D2876

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202256 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[mips] Treat -mcpu=generic the same way as an empty CPU string.
Daniel Sanders [Wed, 26 Feb 2014 10:20:15 +0000 (10:20 +0000)]
[mips] Treat -mcpu=generic the same way as an empty CPU string.

Summary:
This should fix the MCJIT unit tests that were broken by r201792 on the MIPS buildbot.
MIPS currently uses the default implementation of sys::getHostCPUName() which
always returns "generic". For now, we will accept "generic" and coerce it to
"mips32" or "mips64" depending on the target architecture like we do for empty
CPU names.

Reviewers: jacksprat, matheusalmeida

Reviewed By: jacksprat

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202253 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[SROA] Use the correct index integer size in GEPs through non-default
Chandler Carruth [Wed, 26 Feb 2014 10:08:16 +0000 (10:08 +0000)]
[SROA] Use the correct index integer size in GEPs through non-default
address spaces.

This isn't really a correctness issue (the values are truncated) but its
much cleaner.

Patch by Matt Arsenault!

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202252 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoAdd two helpers to IRBuilder to flesh the interface out to N-width
Chandler Carruth [Wed, 26 Feb 2014 10:08:11 +0000 (10:08 +0000)]
Add two helpers to IRBuilder to flesh the interface out to N-width
integers. Complements the interfaces it is wrapping.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202251 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[SROA] Teach SROA how to handle pointers from address spaces other than
Chandler Carruth [Wed, 26 Feb 2014 08:25:02 +0000 (08:25 +0000)]
[SROA] Teach SROA how to handle pointers from address spaces other than
the default.

Based on the patch by Matt Arsenault, D1764!

I switched one place to use the more direct pointer type to compute the
desired address space, and I reworked the memcpy rewriting section to
reflect significant refactorings that this patch helped inspire.

Thanks to several of the folks who helped review and improve the patch
as well.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202247 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[SROA] Split the alignment computation complete for the memcpy rewriting
Chandler Carruth [Wed, 26 Feb 2014 07:29:54 +0000 (07:29 +0000)]
[SROA] Split the alignment computation complete for the memcpy rewriting
to work independently for the slice side and the other side.

This allows us to only compute the minimum of the two when we actually
rewrite to a memcpy that needs to take the minimum, and preserve higher
alignment for one side or the other when rewriting to loads and stores.

This fix was inspired by seeing the result of some refactoring that
makes addrspace handling better.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202242 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[CMake] Use target_link_libraries(INTERFACE|PRIVATE) on CMake-2.8.12 to increase...
NAKAMURA Takumi [Wed, 26 Feb 2014 06:53:16 +0000 (06:53 +0000)]
[CMake] Use target_link_libraries(INTERFACE|PRIVATE) on CMake-2.8.12 to increase opportunity for parallel build.

target_link_libraries(INTERFACE) doesn't bring inter-target dependencies in add_library,
although final targets have dependencies to whole dependent libraries.
It makes most libraries can be built in parallel.

target_link_libraries(PRIVATE) is used to shaared library.
Each dependent library is linked to the target.so, and its user will not see its grandchildren.
For example,

  - libclang.so has sufficient libclang*.a(s).
  - c-index-test requires just only libclang.so.

FIXME: lld is tweaked minimally. Adding INTERFACE in each library would be better thing.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202241 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[x86] Add same itinerary to SYSEXIT64 as SYSEXIT for consistency.
Craig Topper [Wed, 26 Feb 2014 06:50:27 +0000 (06:50 +0000)]
[x86] Add same itinerary to SYSEXIT64 as SYSEXIT for consistency.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202240 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[CMake] Introduce cmake_policy(CMP0022) for target_link_libraries(INTERFACE|PRIVATE).
NAKAMURA Takumi [Wed, 26 Feb 2014 06:45:11 +0000 (06:45 +0000)]
[CMake] Introduce cmake_policy(CMP0022) for target_link_libraries(INTERFACE|PRIVATE).

For now, use both keywords, INTERFACE and PRIVATE via the variable,
  - ${cmake_2_8_12_INTERFACE}
  - ${cmake_2_8_12_PRIVATE}

They could be cleaned up when we introduce 2.8.12.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202239 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[CMake] Use LINK_LIBS instead of target_link_libraries().
NAKAMURA Takumi [Wed, 26 Feb 2014 06:41:29 +0000 (06:41 +0000)]
[CMake] Use LINK_LIBS instead of target_link_libraries().

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202238 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[x86] Remove some unused instruction format classes.
Craig Topper [Wed, 26 Feb 2014 06:06:38 +0000 (06:06 +0000)]
[x86] Remove some unused instruction format classes.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202234 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[x86] Simplify disassembler code slightly.
Craig Topper [Wed, 26 Feb 2014 06:01:21 +0000 (06:01 +0000)]
[x86] Simplify disassembler code slightly.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202233 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[SROA] The original refactoring inspired by the addrspace patch in
Chandler Carruth [Wed, 26 Feb 2014 05:33:36 +0000 (05:33 +0000)]
[SROA] The original refactoring inspired by the addrspace patch in
D1764, which in turn set off the other refactorings to make
'getSliceAlign()' a sensible thing.

There are two possible inputs to the required alignment of a memory
transfer intrinsic: the alignment constraints of the source and the
destination. If we are *only* introducing a (potentially new) offset
onto one side of the transfer, we don't need to consider the alignment
constraints of the other side. Use this to simplify the logic feeding
into alignment computation for unsplit transfers.

Also, hoist the clamp of the magical zero alignment for these intrinsics
to the more customary one alignment early. This lets several other
conditions melt away.

No functionality changed. There is a further improvement this exposes
which *will* change functionality, but that's arriving in a separate
patch.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202232 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[SROA] Yet another slight refactoring that simplifies an API in the
Chandler Carruth [Wed, 26 Feb 2014 05:12:43 +0000 (05:12 +0000)]
[SROA] Yet another slight refactoring that simplifies an API in the
rewriting logic: don't pass custom offsets for the adjusted pointer to
the new alloca.

We always passed NewBeginOffset here. Sometimes we spelled it
BeginOffset, but only when they were in fact equal. Whats worse, the API
is set up so that you can't reasonably call it with anything else -- it
assumes that you're passing it an offset relative to the *original*
alloca that happens to fall within the new one. That's the whole point
of NewBeginOffset, it's the clamped beginning offset.

No functionality changed.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202231 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[SROA] Simplify the computing of alignment: we only ever need the
Chandler Carruth [Wed, 26 Feb 2014 05:02:19 +0000 (05:02 +0000)]
[SROA] Simplify the computing of alignment: we only ever need the
alignment of the slice being rewritten, not any arbitrary offset.

Every caller is really just trying to compute the alignment for the
whole slice, never for some arbitrary alignment. They are also just
passing a type when they have one to see if we can skip an explicit
alignment in the IR by using the type's alignment. This makes for a much
simpler interface.

Another refactoring inspired by the addrspace patch for SROA, although
only loosely related.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202230 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[SROA] Use NewOffsetBegin in the unsplit case for memset merely for
Chandler Carruth [Wed, 26 Feb 2014 04:45:24 +0000 (04:45 +0000)]
[SROA] Use NewOffsetBegin in the unsplit case for memset merely for
consistency with memcpy rewriting, and fix a latent bug in the alignment
management for memset.

The alignment issue is that getAdjustedAllocaPtr is computing the
*relative* offset into the new alloca, but the alignment isn't being set
to the relative offset, it was using the the absolute offset which is
into the old alloca.

I don't think its possible to write a test case that actually reaches
this code where the resulting alignment would be observably different,
but the intent was clearly to use the relative offset within the new
alloca.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202229 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[SROA] Use the members for New{Begin,End}Offset in the rewrite helpers
Chandler Carruth [Wed, 26 Feb 2014 04:25:04 +0000 (04:25 +0000)]
[SROA] Use the members for New{Begin,End}Offset in the rewrite helpers
rather than passing them as arguments.

While I generally prefer actual arguments, in this case the readability
loss is substantial. By using members we avoid repeatedly calculating
the offsets, and once we're using members it is useful to ensure that
those names *always* refer to the original-alloca-relative new offset
for a rewritten slice.

No functionality changed. Follow-up refactoring, all toward getting the
address space patch merged.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202228 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[SROA] Compute the New{Begin,End}Offset values once for each alloca
Chandler Carruth [Wed, 26 Feb 2014 04:20:00 +0000 (04:20 +0000)]
[SROA] Compute the New{Begin,End}Offset values once for each alloca
slice being rewritten.

We had the same code scattered across most of the visits. Instead,
compute the new offsets and the slice size once when we start to visit
a particular slice, and use the member variables from then on. This
reduces quite a bit of code duplication.

No functionality changed. Refactoring inspired to make it easier to
apply the address space patch to SROA.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202227 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoUse StringRef in raw_fd_ostream constructor
Ben Langmuir [Wed, 26 Feb 2014 03:21:00 +0000 (03:21 +0000)]
Use StringRef in raw_fd_ostream constructor

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202225 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[SROA] Fix PR18615 with some long overdue simplifications to the bounds
Chandler Carruth [Wed, 26 Feb 2014 03:14:14 +0000 (03:14 +0000)]
[SROA] Fix PR18615 with some long overdue simplifications to the bounds
checking in SROA.

The primary change is to just rely on uge for checking that the offset
is within the allocation size. This removes the explicit checks against
isNegative which were terribly error prone (including the reversed logic
that led to PR18615) and prevented us from supporting stack allocations
larger than half the address space.... Ok, so maybe the latter isn't
*common* but it's a silly restriction to have.

Also, we used to try to support a PHI node which loaded from before the
start of the allocation if any of the loaded bytes were within the
allocation. This doesn't make any sense, we have never really supported
loading or storing *before* the allocation starts. The simplified logic
just doesn't care.

We continue to allow loading past the end of the allocation in part to
support cases where there is a PHI and some loads are larger than others
and the larger ones reach past the end of the allocation. We could solve
this a different and more conservative way, but I'm still somewhat
paranoid about this.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202224 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoRemove spurious emacs major mode marker, these should only go on .h files.
Nick Lewycky [Wed, 26 Feb 2014 03:10:45 +0000 (03:10 +0000)]
Remove spurious emacs major mode marker, these should only go on .h files.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202222 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago80-col.
Eric Christopher [Wed, 26 Feb 2014 02:53:18 +0000 (02:53 +0000)]
80-col.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202221 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoFormatting fixups.
Eric Christopher [Wed, 26 Feb 2014 02:50:56 +0000 (02:50 +0000)]
Formatting fixups.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202220 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoDelete two declared overloads of CallInst::CallInst that are never defined or used...
Nick Lewycky [Wed, 26 Feb 2014 02:39:43 +0000 (02:39 +0000)]
Delete two declared overloads of CallInst::CallInst that are never defined or used. No functionality change.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202218 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoConstify the Optnone checks in IR passes.
Paul Robinson [Wed, 26 Feb 2014 01:23:26 +0000 (01:23 +0000)]
Constify the Optnone checks in IR passes.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202213 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoSimplify base64 routine a bit.
Rui Ueyama [Tue, 25 Feb 2014 23:49:11 +0000 (23:49 +0000)]
Simplify base64 routine a bit.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202210 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoException handling docs: Describe landingpad clauses' meanings in more detail
Mark Seaborn [Tue, 25 Feb 2014 23:48:59 +0000 (23:48 +0000)]
Exception handling docs: Describe landingpad clauses' meanings in more detail

The original text is very terse, so I've expanded on it.

Specifically, in the original text:

 * "The selector value is a positive number if the exception matched a
   type info" -- It wasn't clear that this meant "if the exception
   matched a 'catch' clause".

 * "If nothing is matched, the behavior of the program is
   `undefined`_."  -- It's actually implementation-defined in C++
   rather than undefined, as the new text explains.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202209 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoAdd DIUnspecifiedParameter, so we can pretty-print it.
Adrian Prantl [Tue, 25 Feb 2014 23:42:11 +0000 (23:42 +0000)]
Add DIUnspecifiedParameter, so we can pretty-print it.
This will be used for testcases in CFE.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202207 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agofix crash in SmallDenseMap copy constructor
Duncan P. N. Exon Smith [Tue, 25 Feb 2014 23:35:13 +0000 (23:35 +0000)]
fix crash in SmallDenseMap copy constructor

Prevent a crash in the SmallDenseMap copy constructor whenever the other
map is not in small mode.

<rdar://problem/14292693>

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202206 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoUse DataLayout from the module when easily available.
Rafael Espindola [Tue, 25 Feb 2014 23:25:17 +0000 (23:25 +0000)]
Use DataLayout from the module when easily available.

Eventually DataLayoutPass should go away, but for now that is the only easy
way to get a DataLayout in some APIs. This patch only changes the ones that
have easy access to a Module.

One interesting issue with sometimes using DataLayoutPass and sometimes
fetching it from the Module is that we have to make sure they are equivalent.
We can get most of the way there by always constructing the pass with a Module.
In fact, the pass could be changed to point to an external DataLayout instead
of owning one to make this stricter.

Unfortunately, the C api passes a DataLayout, so it has to be up to the caller
to make sure the pass and the module are in sync.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202204 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoAttempt to unbreak an MSVC buildbot by switching to %llc_dwarf.
Adrian Prantl [Tue, 25 Feb 2014 23:03:00 +0000 (23:03 +0000)]
Attempt to unbreak an MSVC buildbot by switching to %llc_dwarf.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202202 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoDwarfDebug: Avoid emitting an empty debug_aranges section when aranges are disabled
David Blaikie [Tue, 25 Feb 2014 22:46:44 +0000 (22:46 +0000)]
DwarfDebug: Avoid emitting an empty debug_aranges section when aranges are disabled

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202201 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoAddress review comments for r202188.
Adrian Prantl [Tue, 25 Feb 2014 22:27:14 +0000 (22:27 +0000)]
Address review comments for r202188.
This is refactoring / simplifying code, updating comments and enabling the
testcase on non-x86 platforms.

No functionality change.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202199 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoFix resetting the DataLayout in a Module.
Rafael Espindola [Tue, 25 Feb 2014 22:23:04 +0000 (22:23 +0000)]
Fix resetting the DataLayout in a Module.

No tool does this currently, but as everything else in a module we should be
able to change its DataLayout.

Most of the fix is in DataLayout to make sure it can be reset properly.

The test uses Module::setDataLayout since the fact that we mutate a DataLayout
is an implementation detail. The module could hold a OwningPtr<DataLayout> and
the DataLayout itself could be immutable.

Thanks to Philip Reames for pushing me in the right direction.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202198 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[reassociate] Switch two std::sort calls into std::stable_sort calls as
Chandler Carruth [Tue, 25 Feb 2014 21:54:50 +0000 (21:54 +0000)]
[reassociate] Switch two std::sort calls into std::stable_sort calls as
their inputs come from std::stable_sort and they are not total orders.

I'm not a huge fan of this, but the really bad std::stable_sort is right
at the beginning of Reassociate. After we commit to stable-sort based
consistent respect of source order, the downstream sorts shouldn't undo
that unless they have a total order or they are used in an
order-insensitive way. Neither appears to be true for these cases.
I don't have particularly good test cases, but this jumped out by
inspection when looking for output instability in this pass due to
changes in the ordering of std::sort.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202196 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoR600: Don't unconditionally unroll loops with private memory accesses
Tom Stellard [Tue, 25 Feb 2014 21:36:21 +0000 (21:36 +0000)]
R600: Don't unconditionally unroll loops with private memory accesses

This causes the size of the scrypt kernel to explode and eats all the
memory on some systems.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202195 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoR600/SI: Custom select 64-bit ADD
Tom Stellard [Tue, 25 Feb 2014 21:36:18 +0000 (21:36 +0000)]
R600/SI: Custom select 64-bit ADD

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202194 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[SROA] Add an off-by-default *strict* inbounds check to SROA. I had SROA
Chandler Carruth [Tue, 25 Feb 2014 21:24:45 +0000 (21:24 +0000)]
[SROA] Add an off-by-default *strict* inbounds check to SROA. I had SROA
implemented this way a long time ago and due to the overwhelming bugs
that surfaced, moved to a much more relaxed variant. Richard Smith would
like to understand the magnitude of this problem and it seems fairly
harmless to keep some flag-controlled logic to get the extremely strict
behavior here. I'll remove it if it doesn't prove useful.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202193 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoAccount for 128-bit integer operations in PPCCTRLoops
Hal Finkel [Tue, 25 Feb 2014 20:51:50 +0000 (20:51 +0000)]
Account for 128-bit integer operations in PPCCTRLoops

We need to abort the formation of counter-register-based loops where there are
128-bit integer operations that might become function calls.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202192 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoDon't try to set a dummy DataLayout. It is parsed now.
Rafael Espindola [Tue, 25 Feb 2014 20:41:28 +0000 (20:41 +0000)]
Don't try to set a dummy DataLayout. It is parsed now.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202191 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoStore a DataLayout in Module.
Rafael Espindola [Tue, 25 Feb 2014 20:01:08 +0000 (20:01 +0000)]
Store a DataLayout in Module.

Now that DataLayout is not a pass, store one in Module.

Since the C API expects to be able to get a char* to the datalayout description,
we have to keep a std::string somewhere. This patch keeps it in Module and also
uses it to represent modules without a DataLayout.

Once DataLayout is mandatory, we should probably move the string to DataLayout
itself since it won't be necessary anymore to represent the special case of a
module without a DataLayout.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202190 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoDebug info: Support variadic functions.
Adrian Prantl [Tue, 25 Feb 2014 19:57:42 +0000 (19:57 +0000)]
Debug info: Support variadic functions.
Variadic functions have an unspecified parameter tag after the last
argument. In IR this is represented as an unspecified parameter in the
subroutine type.

Paired commit with CFE r202185.

rdar://problem/13690847

This re-applies r202184 + a bugfix in DwarfDebug's argument handling.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202188 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoRevert "Debug info: Support variadic functions."
Adrian Prantl [Tue, 25 Feb 2014 19:48:36 +0000 (19:48 +0000)]
Revert "Debug info: Support variadic functions."

This reverts commit r202184 because of buildbot breakage.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202187 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoRemove outdated comments.
Manman Ren [Tue, 25 Feb 2014 19:47:15 +0000 (19:47 +0000)]
Remove outdated comments.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202186 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoDebug info: Support variadic functions.
Adrian Prantl [Tue, 25 Feb 2014 19:38:07 +0000 (19:38 +0000)]
Debug info: Support variadic functions.
Variadic functions have an unspecified parameter tag after the last
argument. In IR this is represented as an unspecified parameter in the
subroutine type.

Paired commit with CFE.

rdar://problem/13690847

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202184 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[XCore] Add intrinsic for CLRPT (clear port time) instruction.
Richard Osborne [Tue, 25 Feb 2014 17:31:15 +0000 (17:31 +0000)]
[XCore] Add intrinsic for CLRPT (clear port time) instruction.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202172 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[XCore] Add intrinsic for EDU (event disable unconditional) instruction.
Richard Osborne [Tue, 25 Feb 2014 17:31:06 +0000 (17:31 +0000)]
[XCore] Add intrinsic for EDU (event disable unconditional) instruction.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202171 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoMake DataLayout a plain object, not a pass.
Rafael Espindola [Tue, 25 Feb 2014 17:30:31 +0000 (17:30 +0000)]
Make DataLayout a plain object, not a pass.

Instead, have a DataLayoutPass that holds one. This will allow parts of LLVM
don't don't handle passes to also use DataLayout.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202168 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoKeep the link register for uwtable.
Logan Chien [Tue, 25 Feb 2014 16:57:28 +0000 (16:57 +0000)]
Keep the link register for uwtable.

The function with uwtable attribute might be visited by the
stack unwinder, thus the link register should be considered
as clobbered after the execution of the branch and link
instruction (i.e. the definition of the machine instruction
can't be ignored) even when the callee function are marked
with noreturn.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202165 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[XCore] Prefer to word align functions.
Richard Osborne [Tue, 25 Feb 2014 16:37:15 +0000 (16:37 +0000)]
[XCore] Prefer to word align functions.

The behaviour of the XCore's instruction buffer means that the performance
of the same code sequence can differ depending on whether it starts at a 4
byte aligned address or not. Since we don't model the instruction buffer
in the backend we have no way of knowing for sure if it is beneficial to
word align a specific function. However, in the absence of precise
modelling, it is better on balance to word align functions because:

* It makes a fetch-nop while executing the prologue slightly less likely.
* If we don't word align functions then a small perturbation in one
  function can have a dramatic knock on effect. If the size of the function
  changes it might change the alignment and therefore the performance of
  all the functions that happen to follow it in the binary. This butterfly
  effect makes it harder to reason about and measure the performance of
  code.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202163 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoFactor out calls to AA.getDataLayout().
Rafael Espindola [Tue, 25 Feb 2014 15:52:19 +0000 (15:52 +0000)]
Factor out calls to AA.getDataLayout().

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202157 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoMake a few more DataLayout variables const.
Rafael Espindola [Tue, 25 Feb 2014 14:24:11 +0000 (14:24 +0000)]
Make a few more DataLayout variables const.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202155 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[SROA] Use the original load name with the SROA-prefixed IRB rather than
Chandler Carruth [Tue, 25 Feb 2014 11:21:48 +0000 (11:21 +0000)]
[SROA] Use the original load name with the SROA-prefixed IRB rather than
just "load". This helps avoid pointless de-duping with order-sensitive
numbers as we already have unique names from the original load. It also
makes the resulting IR quite a bit easier to read.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202140 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[SROA] Thread the ability to add a pointer-specific name prefix through
Chandler Carruth [Tue, 25 Feb 2014 11:19:56 +0000 (11:19 +0000)]
[SROA] Thread the ability to add a pointer-specific name prefix through
the pointer adjustment code. This is the primary code path that creates
totally new instructions in SROA and being able to lump them based on
the pointer value's name for which they were created causes
*significantly* fewer name collisions and general noise in the debug
output. This is particularly significant because it is making it much
harder to track down instability in the output of SROA, as name
de-duplication is a totally harmless form of instability that gets in
the way of seeing real problems.

The new fancy naming scheme tries to dig out the root "pre-SROA" name
for pointer values and associate that all the way through the pointer
formation instructions. Digging out the root is important to prevent the
multiple iterative rounds of SROA from just layering too much cruft on
top of cruft here. We already track the layers of SROAs iteration in the
alloca name prefix. We don't need to duplicate it here.

Should have no functionality change, and shouldn't have any really
measurable impact on NDEBUG builds, as most of the complex logic is
debug-only.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202139 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[SROA] Rather than copying the logic for building a name prefix into the
Chandler Carruth [Tue, 25 Feb 2014 11:12:04 +0000 (11:12 +0000)]
[SROA] Rather than copying the logic for building a name prefix into the
PHI-pointer builder, just copy the builder and clobber the obvious
fields.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202136 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[SROA] Simplify some of the logic to dig out the old pointer value by
Chandler Carruth [Tue, 25 Feb 2014 11:08:02 +0000 (11:08 +0000)]
[SROA] Simplify some of the logic to dig out the old pointer value by
using OldPtr more heavily. Lots of this code was written before the
rewriter had an OldPtr member setup ahead of time. There are already
asserts in place that should ensure this doesn't change any
functionality.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202135 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[SROA] Adjust to new clang-format style.
Chandler Carruth [Tue, 25 Feb 2014 11:07:58 +0000 (11:07 +0000)]
[SROA] Adjust to new clang-format style.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202134 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoReuse constants for COFF string table entry offsets
Nico Rieck [Tue, 25 Feb 2014 09:50:40 +0000 (09:50 +0000)]
Reuse constants for COFF string table entry offsets

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202130 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[SROA] Fix a *glaring* bug in r202091: you have to actually *write*
Chandler Carruth [Tue, 25 Feb 2014 09:45:27 +0000 (09:45 +0000)]
[SROA] Fix a *glaring* bug in r202091: you have to actually *write*
the break statement, not just think it to yourself....

No idea how this worked at all, much less survived most bots, my
bootstrap, and some bot bootstraps!

The Polly one didn't survive, and this was filed as PR18959. I don't
have a reduced test case and honestly I'm not seeing the need. What we
probably need here are better asserts / debug-build behavior in
SmallPtrSet so that this madness doesn't make it so far.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202129 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoDisable old JIT unittests for AARch64
Renato Golin [Tue, 25 Feb 2014 09:31:05 +0000 (09:31 +0000)]
Disable old JIT unittests for AARch64

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202127 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoIgnore old JIT tests in AARch64 - CMake style
Renato Golin [Tue, 25 Feb 2014 09:31:00 +0000 (09:31 +0000)]
Ignore old JIT tests in AARch64 - CMake style

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202126 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoAdd aarch64 to config.guess
Renato Golin [Tue, 25 Feb 2014 09:30:54 +0000 (09:30 +0000)]
Add aarch64 to config.guess

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202125 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoSilence GCC warning
Alexey Samsonov [Tue, 25 Feb 2014 07:56:00 +0000 (07:56 +0000)]
Silence GCC warning

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202119 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoFix typos
Alp Toker [Tue, 25 Feb 2014 04:21:15 +0000 (04:21 +0000)]
Fix typos

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202107 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[SROA] Add a debugging tool which shuffles the slices sequence prior to
Chandler Carruth [Tue, 25 Feb 2014 03:59:29 +0000 (03:59 +0000)]
[SROA] Add a debugging tool which shuffles the slices sequence prior to
sorting it. This helps uncover latent reliance on the original ordering
which aren't guaranteed to be preserved by std::sort (but often are),
and which are based on the use-def chain orderings which also aren't
(technically) guaranteed.

Only available in C++11 debug builds, and behind a flag to prevent noise
at the moment, but this is generally useful so figured I'd put it in the
tree rather than keeping it out-of-tree.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202106 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[SROA] Use a more direct way of determining whether we are processing
Chandler Carruth [Tue, 25 Feb 2014 03:50:14 +0000 (03:50 +0000)]
[SROA] Use a more direct way of determining whether we are processing
the destination operand or source operand of a memmove.

It so happens that it was impossible for SROA to try to rewrite
self-memmove where the operands are *identical*, because either such
a think is volatile (and we don't rewrite) or it is non-volatile, and we
don't even register it as a use of the alloca.

However, making the 'IsDest' test *rely* on this subtle fact is... Very
confusing for the reader. We should use the direct and readily available
test of the Use* which gives us concrete information about which operand
is being rewritten.

No functionality changed, I hope! ;]

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202103 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoAdd some convenience accessors for the underlying Use of an operand.
Chandler Carruth [Tue, 25 Feb 2014 03:34:17 +0000 (03:34 +0000)]
Add some convenience accessors for the underlying Use of an operand.
These complement many of the existing accessors and make it
significantly easier to write code which needs to poke at the underlying
Use without hard coding the operand number at which it resides for
a particular instruction. No functionality changed of course.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202102 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoIndent this continued line.
Nick Lewycky [Tue, 25 Feb 2014 00:43:21 +0000 (00:43 +0000)]
Indent this continued line.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202096 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[SROA] Fix another instability in SROA with respect to the slice
Chandler Carruth [Tue, 25 Feb 2014 00:07:09 +0000 (00:07 +0000)]
[SROA] Fix another instability in SROA with respect to the slice
ordering.

The fundamental problem that we're hitting here is that the use-def
chain ordering is *itself* not a stable thing to be relying on in the
rewriting for SROA. Further, we use a non-stable sort over the slices to
arrange them based on the section of the alloca they're operating on.
With a debugging STL implementation (or different implementations in
stage2 and stage3) this can cause stage2 != stage3.

The specific aspect of this problem fixed in this commit deals with the
rewriting and load-speculation around PHIs and Selects. This, like many
other aspects of the use-rewriting in SROA, is really part of the
"strong SSA-formation" that is doen by SROA where it works very hard to
canonicalize loads and stores in *just* the right way to satisfy the
needs of mem2reg[1]. When we have a select (or a PHI) with 2 uses of the
same alloca, we test that loads downstream of the select are
speculatable around it twice. If only one of the operands to the select
needs to be rewritten, then if we get lucky we rewrite that one first
and the select is immediately speculatable. This can cause the order of
operand visitation, and thus the order of slices to be rewritten, to
change an alloca from promotable to non-promotable and vice versa.

The fix is to defer all of the speculation until *after* the rewrite
phase is done. Once we've rewritten everything, we can accurately test
for whether speculation will work (once, instead of twice!) and the
order ceases to matter.

This also happens to simplify the other subtlety of speculation -- we
need to *not* speculate anything unless the result of speculating will
make the alloca fully promotable by mem2reg. I had a previous attempt at
simplifying this, but it was still pretty horrible.

There is actually already a *really* nice test case for this in
basictest.ll, but on multiple STL implementations and inputs, we just
got "lucky". Fortunately, the test case is very small and we can
essentially build it in exactly the opposite way to get reasonable
coverage in both directions even from normal STL implementations.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202092 91177308-0d34-0410-b5e6-96231b3b80d8