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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
Craig Topper [Mon, 15 Jul 2013 07:15:05 +0000 (07:15 +0000)]
Add include to hopefully fix windows build.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@186310
91177308-0d34-0410-b5e6-
96231b3b80d8
Craig Topper [Mon, 15 Jul 2013 07:02:45 +0000 (07:02 +0000)]
Add const qualifier to some static arrays.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@186309
91177308-0d34-0410-b5e6-
96231b3b80d8
Craig Topper [Mon, 15 Jul 2013 06:54:12 +0000 (06:54 +0000)]
Add 'static' keyword to some const arrays for consistency.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@186308
91177308-0d34-0410-b5e6-
96231b3b80d8
Craig Topper [Mon, 15 Jul 2013 06:39:13 +0000 (06:39 +0000)]
Make some arrays 'static const'
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@186307
91177308-0d34-0410-b5e6-
96231b3b80d8
Craig Topper [Mon, 15 Jul 2013 04:37:54 +0000 (04:37 +0000)]
Revert part of 186302 to fix buildbots.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@186303
91177308-0d34-0410-b5e6-
96231b3b80d8
Craig Topper [Mon, 15 Jul 2013 04:27:47 +0000 (04:27 +0000)]
Use llvm::array_lengthof to replace sizeof(array)/sizeof(array[0]).
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@186301
91177308-0d34-0410-b5e6-
96231b3b80d8
NAKAMURA Takumi [Mon, 15 Jul 2013 03:04:13 +0000 (03:04 +0000)]
Mark llvm/test/Object/extract.ll as XFAIL:mingw32, for now.
FIXME: Investigate Win32's TimeValue stuff!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@186298
91177308-0d34-0410-b5e6-
96231b3b80d8
Eric Christopher [Sun, 14 Jul 2013 22:23:54 +0000 (22:23 +0000)]
Clarify comments.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@186297
91177308-0d34-0410-b5e6-
96231b3b80d8
Eric Christopher [Sun, 14 Jul 2013 22:02:31 +0000 (22:02 +0000)]
Add DW_AT_GNU_odr_signature to the set of dwarf attributes.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@186296
91177308-0d34-0410-b5e6-
96231b3b80d8
Eric Christopher [Sun, 14 Jul 2013 21:46:51 +0000 (21:46 +0000)]
Collapse temporary variable into call.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@186295
91177308-0d34-0410-b5e6-
96231b3b80d8
Anton Korobeynikov [Sun, 14 Jul 2013 18:19:44 +0000 (18:19 +0000)]
Use conventional syntax for branches.
Patch by Job!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@186291
91177308-0d34-0410-b5e6-
96231b3b80d8
Stephen Lin [Sun, 14 Jul 2013 18:12:25 +0000 (18:12 +0000)]
Correct inaccurate statement in FileCheck docs.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@186290
91177308-0d34-0410-b5e6-
96231b3b80d8
Anton Korobeynikov [Sun, 14 Jul 2013 15:11:00 +0000 (15:11 +0000)]
Properly lower jump tables on MSP430. Patch by Job Noorman!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@186283
91177308-0d34-0410-b5e6-
96231b3b80d8
Chandler Carruth [Sun, 14 Jul 2013 10:46:51 +0000 (10:46 +0000)]
The archive update test has a subtle race condition in it: if the test
is executed within the same second as the inputs for the test are
checked out from the source tree, it will fail to update due to being
below the resolution of the 'mtime' test used.
Now, this may seem improbably to you... ok, maybe *really* improbable,
but consider a system which does distributed execution of tests by
shipping their inputs to another machine and runs them. That might cause
the mtime to be quite recent during the test run. ;]
Instead, create two files directly in the test (allowing all platforms
to see the problem) and add either a use of the 'touch' command that
forces one mtime to some time quite a bit in the past, or it sleeps for
just over a second to be outside of the precision window.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@186282
91177308-0d34-0410-b5e6-
96231b3b80d8
Stephen Lin [Sun, 14 Jul 2013 06:24:09 +0000 (06:24 +0000)]
Mass update to CodeGen tests to use CHECK-LABEL for labels corresponding to function definitions for more informative error messages. No functionality change and all updated tests passed locally.
This update was done with the following bash script:
find test/CodeGen -name "*.ll" | \
while read NAME; do
echo "$NAME"
if ! grep -q "^; *RUN: *llc.*debug" $NAME; then
TEMP=`mktemp -t temp`
cp $NAME $TEMP
sed -n "s/^define [^@]*@\([A-Za-z0-9_]*\)(.*$/\1/p" < $NAME | \
while read FUNC; do
sed -i '' "s/;\(.*\)\([A-Za-z0-9_-]*\):\( *\)$FUNC: *\$/;\1\2-LABEL:\3$FUNC:/g" $TEMP
done
sed -i '' "s/;\(.*\)-LABEL-LABEL:/;\1-LABEL:/" $TEMP
sed -i '' "s/;\(.*\)-NEXT-LABEL:/;\1-NEXT:/" $TEMP
sed -i '' "s/;\(.*\)-NOT-LABEL:/;\1-NOT:/" $TEMP
sed -i '' "s/;\(.*\)-DAG-LABEL:/;\1-DAG:/" $TEMP
mv $TEMP $NAME
fi
done
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@186280
91177308-0d34-0410-b5e6-
96231b3b80d8
Nadav Rotem [Sun, 14 Jul 2013 06:15:46 +0000 (06:15 +0000)]
SLPVectorizer: change the order in which we search for vectorization candidates. Do stores first and PHIs second.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@186277
91177308-0d34-0410-b5e6-
96231b3b80d8
Tobias Grosser [Sun, 14 Jul 2013 06:12:01 +0000 (06:12 +0000)]
Fix build by replacing '>>' with '> >'
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@186276
91177308-0d34-0410-b5e6-
96231b3b80d8
Craig Topper [Sun, 14 Jul 2013 04:42:23 +0000 (04:42 +0000)]
Use SmallVectorImpl& instead of SmallVector to avoid repeating small vector size.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@186274
91177308-0d34-0410-b5e6-
96231b3b80d8
Andrew Trick [Sun, 14 Jul 2013 03:10:08 +0000 (03:10 +0000)]
Remove a bunch of old SCEVExpander FIXME's for preserving NoWrap.
The great thing about the SCEVAddRec No-Wrap flag (unlike nsw/nuw) is
that is can be preserved while normalizing (reassociating and
factoring).
The bad thing is that is can't be tranfered back to IR, which is one
of the reasons I don't like the concept of SCEVExpander.
Sorry, I can't think of a direct way to test this, which is why these
were FIXMEs for so long. I just think it's a good time to finally
clean it up.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@186273
91177308-0d34-0410-b5e6-
96231b3b80d8
Andrew Trick [Sun, 14 Jul 2013 02:50:07 +0000 (02:50 +0000)]
Teach indvars to generate nsw/nuw flags when widening an induction variable.
Fixes PR16600.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@186272
91177308-0d34-0410-b5e6-
96231b3b80d8
Stephen Lin [Sun, 14 Jul 2013 02:10:57 +0000 (02:10 +0000)]
Fixup to r186268 and r186269: don't append -LABEL to CHECK-NOT. No functionality change.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@186271
91177308-0d34-0410-b5e6-
96231b3b80d8
Stephen Lin [Sun, 14 Jul 2013 01:50:49 +0000 (01:50 +0000)]
Catch more CHECK that can be converted to CHECK-LABEL in Transforms for easier debugging. No functionality change.
This conversion was done with the following bash script:
find test/Transforms -name "*.ll" | \
while read NAME; do
echo "$NAME"
if ! grep -q "^; *RUN: *llc" $NAME; then
TEMP=`mktemp -t temp`
cp $NAME $TEMP
sed -n "s/^define [^@]*@\([A-Za-z0-9_]*\)(.*$/\1/p" < $NAME | \
while read FUNC; do
sed -i '' "s/;\(.*\)\([A-Za-z0-9_]*\):\( *\)define\([^@]*\)@$FUNC\([( ]*\)\$/;\1\2-LABEL:\3define\4@$FUNC(/g" $TEMP
done
mv $TEMP $NAME
fi
done
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@186269
91177308-0d34-0410-b5e6-
96231b3b80d8
Stephen Lin [Sun, 14 Jul 2013 01:42:54 +0000 (01:42 +0000)]
Update Transforms tests to use CHECK-LABEL for easier debugging. No functionality change.
This update was done with the following bash script:
find test/Transforms -name "*.ll" | \
while read NAME; do
echo "$NAME"
if ! grep -q "^; *RUN: *llc" $NAME; then
TEMP=`mktemp -t temp`
cp $NAME $TEMP
sed -n "s/^define [^@]*@\([A-Za-z0-9_]*\)(.*$/\1/p" < $NAME | \
while read FUNC; do
sed -i '' "s/;\(.*\)\([A-Za-z0-9_]*\):\( *\)@$FUNC\([( ]*\)\$/;\1\2-LABEL:\3@$FUNC(/g" $TEMP
done
mv $TEMP $NAME
fi
done
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@186268
91177308-0d34-0410-b5e6-
96231b3b80d8
Stephen Lin [Sun, 14 Jul 2013 01:38:19 +0000 (01:38 +0000)]
Modify two Transforms tests to explicitly check for full function names in some cases, rather than just a common prefix. No functionality change.
(This is to avoid confusing a scripted mass update of these tests to use CHECK-LABEL)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@186267
91177308-0d34-0410-b5e6-
96231b3b80d8
Stephen Lin [Sat, 13 Jul 2013 22:08:55 +0000 (22:08 +0000)]
Convert Windows to Unix line endings, no functionality change.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@186264
91177308-0d34-0410-b5e6-
96231b3b80d8
Stephen Lin [Sat, 13 Jul 2013 22:00:58 +0000 (22:00 +0000)]
Add newlines at end of test files, no functionality change
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@186263
91177308-0d34-0410-b5e6-
96231b3b80d8
Stephen Lin [Sat, 13 Jul 2013 20:38:47 +0000 (20:38 +0000)]
Convert CodeGen/*/*.ll tests to use the new CHECK-LABEL for easier debugging. No functionality change and all tests pass after conversion.
This was done with the following sed invocation to catch label lines demarking function boundaries:
sed -i '' "s/^;\( *\)\([A-Z0-9_]*\):\( *\)test\([A-Za-z0-9_-]*\):\( *\)$/;\1\2-LABEL:\3test\4:\5/g" test/CodeGen/*/*.ll
which was written conservatively to avoid false positives rather than false negatives. I scanned through all the changes and everything looks correct.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@186258
91177308-0d34-0410-b5e6-
96231b3b80d8
Arnold Schwaighofer [Sat, 13 Jul 2013 19:09:29 +0000 (19:09 +0000)]
LoopVectorizer: Disallow reductions whose header phi is used outside the loop
If an outside loop user of the reduction value uses the header phi node we
cannot just reduce the vectorized phi value in the vector code epilog because
we would loose VF-1 reductions.
lp:
p = phi (0, lv)
lv = lv + 1
...
brcond , lp, outside
outside:
usr = add 0, p
(Say the loop iterates two times, the value of p coming out of the loop is one).
We cannot just transform this to:
vlp:
p = phi (<0,0>, lv)
lv = lv + <1,1>
..
brcond , lp, outside
outside:
p_reduced = p[0] + [1];
usr = add 0, p_reduced
(Because the original loop iterated two times the vectorized loop would iterate
one time, but p_reduced ends up being zero instead of one).
We would have to execute VF-1 iterations in the scalar remainder loop in such
cases. For now, just disable vectorization.
PR16522
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@186256
91177308-0d34-0410-b5e6-
96231b3b80d8
Joerg Sonnenberger [Sat, 13 Jul 2013 17:59:55 +0000 (17:59 +0000)]
Reduce large list of macros to the primary platform macros. Distingiush
between ELF (Linux, FreeBSD, NetBSD) and OSX as platform for the
assembler dialect.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@186252
91177308-0d34-0410-b5e6-
96231b3b80d8
Benjamin Kramer [Sat, 13 Jul 2013 17:30:25 +0000 (17:30 +0000)]
Convert a couple of grep tests to FileCheck.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@186250
91177308-0d34-0410-b5e6-
96231b3b80d8
Benjamin Kramer [Sat, 13 Jul 2013 15:21:39 +0000 (15:21 +0000)]
Only verify the length in archive test, we can't make assumptions on the spacing.
And .* did just match about anything anyways.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@186246
91177308-0d34-0410-b5e6-
96231b3b80d8
Rafael Espindola [Sat, 13 Jul 2013 12:36:30 +0000 (12:36 +0000)]
Attempt at fixing a mingw bot.
It is failing with
YAMLTest.cpp:38: instantiated from here
YAMLTraits.h:226: error: 'llvm::yaml::MappingTraits<<unnamed>::BinaryHolder>::mapping' is not a valid template argument for type 'void (*)(llvm::yaml::IO&, <unnamed>::BinaryHolder&)' because function 'static void llvm::yaml::MappingTraits<<unnamed>::BinaryHolder>::mapping(llvm::yaml::IO&, <unnamed>::BinaryHolder&)' has not external linkage
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@186245
91177308-0d34-0410-b5e6-
96231b3b80d8
Craig Topper [Sat, 13 Jul 2013 08:28:45 +0000 (08:28 +0000)]
Remove unneeded forward declarations.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@186244
91177308-0d34-0410-b5e6-
96231b3b80d8
Craig Topper [Sat, 13 Jul 2013 07:43:40 +0000 (07:43 +0000)]
Pass SmallVector by const reference instead of by value.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@186243
91177308-0d34-0410-b5e6-
96231b3b80d8
Andrew Trick [Sat, 13 Jul 2013 06:40:33 +0000 (06:40 +0000)]
Make the new vectorizer test immune to TTI
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@186242
91177308-0d34-0410-b5e6-
96231b3b80d8
Andrew Trick [Sat, 13 Jul 2013 06:20:06 +0000 (06:20 +0000)]
LoopVectorize fix: LoopInfo must be valid when invoking utils like SCEVExpander.
In general, one should always complete CFG modifications first, update
CFG-based analyses, like Dominatores and LoopInfo, then generate
instruction sequences.
LoopVectorizer was creating a new loop, calling SCEVExpander to
generate checks, then updating LoopInfo. I just changed the order.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@186241
91177308-0d34-0410-b5e6-
96231b3b80d8
Rafael Espindola [Sat, 13 Jul 2013 05:07:22 +0000 (05:07 +0000)]
Try to open the file before use data from stat.
Looks like on mingw we get bogus last modification times on directories.
Should fix the mingw bots.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@186240
91177308-0d34-0410-b5e6-
96231b3b80d8
Rafael Espindola [Sat, 13 Jul 2013 04:24:33 +0000 (04:24 +0000)]
Remove unused file. Thanks to Sean Silva for noticing it.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@186239
91177308-0d34-0410-b5e6-
96231b3b80d8
Rafael Espindola [Sat, 13 Jul 2013 04:14:13 +0000 (04:14 +0000)]
Add r186216 back, but make the test tolerant of different uids and gids.
original message:
Fix a off by one error about which members need to use the string table.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@186238
91177308-0d34-0410-b5e6-
96231b3b80d8
Nick Lewycky [Sat, 13 Jul 2013 01:16:47 +0000 (01:16 +0000)]
Add a microoptimization for urem.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@186235
91177308-0d34-0410-b5e6-
96231b3b80d8
Chandler Carruth [Sat, 13 Jul 2013 01:00:17 +0000 (01:00 +0000)]
Revert commit r186217 -- this is breaking bots:
http://lab.llvm.org:8013/builders/clang-x86_64-darwin11-nobootstrap-RAincremental/builds/4328
Original commit log:
Use the function attributes to pass along the stack protector buffer
size.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@186234
91177308-0d34-0410-b5e6-
96231b3b80d8
Chandler Carruth [Sat, 13 Jul 2013 00:42:56 +0000 (00:42 +0000)]
Revert commit r186216 -- it's breaking bots:
http://lab.llvm.org:8011/builders/clang-x86_64-debian-fast/builds/6897/steps/check-all/logs/LLVM%3A%3Aarchive-format.test
Original commit log:
Fix a off by one error about which members need to use the string
table.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@186232
91177308-0d34-0410-b5e6-
96231b3b80d8
Akira Hatanaka [Fri, 12 Jul 2013 23:47:38 +0000 (23:47 +0000)]
[mips] Remove trailing whitespace.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@186230
91177308-0d34-0410-b5e6-
96231b3b80d8
Nick Lewycky [Fri, 12 Jul 2013 23:42:57 +0000 (23:42 +0000)]
Fix logic error optimizing "icmp pred (urem X, Y), Y" where pred is signed.
Fixes PR16605.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@186229
91177308-0d34-0410-b5e6-
96231b3b80d8
Akira Hatanaka [Fri, 12 Jul 2013 23:33:22 +0000 (23:33 +0000)]
[mips] Implement MipsTargetMachine::getInstrItineraryData().
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@186227
91177308-0d34-0410-b5e6-
96231b3b80d8
JF Bastien [Fri, 12 Jul 2013 23:33:03 +0000 (23:33 +0000)]
Fix ARM paired GPR COPY lowering
ARM paired GPR COPY was being lowered to two MOVr without CC. This
patch puts the CC back.
My test is a reduction of the case where I encountered the issue,
64-bit atomics use paired GPRs.
The issue only occurs with selectionDAG, FastISel doesn't encounter it
so I didn't bother calling it.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@186226
91177308-0d34-0410-b5e6-
96231b3b80d8
Michael Gottesman [Fri, 12 Jul 2013 23:09:43 +0000 (23:09 +0000)]
Fixed 80+ violation and added C++ to header.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@186225
91177308-0d34-0410-b5e6-
96231b3b80d8
Joey Gouly [Fri, 12 Jul 2013 23:08:06 +0000 (23:08 +0000)]
Fix a crash in EvaluateInDifferentElementOrder where it would generate an
undef vector of the wrong type.
LGTM'd by Nick Lewycky on IRC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@186224
91177308-0d34-0410-b5e6-
96231b3b80d8