oota-llvm.git
11 years ago[mips] Use "foreach" loop to make register definitions more concise.
Akira Hatanaka [Wed, 17 Jul 2013 19:09:27 +0000 (19:09 +0000)]
[mips] Use "foreach" loop to make register definitions more concise.

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

11 years agoAdd -*- C++ -*- to InstrEmitter.h.
Michael Gottesman [Wed, 17 Jul 2013 18:53:29 +0000 (18:53 +0000)]
Add -*- C++ -*- to InstrEmitter.h.

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

11 years agoOptParser.td: typo
Hans Wennborg [Wed, 17 Jul 2013 16:26:38 +0000 (16:26 +0000)]
OptParser.td: typo

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

11 years agoThis patch checks for valid mnemonics at the beginning of parseInstruction method...
Vladimir Medic [Wed, 17 Jul 2013 15:00:42 +0000 (15:00 +0000)]
This patch checks for valid mnemonics at the beginning of parseInstruction method, thus giving the user the right error message for non-existing instructions.

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

11 years agoSplit openFileForRead into Windows and Unix versions.
Rafael Espindola [Wed, 17 Jul 2013 14:58:25 +0000 (14:58 +0000)]
Split openFileForRead into Windows and Unix versions.

This has some advantages:

* Lets us use native, utf16 windows functions.
* Easy to produce good errors on windows about trying to use a
directory when we want a file.
* Simplifies the unix version a bit.

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

11 years agoFix comparisons of alloca alignment in inliner merging
Hal Finkel [Wed, 17 Jul 2013 14:32:41 +0000 (14:32 +0000)]
Fix comparisons of alloca alignment in inliner merging

Duncan pointed out a mistake in my fix in r186425 when only one of the allocas
being compared had the target-default alignment. This is essentially his
suggested solution. Thanks!

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

11 years agoImplement eret and deret(return from exception) instructions for Mips. Test examples...
Vladimir Medic [Wed, 17 Jul 2013 14:05:19 +0000 (14:05 +0000)]
Implement eret and deret(return from exception) instructions for Mips. Test examples are given.

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

11 years agoAdd the tests that I forgot to 'svn add' with my previous commit (r186504).
Joey Gouly [Wed, 17 Jul 2013 14:03:49 +0000 (14:03 +0000)]
Add the tests that I forgot to 'svn add' with my previous commit (r186504).

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

11 years ago[ARMv8] Add support for the NEON instructions vmaxnm/vminnm.
Joey Gouly [Wed, 17 Jul 2013 13:59:38 +0000 (13:59 +0000)]
[ARMv8] Add support for the NEON instructions vmaxnm/vminnm.

This adds a new class for non-predicable NEON instructions and a
new DecoderNamespace for v8 NEON instructions.

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

11 years agollvm-ar: doExtract(): Write extracted files with F_Binary. It should fix llvm/test...
NAKAMURA Takumi [Wed, 17 Jul 2013 12:31:50 +0000 (12:31 +0000)]
llvm-ar: doExtract(): Write extracted files with F_Binary. It should fix llvm/test/Object/extract.ll

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

11 years agoEnsure sys::getProcessTriple always uses a normalized triple. Patch by
Duncan Sands [Wed, 17 Jul 2013 11:01:05 +0000 (11:01 +0000)]
Ensure sys::getProcessTriple always uses a normalized triple.  Patch by
Thomas B. Jablin, from PR16636.

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

11 years ago[XCore] Ensure implicit operands aren't lost on the return instruction.
Richard Osborne [Wed, 17 Jul 2013 10:58:37 +0000 (10:58 +0000)]
[XCore] Ensure implicit operands aren't lost on the return instruction.

Patch by Robert Lytton.

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

11 years agoTweak the cmake interaction between CMAKE_BUILD_TYPE and LLVM_ENABLE_ASSERTIONS.
Duncan Sands [Wed, 17 Jul 2013 09:34:51 +0000 (09:34 +0000)]
Tweak the cmake interaction between CMAKE_BUILD_TYPE and LLVM_ENABLE_ASSERTIONS.
The issue is that CMAKE_BUILD_TYPE=RelWithDebInfo LLVM_ENABLE_ASSERTIONS=ON was
not building with assertions enabled.  (I was unable to find what in the LLVM
source tree was adding -DNDEBUG to the build line in this case, so decided that
it must be cmake itself that was adding it - this may depend on the cmake
version).  The fix treats any mode that is not Debug as being the same as
Release for this purpose (previously it was being assumed that cmake would only
add -DNDEBUG for Release and not for RelWithDebInfo or MinSizeRel).  If other
versions of cmake don't add -DNDEBUG for RelWithDebInfo then that's OK: with
this change you just get a useless but harmless -UNDEBUG or -DNDEBUG.

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

11 years agoTeach x86 fast-isel to use AVX opcodes for vector stores when AVX is enabled.
Craig Topper [Wed, 17 Jul 2013 06:58:23 +0000 (06:58 +0000)]
Teach x86 fast-isel to use AVX opcodes for vector stores when AVX is enabled.

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

11 years agoLLVMSymbolize.cpp: Fix build. Triple::ArchType is not a namespace.
NAKAMURA Takumi [Wed, 17 Jul 2013 06:53:51 +0000 (06:53 +0000)]
LLVMSymbolize.cpp: Fix build. Triple::ArchType is not a namespace.

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

11 years agollvm-symbolizer: be more careful with colons in file names
Alexey Samsonov [Wed, 17 Jul 2013 06:45:36 +0000 (06:45 +0000)]
llvm-symbolizer: be more careful with colons in file names

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

11 years agoMake x86 fast-isel correctly choose between aligned and unaligned operations for...
Craig Topper [Wed, 17 Jul 2013 05:57:45 +0000 (05:57 +0000)]
Make x86 fast-isel correctly choose between aligned and unaligned operations for vector stores. Fixes PR16640.

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

11 years agoFix ARMFastISel::ARMEmitIntExt shift emission
JF Bastien [Wed, 17 Jul 2013 05:46:46 +0000 (05:46 +0000)]
Fix ARMFastISel::ARMEmitIntExt shift emission

My patch 'r183551 - ARM FastISel integer sext/zext improvements' was incorrect when emitting ARM register-immediate ASR, LSL, LSR instructions: they are pseudo-instructions in ARMInstrInfo.td and I should have used MOVsi instead.

This is not an issue when code is generated through a .s file, but is an issue when generated straight to a .o (-filetype=obj).

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

11 years agoPPC: Add CTR-register clobber to builtin setjmp
Hal Finkel [Wed, 17 Jul 2013 05:35:44 +0000 (05:35 +0000)]
PPC: Add CTR-register clobber to builtin setjmp

Because the builtin longjmp implementation uses a CTR-based indirect jump, when
the control flow arrives at the builtin setjmp call, the CTR register has
necessarily been clobbered. Correspondingly, this adds CTR to the list of
implicit definitions of the builtin setjmp pseudo instruction.

We don't need to add CTR to the implicit definitions of builtin longjmp
because, even though it does clobber the CTR register, the control flow cannot
return to inside the loop unless there is also a builtin setjmp call.

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

11 years agoAdd simpler version of is_directory. It will be used in clang.
Rafael Espindola [Wed, 17 Jul 2013 04:20:49 +0000 (04:20 +0000)]
Add simpler version of is_directory. It will be used in clang.

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

11 years agoMark a method 'const' and another 'static'.
Craig Topper [Wed, 17 Jul 2013 03:54:53 +0000 (03:54 +0000)]
Mark a method 'const' and another 'static'.

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

11 years agoMake a few more static string pointers constant.
Craig Topper [Wed, 17 Jul 2013 03:43:10 +0000 (03:43 +0000)]
Make a few more static string pointers constant.

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

11 years agoDon't fallback to copy + delete in rename.
Rafael Espindola [Wed, 17 Jul 2013 03:33:41 +0000 (03:33 +0000)]
Don't fallback to copy + delete in rename.

Rename's documentation says "Files are renamed as if by POSIX rename()". and it
is used for atomically updating output files from a temporary. Having rename
fallback to a non atomic copy has the potential to hide bugs, like using
a temporary file in /tmp instead of a unique name next to the final destination.

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

11 years agoMake constant string pointer into an array to remove a pointer lookup for every access.
Craig Topper [Wed, 17 Jul 2013 03:11:32 +0000 (03:11 +0000)]
Make constant string pointer into an array to remove a pointer lookup for every access.

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

11 years agoraw_ostream.cpp: Introduce <fcntl.h> to let O_BINARY provided. Or, llvm::outs() would...
NAKAMURA Takumi [Wed, 17 Jul 2013 02:21:10 +0000 (02:21 +0000)]
raw_ostream.cpp: Introduce <fcntl.h> to let O_BINARY provided. Or, llvm::outs() would be set to O_TEXT by default.

llvm/test/Object/check_binary_output.ll is expected to pass on win32.

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

11 years agoSLPVectorizer: Accelerate the isConsecutive check by replacing the subtraction of...
Nadav Rotem [Wed, 17 Jul 2013 00:48:31 +0000 (00:48 +0000)]
SLPVectorizer: Accelerate the isConsecutive check by replacing the subtraction of the two values with a simple SCEV expression that adds the offset to one of the pointers that we compare.

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

11 years agoPPC: Implement base pointer and stack realignment
Hal Finkel [Wed, 17 Jul 2013 00:45:52 +0000 (00:45 +0000)]
PPC: Implement base pointer and stack realignment

This builds on some frame-lowering code that has existed since 2005 (r24224)
but was disabled in 2008 (r48188) because it needed base pointer support to
function correctly. This implementation follows the strategy suggested by Dale
Johannesen in r48188 where the following comment was added:

  This does not currently work, because the delta between old and new stack
  pointers is added to offsets that reference incoming parameters after the
  prolog is generated, and the code that does that doesn't handle a variable
  delta.  You don't want to do that anyway; a better approach is to reserve
  another register that retains to the incoming stack pointer, and reference
  parameters relative to that.

And now we do exactly that. If we don't need a frame pointer, then we use r31
as a base pointer. If we do need a frame pointer, then we use r30 as a base
pointer. The base pointer retains the value of the stack pointer before it was
decremented in the prologue. We then use the base pointer to resolve all
negative frame indicies. The basic scheme follows that for base pointers in the
X86 backend.

We use a base pointer when we need to dynamically realign the incoming stack
pointer. This currently applies only to static objects (dynamic allocas with
large alignments, and base-pointer support in SjLj lowering will come in future
commits).

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

11 years agollvm/test/CodeGen/X86/vec_setcc.ll: Add explicit -mtriple=x86_64-unknown-unknown...
NAKAMURA Takumi [Wed, 17 Jul 2013 00:42:37 +0000 (00:42 +0000)]
llvm/test/CodeGen/X86/vec_setcc.ll: Add explicit -mtriple=x86_64-unknown-unknown to satisfy win32-targeted configuration.

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

11 years agoMove string pointer from being a static class member to just a static global in the...
Craig Topper [Wed, 17 Jul 2013 00:31:35 +0000 (00:31 +0000)]
Move string pointer from being a static class member to just a static global in the one file its needed in.

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

11 years agoAdd getModuleFlag(StringRef Key) to query a module flag given Key.
Manman Ren [Tue, 16 Jul 2013 23:21:16 +0000 (23:21 +0000)]
Add getModuleFlag(StringRef Key) to query a module flag given Key.

No functionality change.

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

11 years agollvm/test/Object/ar-create.test: Relax a CHECK line to satisfy localized message...
NAKAMURA Takumi [Tue, 16 Jul 2013 23:17:22 +0000 (23:17 +0000)]
llvm/test/Object/ar-create.test: Relax a CHECK line to satisfy localized message catalogue.

For example, 'No such file or directory' cannot be seen on Japanese version of msvcrt.

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

11 years agollvm/test/Object/check_binary_output.ll: Mark it as XFAIL on Windows. Investigating.
NAKAMURA Takumi [Tue, 16 Jul 2013 23:16:57 +0000 (23:16 +0000)]
llvm/test/Object/check_binary_output.ll: Mark it as XFAIL on Windows. Investigating.

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

11 years agoflip the scev minus direction to simplify the code.
Nadav Rotem [Tue, 16 Jul 2013 22:57:06 +0000 (22:57 +0000)]
flip the scev minus direction to simplify the code.

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

11 years agoSLPVectorizer: Improve the compile time of isConsecutive by adding a simple constant...
Nadav Rotem [Tue, 16 Jul 2013 22:51:07 +0000 (22:51 +0000)]
SLPVectorizer: Improve the compile time of isConsecutive by adding a simple constant-gep check before using SCEV.
This check does not always work because not all of the GEPs use a constant offset, but it happens often enough to reduce the number of times we use SCEV.

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

11 years agoRelated to r181161 - Indirect branches may not be the last branch in a basic
Lang Hames [Tue, 16 Jul 2013 22:01:40 +0000 (22:01 +0000)]
Related to r181161 - Indirect branches may not be the last branch in a basic
block. Blocks that have an indirect branch terminator, even if it's not the
last terminator, should still be treated as unanalyzable.

<rdar://problem/14437274>

Reducing a useful regression test case is proving difficult - I hope to have
one soon.

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

11 years agoARM: Add support for the Thumb2 PLI alternate literal form.
Tilmann Scheller [Tue, 16 Jul 2013 21:52:34 +0000 (21:52 +0000)]
ARM: Add support for the Thumb2 PLI alternate literal form.

This adds an instruction alias to make the assembler recognize the alternate literal form: pli [PC, #+/-<imm>]

See A8.8.129 in the ARM ARM (DDI 0406C.b).

Fixes <rdar://problem/14403733>.

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

11 years agoUpdate the examples for an API change.
Rafael Espindola [Tue, 16 Jul 2013 20:22:35 +0000 (20:22 +0000)]
Update the examples for an API change.

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

11 years agoAdd a wrapper for open.
Rafael Espindola [Tue, 16 Jul 2013 19:44:17 +0000 (19:44 +0000)]
Add a wrapper for open.

This centralizes the handling of O_BINARY and opens the way for hiding more
differences (like how open behaves with directories).

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

11 years agoFinally, force the target for this test. Should unbreak non-x86 buildbots.
Benjamin Kramer [Tue, 16 Jul 2013 19:22:07 +0000 (19:22 +0000)]
Finally, force the target for this test. Should unbreak non-x86 buildbots.

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

11 years agoXFAIL this test on mingw.
Rafael Espindola [Tue, 16 Jul 2013 19:20:29 +0000 (19:20 +0000)]
XFAIL this test on mingw.

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

11 years agoLabel names also differ between platforms. Use a relaxed regex.
Benjamin Kramer [Tue, 16 Jul 2013 18:54:21 +0000 (18:54 +0000)]
Label names also differ between platforms. Use a relaxed regex.

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

11 years agoFix test not to fail when the target doesn't use leading underscores on symbols.
Benjamin Kramer [Tue, 16 Jul 2013 18:42:01 +0000 (18:42 +0000)]
Fix test not to fail when the target doesn't use leading underscores on symbols.

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

11 years agoCleanup testing case by using a shorter name for types.
Manman Ren [Tue, 16 Jul 2013 18:26:48 +0000 (18:26 +0000)]
Cleanup testing case by using a shorter name for types.

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

11 years agoRemove floats from live range splitting costs.
Jakob Stoklund Olesen [Tue, 16 Jul 2013 18:26:18 +0000 (18:26 +0000)]
Remove floats from live range splitting costs.

These floats all represented block frequencies anyway, so just use the
BlockFrequency class directly.

Some floating point computations remain in tryLocalSplit(). They are
estimating spill weights which are still floats.

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

11 years agoReapply r185393.
Jakob Stoklund Olesen [Tue, 16 Jul 2013 18:26:15 +0000 (18:26 +0000)]
Reapply r185393.

Original commit message:

Remove floating point computations from SpillPlacement.cpp.

Patch by Benjamin Kramer!

Use the BlockFrequency class instead of floats in the Hopfield network
computations. This rescales the node Bias field from a [-2;2] float
range to two block frequencies BiasN and BiasP pulling in opposite
directions. This construct has a more predictable behavior when block
frequencies saturate.

The per-node scaling factors are no longer necessary, assuming the block
frequencies around a bundle are consistent.

This patch can cause the register allocator to make different spilling
decisions. The differences should be small.

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

11 years ago[X86] Use min/max to optimze unsigend vector comparison on X86
Juergen Ributzka [Tue, 16 Jul 2013 18:20:45 +0000 (18:20 +0000)]
[X86] Use min/max to optimze unsigend vector comparison on X86

Use PMIN/PMAX for UGE/ULE vector comparions to reduce the number of required
instructions. This trick also works for UGT/ULT, but there is no advantage in
doing so. It wouldn't reduce the number of instructions and it would actually
reduce performance.

Reviewer: Ben

radar:5972691

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

11 years agoMake SpecialCaseList match full strings, as documented, using anchors.
Peter Collingbourne [Tue, 16 Jul 2013 17:56:07 +0000 (17:56 +0000)]
Make SpecialCaseList match full strings, as documented, using anchors.

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

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

11 years agoTest commit to verify write access.
Juergen Ributzka [Tue, 16 Jul 2013 17:44:23 +0000 (17:44 +0000)]
Test commit to verify write access.

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

11 years ago[Support] Add a Unicode conversion wrapper from UTF16 to UTF8
Reid Kleckner [Tue, 16 Jul 2013 17:14:33 +0000 (17:14 +0000)]
[Support] Add a Unicode conversion wrapper from UTF16 to UTF8

This is to support parsing UTF16 response files in LLVM/lib/Option for
lld and clang.

Reviewers: hans

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

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

11 years agoWhen the inliner merges allocas, it must keep the larger alignment
Hal Finkel [Tue, 16 Jul 2013 17:10:55 +0000 (17:10 +0000)]
When the inliner merges allocas, it must keep the larger alignment

For safety, the inliner cannot decrease the allignment on an alloca when
merging it with another.

I've included two variants of the test case for this: one with DataLayout
available, and one without. When DataLayout is not available, if only one of
the allocas uses the default alignment (getAlignment() == 0), then they cannot
be safely merged.

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

11 years agoOn error, close the temporary file descriptor.
Rafael Espindola [Tue, 16 Jul 2013 16:00:32 +0000 (16:00 +0000)]
On error, close the temporary file descriptor.

With this change llvm-ar can remove the temporary file on windows too.

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

11 years agoSLPVectorizer: Reduce the compile time of the consecutive store lookup.
Nadav Rotem [Tue, 16 Jul 2013 15:25:17 +0000 (15:25 +0000)]
SLPVectorizer: Reduce the compile time of the consecutive store lookup.

Process groups of stores in chunks of 16.

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

11 years agoCreate files with mode 666. This matches the behavior of other unix tools.
Rafael Espindola [Tue, 16 Jul 2013 14:10:07 +0000 (14:10 +0000)]
Create files with mode 666. This matches the behavior of other unix tools.

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

11 years ago[Support] Fix some warnings when self-hosting clang on Windows
Reid Kleckner [Tue, 16 Jul 2013 14:04:08 +0000 (14:04 +0000)]
[Support] Fix some warnings when self-hosting clang on Windows

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

11 years ago[APFloat] PR16573: Avoid losing mantissa bits in ppc_fp128 to double truncation
Ulrich Weigand [Tue, 16 Jul 2013 13:03:25 +0000 (13:03 +0000)]
[APFloat] PR16573: Avoid losing mantissa bits in ppc_fp128 to double truncation

When truncating to a format with fewer mantissa bits, APFloat::convert
will perform a right shift of the mantissa by the difference of the
precision of the two formats.  Usually, this will result in just the
mantissa bits needed for the target format.

One special situation is if the input number is denormal.  In this case,
the right shift may discard significant bits.  This is usually not a
problem, since truncating a denormal usually results in zero (underflow)
after normalization anyway, since the result format's exponent range is
usually smaller than the target format's.

However, there is one case where the latter property does not hold:
when truncating from ppc_fp128 to double.  In particular, truncating
a ppc_fp128 whose first double of the pair is denormal should result
in just that first double, not zero.  The current code however
performs an excessive right shift, resulting in lost result bits.
This is then caught in the APFloat::normalize call performed by
APFloat::convert and causes an assertion failure.

This patch checks for the scenario of truncating a denormal, and
attempts to (possibly partially) replace the initial mantissa
right shift by decrementing the exponent, if doing so will still
result in a valid *target format* exponent.

Index: test/CodeGen/PowerPC/pr16573.ll
===================================================================
--- test/CodeGen/PowerPC/pr16573.ll (revision 0)
+++ test/CodeGen/PowerPC/pr16573.ll (revision 0)
@@ -0,0 +1,11 @@
+; RUN: llc < %s | FileCheck %s
+
+target triple = "powerpc64-unknown-linux-gnu"
+
+define double @test() {
+  %1 = fptrunc ppc_fp128 0xM818F2887B9295809800000000032D000 to double
+  ret double %1
+}
+
+; CHECK: .quad -9111018957755033591
+
Index: lib/Support/APFloat.cpp
===================================================================
--- lib/Support/APFloat.cpp (revision 185817)
+++ lib/Support/APFloat.cpp (working copy)
@@ -1956,6 +1956,23 @@
     X86SpecialNan = true;
   }

+  // If this is a truncation of a denormal number, and the target semantics
+  // has larger exponent range than the source semantics (this can happen
+  // when truncating from PowerPC double-double to double format), the
+  // right shift could lose result mantissa bits.  Adjust exponent instead
+  // of performing excessive shift.
+  if (shift < 0 && isFiniteNonZero()) {
+    int exponentChange = significandMSB() + 1 - fromSemantics.precision;
+    if (exponent + exponentChange < toSemantics.minExponent)
+      exponentChange = toSemantics.minExponent - exponent;
+    if (exponentChange < shift)
+      exponentChange = shift;
+    if (exponentChange < 0) {
+      shift -= exponentChange;
+      exponent += exponentChange;
+    }
+  }
+
   // If this is a truncation, perform the shift before we narrow the storage.
   if (shift < 0 && (isFiniteNonZero() || category==fcNaN))
     lostFraction = shiftRight(significandParts(), oldPartCount, -shift);

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

11 years ago[XCore] Fix printing of inline asm operands.
Richard Osborne [Tue, 16 Jul 2013 12:48:34 +0000 (12:48 +0000)]
[XCore] Fix printing of inline asm operands.

Previously an asm operand with no operand modifier would give the error
"invalid operand in inline asm".

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

11 years agoARM: allow printing of ARM atomic DAG nodes.
Tim Northover [Tue, 16 Jul 2013 12:15:36 +0000 (12:15 +0000)]
ARM: allow printing of ARM atomic DAG nodes.

We'd forgotten to provide string representations for the special ARMISD atomic
nodes; this adds them in. No effect on CodeGen, just makes the output of
"-view-whatever-dags" slightly more readable.

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

11 years ago[SystemZ] Use ROSBG and non-zero form of RISBG for OR nodes
Richard Sandiford [Tue, 16 Jul 2013 11:55:57 +0000 (11:55 +0000)]
[SystemZ] Use ROSBG and non-zero form of RISBG for OR nodes

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

11 years agoFixing a buildbot failure:unused function.
Vladimir Medic [Tue, 16 Jul 2013 11:43:20 +0000 (11:43 +0000)]
Fixing a buildbot failure:unused function.

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

11 years ago[SystemZ] Add MC support for R[NOX]SBG
Richard Sandiford [Tue, 16 Jul 2013 11:28:08 +0000 (11:28 +0000)]
[SystemZ] Add MC support for R[NOX]SBG

CodeGen support will come later.

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

11 years ago[SystemZ] Use RISBG for (shift (and ...))
Richard Sandiford [Tue, 16 Jul 2013 11:02:24 +0000 (11:02 +0000)]
[SystemZ] Use RISBG for (shift (and ...))

Another patch in the series to make more use of R.SBG.  This one extends
r186072 and r186073 to handle cases where the AND is inside the shift.

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

11 years ago This patch represents Mips utilization of r186388 code that alows asm matcher to...
Vladimir Medic [Tue, 16 Jul 2013 10:07:14 +0000 (10:07 +0000)]
 This patch represents Mips utilization of r186388 code that alows asm matcher to emit mnemonics contain '.' characters. This makes asm parser code simpler and more efficient.

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

11 years agoPPCJITInfo.cpp: Tweak r186252 with s/__ppc/__powerpc/ to work on powerpc-linux Fedora 12.
NAKAMURA Takumi [Tue, 16 Jul 2013 09:59:51 +0000 (09:59 +0000)]
PPCJITInfo.cpp: Tweak r186252 with s/__ppc/__powerpc/ to work on powerpc-linux Fedora 12.

    g++ (GCC) 4.4.4 20100630 (Red Hat 4.4.4-10)

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

11 years agoARM: implement ldrex, strex and clrex intrinsics
Tim Northover [Tue, 16 Jul 2013 09:46:55 +0000 (09:46 +0000)]
ARM: implement ldrex, strex and clrex intrinsics

Intrinsics already existed for the 64-bit variants, so these support operations
of size at most 32-bits.

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

11 years agoARM EABI divmod support
Renato Golin [Tue, 16 Jul 2013 09:32:17 +0000 (09:32 +0000)]
ARM EABI divmod support

This patch enables calls to __aeabi_idivmod when in EABI mode,
by using the remainder value returned on registers (R1),
enabled by the ARM triple "none-eabi". Note that Darwin and
GNUEABI triples will continue lowering on GNU style, that is,
using the stack for the remainder.

Still need to add SREM/UREM support fix for 64-bit lowering.

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

11 years agoThis patch allows targets to define weather the instruction mnemonics in asm matcher...
Vladimir Medic [Tue, 16 Jul 2013 09:22:38 +0000 (09:22 +0000)]
This patch allows targets to define weather the instruction mnemonics in asm matcher tables will contain '.' character.

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

11 years agollvm/test/Object/directory.ll: Mark it as XFAIL:cygwin. Directories can be opened...
NAKAMURA Takumi [Tue, 16 Jul 2013 09:06:47 +0000 (09:06 +0000)]
llvm/test/Object/directory.ll: Mark it as XFAIL:cygwin. Directories can be opened on cygwin.

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

11 years agoUse open+fstat instead of stat+open.
Rafael Espindola [Tue, 16 Jul 2013 03:34:31 +0000 (03:34 +0000)]
Use open+fstat instead of stat+open.

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

11 years agoRemember that we have a null terminated string.
Rafael Espindola [Tue, 16 Jul 2013 03:30:10 +0000 (03:30 +0000)]
Remember that we have a null terminated string.

This is a micro optimization. Instead of going char*->StringRef->Twine->char*,
go char*->Twine->char* and avoid having to copy the filename on the stack.

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

11 years ago[Object/COFF] Add import_directory_table_entry.
Rui Ueyama [Tue, 16 Jul 2013 03:23:55 +0000 (03:23 +0000)]
[Object/COFF] Add import_directory_table_entry.

Summary: Add import_directory_table_entry to use for .idata section.

Reviewers: Bigcheese

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

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

11 years agoAdd a version of sys::fs::status that uses fstat.
Rafael Espindola [Tue, 16 Jul 2013 03:20:13 +0000 (03:20 +0000)]
Add a version of sys::fs::status that uses fstat.

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

11 years agoCOFF: Add constants for optional data directory.
Rui Ueyama [Tue, 16 Jul 2013 03:11:55 +0000 (03:11 +0000)]
COFF: Add constants for optional data directory.

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

11 years agoInstead friending status, provide windows and posix constructors to file_status.
Rafael Espindola [Tue, 16 Jul 2013 02:55:33 +0000 (02:55 +0000)]
Instead friending status, provide windows and posix constructors to file_status.

This opens the way of having static helpers in the .inc files that can
construct a file_status.

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

11 years agounittests/Support: Add TimeValue.Win32FILETIME, corresponding to r186374.
NAKAMURA Takumi [Tue, 16 Jul 2013 02:44:23 +0000 (02:44 +0000)]
unittests/Support: Add TimeValue.Win32FILETIME, corresponding to r186374.

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

11 years agoFix TimeValue::toWin32Time() to be symmetric to fromWin32Time() and compatible to...
NAKAMURA Takumi [Tue, 16 Jul 2013 02:43:51 +0000 (02:43 +0000)]
Fix TimeValue::toWin32Time() to be symmetric to fromWin32Time() and compatible to Win32's FILETIME.

llvm-ar is the only user of toWin32Time() (via setLastModificationAndAccessTime), and r186298 can be reverted.
It had been buggy since the initial commit.

FIXME: Could we rename {from|to}Win32Time as {from|to}Win32FILETIME in TimeValue?

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

11 years agoRename Support.TimeValue to TimeValue.time_t in unittests/Support.
NAKAMURA Takumi [Tue, 16 Jul 2013 02:03:32 +0000 (02:03 +0000)]
Rename Support.TimeValue to TimeValue.time_t in unittests/Support.

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

11 years agoAdd 'const' qualifiers to static const char* variables.
Craig Topper [Tue, 16 Jul 2013 01:17:10 +0000 (01:17 +0000)]
Add 'const' qualifiers to static const char* variables.

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

11 years agoAdd mingw32 to the XFAIL. I forgot about it when adding win32.
Rafael Espindola [Mon, 15 Jul 2013 23:51:47 +0000 (23:51 +0000)]
Add mingw32 to the XFAIL. I forgot about it when adding win32.

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

11 years agoPEI: Support for non-zero SPAdj at beginning of a basic block.
Manman Ren [Mon, 15 Jul 2013 23:47:29 +0000 (23:47 +0000)]
PEI: Support for non-zero SPAdj at beginning of a basic block.

We can have a FrameSetup in one basic block and the matching FrameDestroy
in a different basic block when we have struct byval. In that case, SPAdj
is not zero at beginning of the basic block.

Modify PEI to correctly set SPAdj at beginning of each basic block using
DFS traversal. We used to assume SPAdj is 0 at beginning of each basic block.

PEI had an assert SPAdjCount || SPAdj == 0.
If we have a Destroy <n> followed by a Setup <m>, PEI will assert failure.
We can add an extra condition to make sure the pairs are matched:
  The pairs start with a FrameSetup.
But since we are doing a much better job in the verifier, this patch removes
the check in PEI.

PR16393

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

11 years agoPR16628: Fix a bug in the code that merges compares.
Nadav Rotem [Mon, 15 Jul 2013 22:52:48 +0000 (22:52 +0000)]
PR16628: Fix a bug in the code that merges compares.
Compares return i1 but they compare different types.

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

11 years agoPPC: Refactoring to support subtarget feature changing
Hal Finkel [Mon, 15 Jul 2013 22:29:40 +0000 (22:29 +0000)]
PPC: Refactoring to support subtarget feature changing

This change mirrors the changes that were made to the X86 and ARM targets to
support subtarget feature changing. As indicated in r182899, the mechanism is
still undergoing revision, and so as with the X86 and ARM targets, there is no
test case yet (there is no effective functionality change).

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

11 years agoFurther simplify test case from r186119/r186035.
David Blaikie [Mon, 15 Jul 2013 22:28:45 +0000 (22:28 +0000)]
Further simplify test case from r186119/r186035.

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

11 years agoXFAIL on windows too and document the XFAILs.
Rafael Espindola [Mon, 15 Jul 2013 22:16:53 +0000 (22:16 +0000)]
XFAIL on windows too and document the XFAILs.

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

11 years agoMachine Verifier: verify FrameSetup and FrameDestroy
Manman Ren [Mon, 15 Jul 2013 21:26:31 +0000 (21:26 +0000)]
Machine Verifier: verify FrameSetup and FrameDestroy

1> on every path through the CFG, a FrameSetup <n> is always followed by a
   FrameDestroy <n> and a FrameDestroy is always followed by a FrameSetup.
2> stack adjustments are identical on all CFG edges to a merge point.
3> frame is destroyed at end of a return block.

PR16393

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

11 years agoRemove an extra is_directory call.
Rafael Espindola [Mon, 15 Jul 2013 20:52:01 +0000 (20:52 +0000)]
Remove an extra is_directory call.

I checked that opening a directory on windows does fail, so this saves a "stat".

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

11 years agoFix register subclass handling in PPCInstrInfo::insertSelect
Hal Finkel [Mon, 15 Jul 2013 20:22:58 +0000 (20:22 +0000)]
Fix register subclass handling in PPCInstrInfo::insertSelect

PPCInstrInfo::insertSelect and PPCInstrInfo::canInsertSelect were computing the
common subclass of the true and false inputs, and then selecting either the
32-bit or the 64-bit isel variant based on the result of calling
PPC::GPRCRegClass.hasSubClassEq(RC) and PPC::G8RCRegClass.hasSubClassEq(RC)
(where RC is the common subclass). Unfortunately, this is not quite right: if
we have something like this:

  %vreg8<def> = SELECT_CC_I8 %vreg4<kill>, %vreg7<kill>, %vreg6<kill>, 76;
    G8RC_and_G8RC_NOX0:%vreg8 CRRC:%vreg4 G8RC_NOX0:%vreg7,%vreg6

then the common subclass of G8RC_and_G8RC_NOX0 and G8RC_NOX0 is G8RC_NOX0, and
G8RC_NOX0 is not a subclass of G8RC (because it also contains the ZERO8
pseudo-register). As a result, we also need to check the common subclass
against GPRC_NOR0 and G8RC_NOX0 explicitly.

This had not been a problem for clients of insertSelect that called
canInsertSelect first (because it had a compensating mistake), but insertSelect
is also used by the PPC pseudo-instruction expander, and this error was causing
a problem in that context.

This problem was found by csmith.

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

11 years ago[mc-coff] Resolve aliases when emitting COFF relocations
Reid Kleckner [Mon, 15 Jul 2013 19:41:21 +0000 (19:41 +0000)]
[mc-coff] Resolve aliases when emitting COFF relocations

This is consistent with the ELF object writer.

Add some COFF tests that relocate against an alias.

Reviewers: espindola

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

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

11 years agoR600/SI: Add support for 64-bit loads
Tom Stellard [Mon, 15 Jul 2013 19:00:09 +0000 (19:00 +0000)]
R600/SI: Add support for 64-bit loads

https://bugs.freedesktop.org/show_bug.cgi?id=65873

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

11 years agoRemove invalid assert in DAGTypeLegalizer::RemapValue
Hal Finkel [Mon, 15 Jul 2013 18:57:05 +0000 (18:57 +0000)]
Remove invalid assert in DAGTypeLegalizer::RemapValue

There is a comment at the top of DAGTypeLegalizer::PerformExpensiveChecks
which, in part, says:

  // Note that these invariants may not hold momentarily when processing a node:
  // the node being processed may be put in a map before being marked Processed.

Unfortunately, this assert would be valid only if the above-mentioned invariant
held unconditionally. This was causing llc to assert when, in fact,
everything was fine.

Thanks to Richard Sandiford for investigating this issue!

Fixes PR16562.

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

11 years agoRemove trailing whitespace
Stephen Lin [Mon, 15 Jul 2013 17:55:02 +0000 (17:55 +0000)]
Remove trailing whitespace

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

11 years agoRevert r186316 while I track down an ASan failure and an assert from
Chandler Carruth [Mon, 15 Jul 2013 17:36:21 +0000 (17:36 +0000)]
Revert r186316 while I track down an ASan failure and an assert from
a bot.

This reverts the commit which introduced a new implementation of the
fancy SROA pass designed to reduce its overhead. I'll skip the huge
commit log here, refer to r186316 if you're looking for how this all
works and why it works that way.

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

11 years agoTeaching llvm-tblgen to not emit a switch statement when there are no case statements.
Aaron Ballman [Mon, 15 Jul 2013 16:53:32 +0000 (16:53 +0000)]
Teaching llvm-tblgen to not emit a switch statement when there are no case statements.

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

11 years agoRevert "[Option] Store arg strings in a set backed by a BumpPtrAllocator"
Reid Kleckner [Mon, 15 Jul 2013 16:40:52 +0000 (16:40 +0000)]
Revert "[Option] Store arg strings in a set backed by a BumpPtrAllocator"

This broke clang's crash-report.c test, and I haven't been able to
figure it out yet.

This reverts commit r186319.

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

11 years agoTest commit to see if write access works.
Job Noorman [Mon, 15 Jul 2013 14:25:26 +0000 (14:25 +0000)]
Test commit to see if write access works.

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

11 years ago[Option] Store arg strings in a set backed by a BumpPtrAllocator
Reid Kleckner [Mon, 15 Jul 2013 13:46:24 +0000 (13:46 +0000)]
[Option] Store arg strings in a set backed by a BumpPtrAllocator

No functionality change.

This is preparing to move response file parsing into lib/Option so it
can be shared between clang and lld.  This change isn't just a
micro-optimization.  Clang's driver uses a std::set<std::string> to
unique arguments while parsing response files, so this matches that.

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

11 years agoXFAIL this on freebsd to bring the bot back.
Rafael Espindola [Mon, 15 Jul 2013 12:18:30 +0000 (12:18 +0000)]
XFAIL this on freebsd to bring the bot back.

Joerg Sonnenberger tells me one can open a directory in freebsd. I will try
to centralize our calls to open so that we can handle O_BINARY in one place,
and will then handle this there too.

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

11 years agoReimplement SROA yet again. Same fundamental principle, but a totally
Chandler Carruth [Mon, 15 Jul 2013 10:30:19 +0000 (10:30 +0000)]
Reimplement SROA yet again. Same fundamental principle, but a totally
different core implementation strategy.

Previously, SROA would build a relatively elaborate partitioning of an
alloca, associate uses with each partition, and then rewrite the uses of
each partition in an attempt to break apart the alloca into chunks that
could be promoted. This was very wasteful in terms of memory and compile
time because regardless of how complex the alloca or how much we're able
to do in breaking it up, all of the datastructure work to analyze the
partitioning was done up front.

The new implementation attempts to form partitions of the alloca lazily
and on the fly, rewriting the uses that make up that partition as it
goes. This has a few significant effects:
1) Much simpler data structures are used throughout.
2) No more double walk of the recursive use graph of the alloca, only
   walk it once.
3) No more complex algorithms for associating a particular use with
   a particular partition.
4) PHI and Select speculation is simplified and happens lazily.
5) More precise information is available about a specific use of the
   alloca, removing the need for some side datastructures.

Ultimately, I think this is a much better implementation. It removes
about 300 lines of code, but arguably removes more like 500 considering
that some code grew in the process of being factored apart and cleaned
up for this all to work.

I've re-used as much of the old implementation as possible, which
includes the lion's share of code in the form of the rewriting logic.
The interesting new logic centers around how the uses of a partition are
sorted, and split into actual partitions.

Each instruction using a pointer derived from the alloca gets
a 'Partition' entry. This name is totally wrong, but I'll do a rename in
a follow-up commit as there is already enough churn here. The entry
describes the offset range accessed and the nature of the access. Once
we have all of these entries we sort them in a very specific way:
increasing order of begin offset, followed by whether they are
splittable uses (memcpy, etc), followed by the end offset or whatever.
Sorting by splittability is important as it simplifies the collection of
uses into a partition.

Once we have these uses sorted, we walk from the beginning to the end
building up a range of uses that form a partition of the alloca.
Overlapping unsplittable uses are merged into a single partition while
splittable uses are broken apart and carried from one partition to the
next. A partition is also introduced to bridge splittable uses between
the unsplittable regions when necessary.

I've looked at the performance PRs fairly closely. PR15471 no longer
will even load (the module is invalid). Not sure what is up there.
PR15412 improves by between 5% and 10%, however it is nearly impossible
to know what is holding it up as SROA (the entire pass) takes less time
than reading the IR for that test case. The analysis takes the same time
as running mem2reg on the final allocas. I suspect (without much
evidence) that the new implementation will scale much better however,
and it is just the small nature of the test cases that makes the changes
small and noisy. Either way, it is still simpler and cleaner I think.

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

11 years agoDebugInfo: Factor out parsing compile unit DIEs to a separate function. Improve code...
Alexey Samsonov [Mon, 15 Jul 2013 08:43:35 +0000 (08:43 +0000)]
DebugInfo: Factor out parsing compile unit DIEs to a separate function. Improve code style and comments.

No functionality change.

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

11 years agoAdd 'const' qualifier to some arrays.
Craig Topper [Mon, 15 Jul 2013 08:02:13 +0000 (08:02 +0000)]
Add 'const' qualifier to some arrays.

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

11 years agoMake some arrays 'static const'
Craig Topper [Mon, 15 Jul 2013 07:22:00 +0000 (07:22 +0000)]
Make some arrays 'static const'

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