oota-llvm.git
13 years agoAdd encodings and mnemonics for FXSAVE64 and FXRSTOR64.
Reid Kleckner [Sat, 12 Feb 2011 23:24:13 +0000 (23:24 +0000)]
Add encodings and mnemonics for FXSAVE64 and FXRSTOR64.

These are just FXSAVE and FXRSTOR with REX.W prefixes.  These versions use
64-bit pointer values instead of 32-bit pointer values in the memory map they
dump and restore.

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

13 years agoPrevent IMPLICIT_DEF/KILL to become a delay filler instruction in SPARC backend.
Venkatraman Govindaraju [Sat, 12 Feb 2011 19:02:33 +0000 (19:02 +0000)]
Prevent IMPLICIT_DEF/KILL to become a delay filler instruction in SPARC backend.

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

13 years agoSimplifyLibCalls: Add missing legalize check on various printf to puts and
Daniel Dunbar [Sat, 12 Feb 2011 18:19:57 +0000 (18:19 +0000)]
SimplifyLibCalls: Add missing legalize check on various printf to puts and
putchar transforms, their return values are not compatible.

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

13 years agotests: FileCheckize
Daniel Dunbar [Sat, 12 Feb 2011 18:19:53 +0000 (18:19 +0000)]
tests: FileCheckize

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

13 years agoPreserve aliases if needed.
Rafael Espindola [Sat, 12 Feb 2011 18:03:13 +0000 (18:03 +0000)]
Preserve aliases if needed.

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

13 years agoAdd a note about SSE4.1 roundss/roundsd.
Benjamin Kramer [Sat, 12 Feb 2011 17:58:16 +0000 (17:58 +0000)]
Add a note about SSE4.1 roundss/roundsd.

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

13 years agoA fix for 9165.
Nadav Rotem [Sat, 12 Feb 2011 14:40:33 +0000 (14:40 +0000)]
A fix for 9165.

The DAGCombiner created illegal BUILD_VECTOR operations.
The patch added a check that either illegal operations are
allowed or that the created operation is legal.

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

13 years agoAsmMatcher custom operand parser failure enhancements.
Jim Grosbach [Sat, 12 Feb 2011 01:34:40 +0000 (01:34 +0000)]
AsmMatcher custom operand parser failure enhancements.

Teach the AsmMatcher handling to distinguish between an error custom-parsing
an operand and a failure to match. The former should propogate the error
upwards, while the latter should continue attempting to parse with
alternative matchers.

Update the ARM asm parser accordingly.

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

13 years agoFix a silly bug I introduced when dropping std::string.
Rafael Espindola [Sat, 12 Feb 2011 00:19:56 +0000 (00:19 +0000)]
Fix a silly bug I introduced when dropping std::string.

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

13 years agoattempt to capture recent discussion about overflow and inbounds geps.
Chris Lattner [Fri, 11 Feb 2011 21:50:52 +0000 (21:50 +0000)]
attempt to capture recent discussion about overflow and inbounds geps.

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

13 years agoAlso fold (A+B) == A -> B == 0 when the add is commuted.
Benjamin Kramer [Fri, 11 Feb 2011 21:46:48 +0000 (21:46 +0000)]
Also fold (A+B) == A -> B == 0 when the add is commuted.

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

13 years agoPer discussion with Dan G, inbounds geps *certainly* can have
Chris Lattner [Fri, 11 Feb 2011 21:43:33 +0000 (21:43 +0000)]
Per discussion with Dan G, inbounds geps *certainly* can have
unsigned overflow (e.g. "gep P, -1"), and while they can have
signed wrap in theoretical situations, modelling an AddRec as
not having signed wrap is going enough for any case we can
think of today.  In the future if this isn't enough, we can
revisit this.  Modeling them as having NUW isn't causing any
known problems either FWIW.

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

13 years agoWhen lowering an inbounds gep, the intermediate adds can have
Chris Lattner [Fri, 11 Feb 2011 21:37:43 +0000 (21:37 +0000)]
When lowering an inbounds gep, the intermediate adds can have
unsigned overflow (e.g. due to a negative array index), but
the scales on array size multiplications are known to not
sign wrap.

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

13 years agoTidy out asm matcher .inc output.
Jim Grosbach [Fri, 11 Feb 2011 21:31:55 +0000 (21:31 +0000)]
Tidy out asm matcher .inc output.

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

13 years agoAdds llvm::sys::path::is_separator() to test whether a char is a path separator
Zhanyong Wan [Fri, 11 Feb 2011 21:24:40 +0000 (21:24 +0000)]
Adds llvm::sys::path::is_separator() to test whether a char is a path separator
on the host OS.  Reviewed by dgregor.

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

13 years agoImplement sdiv & udiv for <4 x i16> and <8 x i8> NEON vector types.
Nate Begeman [Fri, 11 Feb 2011 20:53:29 +0000 (20:53 +0000)]
Implement sdiv & udiv for <4 x i16> and <8 x i8> NEON vector types.
This avoids moving each element to the integer register file and calling __divsi3 etc. on it.

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

13 years agoSimplifySelectOps can only handle selects with a scalar condition. Add a check
Nadav Rotem [Fri, 11 Feb 2011 19:57:47 +0000 (19:57 +0000)]
SimplifySelectOps can only handle selects with a scalar condition. Add a check
that the condition is not a vector.

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

13 years agoFix 9173.
Nadav Rotem [Fri, 11 Feb 2011 19:37:55 +0000 (19:37 +0000)]
Fix 9173.

Add more folding patterns to constant expressions of vector selects and vector
bitcasts.

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

13 years agoFix #9190
Nadav Rotem [Fri, 11 Feb 2011 19:20:37 +0000 (19:20 +0000)]
Fix #9190

The bug happens when the DAGCombiner attempts to optimize one of the patterns
of the SUB opcode. It tries to create a zero of type v2i64. This type is legal
on 32bit machines, but the initializer of this vector (i64) is target dependent.
Currently, the initializer attempts to create an i64 zero constant, which fails.
Added a flag to tell the DAGCombiner to create a legal zero, if we require that
the pass would generate legal types.

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

13 years agoTest commit.
Nadav Rotem [Fri, 11 Feb 2011 19:11:57 +0000 (19:11 +0000)]
Test commit.

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

13 years agoMore whitespace cleanup...
Jim Grosbach [Fri, 11 Feb 2011 19:05:56 +0000 (19:05 +0000)]
More whitespace cleanup...

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

13 years agoRemove trailing whitespace.
Jim Grosbach [Fri, 11 Feb 2011 18:45:44 +0000 (18:45 +0000)]
Remove trailing whitespace.

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

13 years agoPoison the relational operators ==, !=, <, <=, >=, > on llvm::Optional
Douglas Gregor [Fri, 11 Feb 2011 18:13:20 +0000 (18:13 +0000)]
Poison the relational operators ==, !=, <, <=, >=, > on llvm::Optional
objects, since they'll end up using the implicit conversion to "bool"
and causing some very "fun" surprises.

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

13 years agoMake LoopUnswitch preserve ScalarEvolution by just forgetting everything about
Cameron Zwarich [Fri, 11 Feb 2011 06:08:28 +0000 (06:08 +0000)]
Make LoopUnswitch preserve ScalarEvolution by just forgetting everything about
a loop when unswitching it. It only does this in the complex case, because
everything should be fine already in the simple case.

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

13 years agoLoopInstSimplify preserves ScalarEvolution.
Cameron Zwarich [Fri, 11 Feb 2011 06:08:25 +0000 (06:08 +0000)]
LoopInstSimplify preserves ScalarEvolution.

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

13 years agofix dumping of METADATA_ATTACHMENT2 names, patch by Peter Housel!
Chris Lattner [Fri, 11 Feb 2011 05:50:01 +0000 (05:50 +0000)]
fix dumping of METADATA_ATTACHMENT2 names, patch by Peter Housel!

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

13 years agomake ConstantExpr::replaceUsesOfWithOnConstant preserve the inbounds
Chris Lattner [Fri, 11 Feb 2011 05:37:21 +0000 (05:37 +0000)]
make ConstantExpr::replaceUsesOfWithOnConstant preserve the inbounds
flag.  Noticed by Jin Gu Kang!

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

13 years agomake the constantexpr interfaces for inbounds GEPs follow the same style
Chris Lattner [Fri, 11 Feb 2011 05:34:33 +0000 (05:34 +0000)]
make the constantexpr interfaces for inbounds GEPs follow the same style
as other constantexpr flags, reducing redundancy.

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

13 years agoRemove std::string version of getNameWithPrefix.
Rafael Espindola [Fri, 11 Feb 2011 05:23:09 +0000 (05:23 +0000)]
Remove std::string version of getNameWithPrefix.

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

13 years agoDisable this test for now...
Daniel Dunbar [Fri, 11 Feb 2011 02:59:08 +0000 (02:59 +0000)]
Disable this test for now...

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

13 years agoFix buggy fcopysign lowering.
Evan Cheng [Fri, 11 Feb 2011 02:28:55 +0000 (02:28 +0000)]
Fix buggy fcopysign lowering.
This
define float @foo(float %x, float %y) nounwind readnone {
entry:
  %0 = tail call float @copysignf(float %x, float %y) nounwind readnone
  ret float %0
}

Was compiled to:
    vmov     s0, r1
    bic      r0, r0, #-2147483648
    vmov     s1, r0
    vcmpe.f32    s0, #0
    vmrs         apsr_nzcv, fpscr
    it           lt
    vneglt.f32   s1, s1
    vmov         r0, s1
    bx           lr

This fails to copy the sign of -0.0f because it's lost during the float to int
conversion. Also, it's sub-optimal when the inputs are in GPR registers.

Now it uses integer and + or operations when it's profitable. And it's correct!
    lsrs    r1, r1, #31
    bfi     r0, r1, #31, #1
    bx      lr
rdar://8984306

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

13 years agoRemove trailing whitespace.
Jim Grosbach [Fri, 11 Feb 2011 01:21:00 +0000 (01:21 +0000)]
Remove trailing whitespace.

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

13 years agoAdd a test for the LSR issue exposed by r125254.
Cameron Zwarich [Fri, 11 Feb 2011 00:49:27 +0000 (00:49 +0000)]
Add a test for the LSR issue exposed by r125254.

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

13 years agoTolerate degenerate phi nodes that can occur in the middle of optimization
Nick Lewycky [Thu, 10 Feb 2011 23:54:10 +0000 (23:54 +0000)]
Tolerate degenerate phi nodes that can occur in the middle of optimization
passes. Fixes PR9112. Patch by Jakub Staszak!

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

13 years agoIf we can't avoid running loop-simplify twice for now, at least avoid running
Cameron Zwarich [Thu, 10 Feb 2011 23:53:14 +0000 (23:53 +0000)]
If we can't avoid running loop-simplify twice for now, at least avoid running
iv-users twice.

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

13 years agoRename 'loopsimplify' to 'loop-simplify'.
Cameron Zwarich [Thu, 10 Feb 2011 23:38:10 +0000 (23:38 +0000)]
Rename 'loopsimplify' to 'loop-simplify'.

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

13 years agoAdd mips o32 tests again with the hope that the buildbot won't complaint again
Bruno Cardoso Lopes [Thu, 10 Feb 2011 23:37:20 +0000 (23:37 +0000)]
Add mips o32 tests again with the hope that the buildbot won't complaint again

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

13 years ago[AVX] Implement 256-bit vector lowering for SCALAR_TO_VECTOR. This
David Greene [Thu, 10 Feb 2011 23:11:29 +0000 (23:11 +0000)]
[AVX] Implement 256-bit vector lowering for SCALAR_TO_VECTOR.  This
largely completes support for 128-bit fallback lowering for code that
is not 256-bit ready.

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

13 years agoRemove the test to silence the buildbot, will check it in again with a proper fix...
Bruno Cardoso Lopes [Thu, 10 Feb 2011 20:10:17 +0000 (20:10 +0000)]
Remove the test to silence the buildbot, will check it in again with a proper fix soon

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

13 years agoClean trailing whitespace.
Owen Anderson [Thu, 10 Feb 2011 19:56:23 +0000 (19:56 +0000)]
Clean trailing whitespace.

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

13 years agoFix a lot of o32 CC issues and add a bunch of tests. Patch by Akira Hatanaka with...
Bruno Cardoso Lopes [Thu, 10 Feb 2011 18:05:10 +0000 (18:05 +0000)]
Fix a lot of o32 CC issues and add a bunch of tests. Patch by Akira Hatanaka with some small modifications by me.

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

13 years ago[AVX] Implement 256-bit vector lowering for EXTRACT_VECTOR_ELT.
David Greene [Thu, 10 Feb 2011 16:57:36 +0000 (16:57 +0000)]
[AVX] Implement 256-bit vector lowering for EXTRACT_VECTOR_ELT.

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

13 years agoptx: add passing parameter to kernel functions
Che-Liang Chiou [Thu, 10 Feb 2011 12:01:24 +0000 (12:01 +0000)]
ptx: add passing parameter to kernel functions

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

13 years agoCMake: LLVM_LIT_TOOLS_DIR is needed only on Win32 hosts to use GnuWin32 tools.
NAKAMURA Takumi [Thu, 10 Feb 2011 10:29:42 +0000 (10:29 +0000)]
CMake: LLVM_LIT_TOOLS_DIR is needed only on Win32 hosts to use GnuWin32 tools.

Unixen and Cygwin do not need it.

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

13 years agoCMake: LLVM_NO_RTTI must be obsolete now!
NAKAMURA Takumi [Thu, 10 Feb 2011 09:13:39 +0000 (09:13 +0000)]
CMake: LLVM_NO_RTTI must be obsolete now!

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

13 years agolit/TestFormats.py: Unittests may be found with suffix .exe also on Cygwin.
NAKAMURA Takumi [Thu, 10 Feb 2011 09:11:57 +0000 (09:11 +0000)]
lit/TestFormats.py: Unittests may be found with suffix .exe also on Cygwin.

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

13 years agolit/Util.py: On Cygwin, 'PATHEXT' may exist but it should not be used.
NAKAMURA Takumi [Thu, 10 Feb 2011 09:11:48 +0000 (09:11 +0000)]
lit/Util.py: On Cygwin, 'PATHEXT' may exist but it should not be used.

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

13 years agoimplement the first part of PR8882: when lowering an inbounds
Chris Lattner [Thu, 10 Feb 2011 07:11:16 +0000 (07:11 +0000)]
implement the first part of PR8882: when lowering an inbounds
gep to explicit addressing, we know that none of the intermediate
computation overflows.

This could use review: it seems that the shifts certainly wouldn't
overflow, but could the intermediate adds overflow if there is a
negative index?

Previously the testcase would instcombine to:

define i1 @test(i64 %i) {
  %p1.idx.mask = and i64 %i, 4611686018427387903
  %cmp = icmp eq i64 %p1.idx.mask, 1000
  ret i1 %cmp
}

now we get:

define i1 @test(i64 %i) {
  %cmp = icmp eq i64 %i, 1000
  ret i1 %cmp
}

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

13 years agoswitch the constantexpr, target folder, and IRBuilder interfaces
Chris Lattner [Thu, 10 Feb 2011 07:01:55 +0000 (07:01 +0000)]
switch the constantexpr, target folder, and IRBuilder interfaces
for NSW/NUW binops to follow the pattern of exact binops.  This
allows someone to use Builder.CreateAdd(x, y, "tmp", MaybeNUW);

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

13 years agoEnhance a bunch of transformations in instcombine to start generating
Chris Lattner [Thu, 10 Feb 2011 05:36:31 +0000 (05:36 +0000)]
Enhance a bunch of transformations in instcombine to start generating
exact/nsw/nuw shifts and have instcombine infer them when it can prove
that the relevant properties are true for a given shift without them.

Also, a variety of refactoring to use the new patternmatch logic thrown
in for good luck.  I believe that this takes care of a bunch of related
code quality issues attached to PR8862.

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

13 years agoEnhance the "compare with shift" and "compare with div"
Chris Lattner [Thu, 10 Feb 2011 05:23:05 +0000 (05:23 +0000)]
Enhance the "compare with shift" and "compare with div"
optimizations to be much more aggressive in the face of
exact/nsw/nuw div and shifts.  For example, these (which
are the same except the first is 'exact' sdiv:

define i1 @sdiv_icmp4_exact(i64 %X) nounwind {
  %A = sdiv exact i64 %X, -5   ; X/-5 == 0 --> x == 0
  %B = icmp eq i64 %A, 0
  ret i1 %B
}

define i1 @sdiv_icmp4(i64 %X) nounwind {
  %A = sdiv i64 %X, -5   ; X/-5 == 0 --> x == 0
  %B = icmp eq i64 %A, 0
  ret i1 %B
}

compile down to:

define i1 @sdiv_icmp4_exact(i64 %X) nounwind {
  %1 = icmp eq i64 %X, 0
  ret i1 %1
}

define i1 @sdiv_icmp4(i64 %X) nounwind {
  %X.off = add i64 %X, 4
  %1 = icmp ult i64 %X.off, 9
  ret i1 %1
}

This happens when you do something like:
  (ptr1-ptr2) == 42

where the pointers are pointers to non-unit types.

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

13 years agomore cleanups, notably bitcast isn't used for "signed to unsigned type
Chris Lattner [Thu, 10 Feb 2011 05:17:27 +0000 (05:17 +0000)]
more cleanups, notably bitcast isn't used for "signed to unsigned type
conversions". :)

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

13 years agoA bunch of cleanups and simplifications using the new PatternMatch predicates
Chris Lattner [Thu, 10 Feb 2011 05:14:58 +0000 (05:14 +0000)]
A bunch of cleanups and simplifications using the new PatternMatch predicates
and generally tidying things up.  Only very trivial functionality changes
like now doing (-1 - A) -> (~A) for vectors too.

 InstCombineAddSub.cpp |  296 +++++++++++++++++++++-----------------------------
 1 file changed, 126 insertions(+), 170 deletions(-)

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

13 years agoteach SimplifyDemandedBits that exact shifts demand the bits they
Chris Lattner [Thu, 10 Feb 2011 05:09:34 +0000 (05:09 +0000)]
teach SimplifyDemandedBits that exact shifts demand the bits they
are shifting out since they do require them to be zeros.  Similarly
for NUW/NSW bits of shl

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

13 years agoAfter 3-addressifying a two-address instruction, update the register maps; add a...
Evan Cheng [Thu, 10 Feb 2011 02:20:55 +0000 (02:20 +0000)]
After 3-addressifying a two-address instruction, update the register maps; add a missing check when considering whether it's profitable to commute. rdar://8977508.

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

13 years agoRevert this in an attempt to bring the builders back.
Eric Christopher [Thu, 10 Feb 2011 01:48:24 +0000 (01:48 +0000)]
Revert this in an attempt to bring the builders back.

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

13 years agoDon't return before calling the post-processing function(s).
Bill Wendling [Thu, 10 Feb 2011 01:28:26 +0000 (01:28 +0000)]
Don't return before calling the post-processing function(s).

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

13 years agoTurn this pass ordering:
Cameron Zwarich [Thu, 10 Feb 2011 01:07:54 +0000 (01:07 +0000)]
Turn this pass ordering:

Natural Loop Information
 Loop Pass Manager
   Canonicalize natural loops
 Scalar Evolution Analysis
 Loop Pass Manager
   Induction Variable Users
   Canonicalize natural loops
   Induction Variable Users
   Loop Strength Reduction

into this:

Scalar Evolution Analysis
Loop Pass Manager
  Canonicalize natural loops
  Induction Variable Users
  Loop Strength Reduction

This fixes <rdar://problem/8869639>. I also filed PR9184 on doing this sort of
thing automatically, but it seems easier to just change the ordering of the
passes if this is the only case.

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

13 years agoDo AsmMatcher operand classification per-opcode.
Jim Grosbach [Thu, 10 Feb 2011 00:08:28 +0000 (00:08 +0000)]
Do AsmMatcher operand classification per-opcode.

When matching operands for a candidate opcode match in the auto-generated
AsmMatcher, check each operand against the expected operand match class.
Previously, operands were classified independently of the opcode being
handled, which led to difficulties when operand match classes were
more complicated than simple subclass relationships.

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

13 years agoDelete unused code for analyzing and splitting around loops.
Jakob Stoklund Olesen [Wed, 9 Feb 2011 23:56:18 +0000 (23:56 +0000)]
Delete unused code for analyzing and splitting around loops.

Loop splitting is better handled by the more generic global region splitting
based on the edge bundle graph.

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

13 years agoRip out realpath() support. It's expensive, and often a bad idea, and
Douglas Gregor [Wed, 9 Feb 2011 23:33:15 +0000 (23:33 +0000)]
Rip out realpath() support. It's expensive, and often a bad idea, and
I have another way to achieve the same goal.

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

13 years agoSimplify using the new leaveIntvBefore()
Jakob Stoklund Olesen [Wed, 9 Feb 2011 23:33:02 +0000 (23:33 +0000)]
Simplify using the new leaveIntvBefore()

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

13 years agoUse the LiveBLocks array for SplitEditor::splitSingleBlocks() as well.
Jakob Stoklund Olesen [Wed, 9 Feb 2011 23:30:25 +0000 (23:30 +0000)]
Use the LiveBLocks array for SplitEditor::splitSingleBlocks() as well.

This fixes a bug where splitSingleBlocks() could split a live range after a
terminator instruction.

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

13 years agoAttempt to fix the build after r125228.
Cameron Zwarich [Wed, 9 Feb 2011 23:02:14 +0000 (23:02 +0000)]
Attempt to fix the build after r125228.

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

13 years agoTypo.
Mikhail Glushenkov [Wed, 9 Feb 2011 22:55:48 +0000 (22:55 +0000)]
Typo.

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

13 years agoMove calcLiveBlockInfo() and the BlockInfo struct into SplitAnalysis.
Jakob Stoklund Olesen [Wed, 9 Feb 2011 22:50:26 +0000 (22:50 +0000)]
Move calcLiveBlockInfo() and the BlockInfo struct into SplitAnalysis.

No functional changes intended.

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

13 years agoAdd llvm::sys::path::canonical(), which provides the canonicalized
Douglas Gregor [Wed, 9 Feb 2011 22:11:23 +0000 (22:11 +0000)]
Add llvm::sys::path::canonical(), which provides the canonicalized
name of a path, after resolving symbolic links and eliminating excess
path elements such as "foo/../" and "./".

This routine still needs a Windows implementation, but I don't have a
Windows machine available. Help? Please?

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

13 years agoIgnore <undef> uses when analyzing and rewriting.
Jakob Stoklund Olesen [Wed, 9 Feb 2011 21:52:09 +0000 (21:52 +0000)]
Ignore <undef> uses when analyzing and rewriting.

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

13 years agoAssert on bad jump tables.
Jakob Stoklund Olesen [Wed, 9 Feb 2011 21:52:06 +0000 (21:52 +0000)]
Assert on bad jump tables.

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

13 years agoAdd tags to live interval unions to avoid using stale queries.
Jakob Stoklund Olesen [Wed, 9 Feb 2011 21:52:03 +0000 (21:52 +0000)]
Add tags to live interval unions to avoid using stale queries.

The tag is updated whenever the live interval union is changed, and it is tested
before using cached information.

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

13 years agoFix comparator used for looking up previously instantiated EDDisassemblers.
Shantonu Sen [Wed, 9 Feb 2011 21:03:19 +0000 (21:03 +0000)]
Fix comparator used for looking up previously instantiated EDDisassemblers.

Now, Syntax is only used as a tie-breaker if the Arch
matches. Previously, a request for x86_64 disassembler followed by the
i386 disassembler in a single process would return the cached x86_64
disassembler. Fixes <rdar://problem/8958982>

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

13 years agoOptimize po_iterator: don't do redundant lookups.
Dan Gohman [Wed, 9 Feb 2011 19:25:31 +0000 (19:25 +0000)]
Optimize po_iterator: don't do redundant lookups.

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

13 years agoDon't run ocamldoc if it's not installed
Erick Tryzelaar [Wed, 9 Feb 2011 18:32:04 +0000 (18:32 +0000)]
Don't run ocamldoc if it's not installed

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

13 years agoFix compiling the ocaml kaleidoscope tutorials
Erick Tryzelaar [Wed, 9 Feb 2011 18:32:02 +0000 (18:32 +0000)]
Fix compiling the ocaml kaleidoscope tutorials

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

13 years agoFormatting and comment tweaks.
Duncan Sands [Wed, 9 Feb 2011 17:45:03 +0000 (17:45 +0000)]
Formatting and comment tweaks.

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

13 years agoTeach instsimplify some tricks about exact/nuw/nsw shifts.
Chris Lattner [Wed, 9 Feb 2011 17:15:04 +0000 (17:15 +0000)]
Teach instsimplify some tricks about exact/nuw/nsw shifts.
improve interfaces to instsimplify to take this info.

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

13 years agomerge two tests.
Chris Lattner [Wed, 9 Feb 2011 17:06:41 +0000 (17:06 +0000)]
merge two tests.

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

13 years agoRework InstrTypes.h so to reduce the repetition around the NSW/NUW/Exact
Chris Lattner [Wed, 9 Feb 2011 17:00:45 +0000 (17:00 +0000)]
Rework InstrTypes.h so to reduce the repetition around the NSW/NUW/Exact
versions of creation functions.  Eventually, the "insertion point" versions
of these should just be removed, we do have IRBuilder afterall.

Do a massive rewrite of much of pattern match.  It is now shorter and less
redundant and has several other widgets I will be using in other patches.
Among other changes, m_Div is renamed to m_IDiv (since it only matches
integer divides) and m_Shift is gone (it used to match all binops!!) and
we now have m_LogicalShift for the one client to use.

Enhance IRBuilder to have "isExact" arguments to things like CreateUDiv
and reduce redundancy within IRbuilder by having these methods chain to
each other more instead of duplicating code.

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

13 years agoemit a specific error when the input file is empty. This fixes
Chris Lattner [Wed, 9 Feb 2011 16:46:02 +0000 (16:46 +0000)]
emit a specific error when the input file is empty.  This fixes
an annoyance of mine when working on tests: if the input .ll file
is broken, opt outputs an error and generates an empty file.  FileCheck
then emits its "ooh I couldn't find the first CHECK line, scanning
from ..." which obfuscates the actual problem.

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

13 years agofix typo
Chris Lattner [Wed, 9 Feb 2011 16:44:44 +0000 (16:44 +0000)]
fix typo

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

13 years agoenrich folder interfaces around exactness.
Chris Lattner [Wed, 9 Feb 2011 16:44:36 +0000 (16:44 +0000)]
enrich folder interfaces around exactness.

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

13 years agorefactor ConstantExpr interfaces a bit around "exactness".
Chris Lattner [Wed, 9 Feb 2011 16:43:07 +0000 (16:43 +0000)]
refactor ConstantExpr interfaces a bit around "exactness".

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

13 years agoremove a small scattering of basically pointless tests. These are
Chris Lattner [Wed, 9 Feb 2011 16:41:31 +0000 (16:41 +0000)]
remove a small scattering of basically pointless tests.  These are
all covered by llvm-test, which is what they were reduced from back
in 2003.

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

13 years agoremove a broken test, this is matching nounwind on intrinsics, not the old unwind...
Chris Lattner [Wed, 9 Feb 2011 16:40:56 +0000 (16:40 +0000)]
remove a broken test, this is matching nounwind on intrinsics, not the old unwind instruction

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

13 years ago[AVX] Implement 256-bit vector lowering for INSERT_VECTOR_ELT.
David Greene [Wed, 9 Feb 2011 15:32:06 +0000 (15:32 +0000)]
[AVX] Implement 256-bit vector lowering for INSERT_VECTOR_ELT.

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

13 years agoAdd intrinsic for setc instruction on the XCore.
Richard Osborne [Wed, 9 Feb 2011 13:22:12 +0000 (13:22 +0000)]
Add intrinsic for setc instruction on the XCore.

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

13 years agoWhen removing a function from the function set and adding it to deferred, we
Nick Lewycky [Wed, 9 Feb 2011 06:32:02 +0000 (06:32 +0000)]
When removing a function from the function set and adding it to deferred, we
could end up removing a different function than we intended because it was
functionally equivalent, then end up with a comparison of a function against
itself in the next round of comparisons (the one in the function set and the
one on the deferred list). To fix this, I introduce a choice in the form of
comparison for ComparableFunctions, either normal or "pointer only" used to
find exact Function*'s in lookups.

Also add some debugging statements.

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

13 years agoAdd testing stuff to CMake documents.
NAKAMURA Takumi [Wed, 9 Feb 2011 04:19:28 +0000 (04:19 +0000)]
Add testing stuff to CMake documents.

  - Note "GnuWin32".
  - Note LLVM_LIT_TOOLS_DIR
  - Now we can run tests on VS w/e all tests might pass or not!

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

13 years agotest/lit.cfg: Seek sane tools(and bash) in directories and set to $PATH.
NAKAMURA Takumi [Wed, 9 Feb 2011 04:19:21 +0000 (04:19 +0000)]
test/lit.cfg: Seek sane tools(and bash) in directories and set to $PATH.

LitConfig.getBashPath() will not seek in $PATH after LitConfig.getToolsPath() was executed.

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

13 years agolit/LitConfig.py: Add the new method getToolsPath(dir,paths,tools).
NAKAMURA Takumi [Wed, 9 Feb 2011 04:19:15 +0000 (04:19 +0000)]
lit/LitConfig.py: Add the new method getToolsPath(dir,paths,tools).

It seeks tools(eg. [cmp, grep, sed]) in same directory, to be sane.

It seeks "bash" only in the directory found at last time. Or bash would be insane (against other tools).

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

13 years agolit/Util.py: Add two functions, checkToolsPath(dir,tools) and whichTools(tools,paths).
NAKAMURA Takumi [Wed, 9 Feb 2011 04:19:06 +0000 (04:19 +0000)]
lit/Util.py: Add two functions, checkToolsPath(dir,tools) and whichTools(tools,paths).

checkToolsPath(dir,tools):
return True if "dir" contains all "tools".

whichTools(tools,paths):
return a directory that contains all "tools" in "paths".
Or return None when all "tools" were not met.

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

13 years agoCMake: Add the new option LLVM_LIT_TOOLS_DIR. It can specify "Path to GnuWin32 tools".
NAKAMURA Takumi [Wed, 9 Feb 2011 04:18:58 +0000 (04:18 +0000)]
CMake: Add the new option LLVM_LIT_TOOLS_DIR. It can specify "Path to GnuWin32 tools".

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

13 years agolib/Support/Errno.cpp: Check strerror_s() with HAVE_DECL_STRERROR_S in config.h.*.
NAKAMURA Takumi [Wed, 9 Feb 2011 04:18:48 +0000 (04:18 +0000)]
lib/Support/Errno.cpp: Check strerror_s() with HAVE_DECL_STRERROR_S in config.h.*.

AC_CHECK_FUNCS seeks a symbol only in libs. We should check the declaration in string.h.

FIXME: I have never seen mingw(s) have strerror_s() (not _strerror_s()).
FIXME: Autoconf/CMake may seek strerror_s() with the definition MINGW_HAS_SECURE_API in future.

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

13 years agoWindows/Windows.h: Redefine _WIN32_WINNT here. mingw-w64 tends to define it as 0x0502...
NAKAMURA Takumi [Wed, 9 Feb 2011 04:18:30 +0000 (04:18 +0000)]
Windows/Windows.h: Redefine _WIN32_WINNT here. mingw-w64 tends to define it as 0x0502 in its headers.

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

13 years agoWindows/Program.inc: Eliminate the declaration of SetInformationJobObject(). It shoul...
NAKAMURA Takumi [Wed, 9 Feb 2011 04:18:21 +0000 (04:18 +0000)]
Windows/Program.inc: Eliminate the declaration of SetInformationJobObject(). It should be provided with _WIN32_WINNT>=0x0500.

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

13 years agoWindows/DynamicLibrary.inc: ELM_Callback fix for mingw-w64.
NAKAMURA Takumi [Wed, 9 Feb 2011 04:18:12 +0000 (04:18 +0000)]
Windows/DynamicLibrary.inc: ELM_Callback fix for mingw-w64.

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

13 years agollvm-lit may be available with CMake.
NAKAMURA Takumi [Wed, 9 Feb 2011 04:18:02 +0000 (04:18 +0000)]
llvm-lit may be available with CMake.

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

13 years agollvm-lit may be able to invoke clang tests.
NAKAMURA Takumi [Wed, 9 Feb 2011 04:17:54 +0000 (04:17 +0000)]
llvm-lit may be able to invoke clang tests.

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

13 years agotools/llvm-ld/CMakeLists.txt: llvm-ld depends on llvm-stub at runtime.
NAKAMURA Takumi [Wed, 9 Feb 2011 04:17:47 +0000 (04:17 +0000)]
tools/llvm-ld/CMakeLists.txt: llvm-ld depends on llvm-stub at runtime.

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

13 years agotools/llvm-ld: Cygwin can handle #!shbang.
NAKAMURA Takumi [Wed, 9 Feb 2011 04:17:39 +0000 (04:17 +0000)]
tools/llvm-ld: Cygwin can handle #!shbang.

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