oota-llvm.git
13 years agoWhen checking for signed multiplication overflow, watch out for INT_MIN and -1.
Dan Gohman [Mon, 23 May 2011 21:07:39 +0000 (21:07 +0000)]
When checking for signed multiplication overflow, watch out for INT_MIN and -1.
This fixes PR9845.

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

13 years agoPropagate error correctly in the MC Asm parser for leading '$' expressions.
Jim Grosbach [Mon, 23 May 2011 20:36:04 +0000 (20:36 +0000)]
Propagate error correctly in the MC Asm parser for leading '$' expressions.

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

13 years agoFix MipsAsmPrinter::printSavedRegsBitmaskChange. Remove functions and variables
Akira Hatanaka [Mon, 23 May 2011 20:34:30 +0000 (20:34 +0000)]
Fix MipsAsmPrinter::printSavedRegsBitmaskChange. Remove functions and variables
in MipsFunctionInfo that are no longer used.

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

13 years agoclarify this, apparently it is confusing :)
Chris Lattner [Mon, 23 May 2011 20:17:44 +0000 (20:17 +0000)]
clarify this, apparently it is confusing :)

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

13 years agoChange StackDirection from StackGrowsUp to StackGrowsDown.
Akira Hatanaka [Mon, 23 May 2011 20:16:59 +0000 (20:16 +0000)]
Change StackDirection from StackGrowsUp to StackGrowsDown.

The following improvements are accomplished as a result of applying this patch:
- Fixed frame objects' offsets (relative to either the virtual frame pointer or
  the stack pointer) are set before instruction selection is completed. There is
  no need to wait until Prologue/Epilogue Insertion is run to set them.
- Calculation of final offsets of fixed frame objects is straightforward. It is
  no longer necessary to assign negative offsets to fixed objects for incoming
  arguments in order to distinguish them from the others.
- Since a fixed object has its relative offset set during instruction
  selection, there is no need to conservatively set its alignment to 4.
- It is no longer necessary to reorder non-fixed frame objects in
  MipsFrameLowering::adjustMipsStackFrame.

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

13 years agoTest case for r131908.
Devang Patel [Mon, 23 May 2011 17:49:29 +0000 (17:49 +0000)]
Test case for r131908.

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

13 years agoPreserve debug info during iSel by keeping DanglingDebugInfoMap live until end of...
Devang Patel [Mon, 23 May 2011 17:44:13 +0000 (17:44 +0000)]
Preserve debug info during iSel by keeping DanglingDebugInfoMap live until end of function.
Patch by Micah Villmow

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

13 years agoWhile replacing all uses of a SDValue with another value, do not forget to transfer...
Devang Patel [Mon, 23 May 2011 17:35:08 +0000 (17:35 +0000)]
While replacing all uses of a SDValue with another value, do not forget to transfer SDDbgValue.

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

13 years agoClear list of instructions without DebugLoc.
Devang Patel [Mon, 23 May 2011 17:34:18 +0000 (17:34 +0000)]
Clear list of instructions without DebugLoc.

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

13 years agoThe dragonegg option to disable LLVM optimizations changed.
Duncan Sands [Mon, 23 May 2011 16:50:29 +0000 (16:50 +0000)]
The dragonegg option to disable LLVM optimizations changed.

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

13 years agoImplement .seh_stackalloc and .seh_pushframe parsing.
Charles Davis [Mon, 23 May 2011 16:43:09 +0000 (16:43 +0000)]
Implement .seh_stackalloc and .seh_pushframe parsing.

I haven't implemented any of the ones that take registers yet. The problem is
that for x86-64 the streamer methods expect a native x86 register number (note:
%r8-%r15 want 8-15 instead of 0-7; same for %xmm8-%xmm15). I haven't figured
out exactly how I want to do that yet.

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

13 years agofix a really nasty basicaa mod/ref calculation bug that was causing miscompilation of
Chris Lattner [Mon, 23 May 2011 05:15:43 +0000 (05:15 +0000)]
fix a really nasty basicaa mod/ref calculation bug that was causing miscompilation of
UnitTests/ObjC/messages-2.m with the recent optimizer improvements.

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

13 years agoFix <rdar://problem/9476260> by having tail calls always generate 32-bit branches
Cameron Zwarich [Mon, 23 May 2011 01:57:17 +0000 (01:57 +0000)]
Fix <rdar://problem/9476260> by having tail calls always generate 32-bit branches
in Darwin Thumb2 code. Tail calls are already disabled on Thumb1.

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

13 years agorearrange two transforms, since one subsumes the other. Make the shift-exactness
Chris Lattner [Mon, 23 May 2011 00:32:19 +0000 (00:32 +0000)]
rearrange two transforms, since one subsumes the other.  Make the shift-exactness
xform recurse.

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

13 years agoTransform any logical shift of a power of two into an exact/NUW shift when
Chris Lattner [Mon, 23 May 2011 00:21:50 +0000 (00:21 +0000)]
Transform any logical shift of a power of two into an exact/NUW shift when
in a known-non-zero context.

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

13 years agoUse a more efficient data structure for the "operand map". The number of
Bill Wendling [Mon, 23 May 2011 00:18:33 +0000 (00:18 +0000)]
Use a more efficient data structure for the "operand map". The number of
operands to an instruction aren't great, so an iterative search is fairly quick
and doesn't have the overhead of std::map.

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

13 years agouse the valuetracking isPowerOfTwo function, which is more powerful than checking
Chris Lattner [Mon, 23 May 2011 00:09:55 +0000 (00:09 +0000)]
use the valuetracking isPowerOfTwo function, which is more powerful than checking
for a constant directly.  Thanks to Duncan for pointing this out.

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

13 years agoTeach valuetracking that byval arguments with a specified alignment are
Chris Lattner [Mon, 23 May 2011 00:03:39 +0000 (00:03 +0000)]
Teach valuetracking that byval arguments with a specified alignment are
aligned.

Teach memcpyopt to not give up all hope when confonted with an underaligned
memcpy feeding an overaligned byval.  If the *source* of the memcpy can be
determined to be adequeately aligned, or if it can be forced to be, we can
eliminate the memcpy.

This addresses PR9794.  We now compile the example into:

define i32 @f(%struct.p* nocapture byval align 8 %q) nounwind ssp {
entry:
  %call = call i32 @g(%struct.p* byval align 8 %q) nounwind
  ret i32 %call
}

in both x86-64 and x86-32 mode.  We still don't get a tailcall though,
because tailcalls apparently can't handle byval.

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

13 years agoadd a helper method to get the byval alignment of an argument.
Chris Lattner [Sun, 22 May 2011 23:57:23 +0000 (23:57 +0000)]
add a helper method to get the byval alignment of an argument.

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

13 years agoEliminate some temporary variables, and don't call getByValTypeAlignment
Chris Lattner [Sun, 22 May 2011 23:23:02 +0000 (23:23 +0000)]
Eliminate some temporary variables, and don't call getByValTypeAlignment
when we're just going to throw the result away.  No functionality change.

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

13 years agoadd test from PR9164
Chris Lattner [Sun, 22 May 2011 22:35:34 +0000 (22:35 +0000)]
add test from PR9164

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

13 years agotestcase for PR9378
Chris Lattner [Sun, 22 May 2011 22:32:53 +0000 (22:32 +0000)]
testcase for PR9378

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

13 years agoadd a missing alias to make us more bug compatible with gcc, PR9378
Chris Lattner [Sun, 22 May 2011 22:31:57 +0000 (22:31 +0000)]
add a missing alias to make us more bug compatible with gcc, PR9378

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

13 years agodocument thiscall, PR9101
Chris Lattner [Sun, 22 May 2011 22:28:47 +0000 (22:28 +0000)]
document thiscall, PR9101

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

13 years agoimplement PR9315, constant folding exp2 in terms of pow (since hosts without
Chris Lattner [Sun, 22 May 2011 22:22:35 +0000 (22:22 +0000)]
implement PR9315, constant folding exp2 in terms of pow (since hosts without
C99 runtimes don't have exp2).

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

13 years agoRTABI chapter 4.3.4 specifies __eabi_mem* calls. Specifically, __eabi_memset accepts...
Renato Golin [Sun, 22 May 2011 21:41:23 +0000 (21:41 +0000)]
RTABI chapter 4.3.4 specifies __eabi_mem* calls. Specifically, __eabi_memset accepts parameters (ptr, size, value) in a different order than GNU's memset (ptr, value, size), therefore the special lowering in AAPCS mode. Implementation by Evzen Muller.

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

13 years agoAdd methods to parse the SEH directives to the COFFAsmParser. Implement some
Charles Davis [Sun, 22 May 2011 21:12:15 +0000 (21:12 +0000)]
Add methods to parse the SEH directives to the COFFAsmParser. Implement some
of them, particularly the ones that don't take arguments. Also implement
.seh_proc and .seh_handler.

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

13 years agoadd a note.
Chris Lattner [Sun, 22 May 2011 18:28:46 +0000 (18:28 +0000)]
add a note.

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

13 years agoadd some random notes.
Chris Lattner [Sun, 22 May 2011 18:26:48 +0000 (18:26 +0000)]
add some random notes.

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

13 years agoTeach ValueTracking about x86 crc32 intrinsics.
Evan Cheng [Sun, 22 May 2011 18:25:30 +0000 (18:25 +0000)]
Teach ValueTracking about x86 crc32 intrinsics.

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

13 years agoCarve out a place in instcombine to put transformations which work knowing that their
Chris Lattner [Sun, 22 May 2011 18:18:41 +0000 (18:18 +0000)]
Carve out a place in instcombine to put transformations which work knowing that their
result is non-zero.  Implement an example optimization (PR9814), which allows us to
transform:
  A / ((1 << B) >>u 2)
into:
  A >>u (B-2)

which we compile into:

_divu3:                                 ## @divu3
leal -2(%rsi), %ecx
shrl %cl, %edi
movl %edi, %eax
ret

instead of:

_divu3:                                 ## @divu3
movb %sil, %cl
movl $1, %esi
shll %cl, %esi
shrl $2, %esi
movl %edi, %eax
xorl %edx, %edx
divl %esi, %eax
ret

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

13 years agoFix Bug 9386 - ARM disassembler failed to disassemble conditional bx
Johnny Chen [Sun, 22 May 2011 17:51:04 +0000 (17:51 +0000)]
Fix Bug 9386 - ARM disassembler failed to disassemble conditional bx

Modified the patch to .td file supplied by Jyun-Yan You.  Add a test case and
modified ARMDisassemblerCore.cpp a little bit.

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

13 years agoFix PR9815: I was trying to get out of "generating code and then
Chris Lattner [Sun, 22 May 2011 17:39:56 +0000 (17:39 +0000)]
Fix PR9815: I was trying to get out of "generating code and then
failing to form a memset, then having to delete it" but my approximation
isn't safe for self recurrent loops.  Instead of doign a hack, just
do it the right way.

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

13 years agoAdd a parameter to ConstantFoldTerminator() that callers can use to ask it to also...
Frits van Bommel [Sun, 22 May 2011 16:24:18 +0000 (16:24 +0000)]
Add a parameter to ConstantFoldTerminator() that callers can use to ask it to also clean up the condition of any conditional terminator it folds to be unconditional, if that turns the condition into dead code. This just means it calls RecursivelyDeleteTriviallyDeadInstructions() in strategic spots. It defaults to the old behavior.

I also changed -simplifycfg, -jump-threading and -codegenprepare to use this to produce slightly better code without any extra cleanup passes (AFAICT this was the only place in -simplifycfg where now-dead conditions of replaced terminators weren't being cleaned up). The only other user of this function is -sccp, but I didn't read that thoroughly enough to figure out whether it might be holding pointers to instructions that could be deleted by this.

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

13 years agoanother typo
Chris Lattner [Sun, 22 May 2011 15:44:02 +0000 (15:44 +0000)]
another typo

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

13 years agofix comment typo
Chris Lattner [Sun, 22 May 2011 15:34:37 +0000 (15:34 +0000)]
fix comment typo

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

13 years agoI missed a checking with my GVN change.
Chris Lattner [Sun, 22 May 2011 07:20:02 +0000 (07:20 +0000)]
I missed a checking with my GVN change.

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

13 years agoinsertvalue takes a variable number of arguments, document this, fixing PR9935.
Chris Lattner [Sun, 22 May 2011 07:18:08 +0000 (07:18 +0000)]
insertvalue takes a variable number of arguments, document this, fixing PR9935.

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

13 years agofix PR9856, an incorrectly conservative assertion: a global can be
Chris Lattner [Sun, 22 May 2011 07:15:13 +0000 (07:15 +0000)]
fix PR9856, an incorrectly conservative assertion: a global can be
"stored once" even if its address is compared.

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

13 years agofix PR9841 by having GVN not process dead loads. This was
Chris Lattner [Sun, 22 May 2011 07:03:34 +0000 (07:03 +0000)]
fix PR9841 by having GVN not process dead loads.  This was
causing it to get into infinite loops when it would widen a
load (which can necessarily leave around dead loads).

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

13 years agoremove a trivial test, make some other tests less trivial.
Chris Lattner [Sun, 22 May 2011 07:02:43 +0000 (07:02 +0000)]
remove a trivial test, make some other tests less trivial.

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

13 years agomake this test less trivial.
Chris Lattner [Sun, 22 May 2011 06:59:33 +0000 (06:59 +0000)]
make this test less trivial.

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

13 years agoinitialize and finalize function passes, pointed out by Cameron.
Chris Lattner [Sun, 22 May 2011 06:44:19 +0000 (06:44 +0000)]
initialize and finalize function passes, pointed out by Cameron.

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

13 years agofix a bug for hosts without round, PR8893.
Chris Lattner [Sun, 22 May 2011 06:03:53 +0000 (06:03 +0000)]
fix a bug for hosts without round, PR8893.

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

13 years agomove PR9408 here.
Chris Lattner [Sun, 22 May 2011 05:45:06 +0000 (05:45 +0000)]
move PR9408 here.

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

13 years agoCommit test change, forgotten as part of r131838.
Nick Lewycky [Sun, 22 May 2011 05:31:47 +0000 (05:31 +0000)]
Commit test change, forgotten as part of r131838.

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

13 years agoTeach the inliner to emit llvm.lifetime.start/end, to scope the local variables
Nick Lewycky [Sun, 22 May 2011 05:22:10 +0000 (05:22 +0000)]
Teach the inliner to emit llvm.lifetime.start/end, to scope the local variables
of the inlinee to the code representing the original function.

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

13 years agoswitch to using a smallvector to avoid allocations for most normal size instructions.
Chris Lattner [Sun, 22 May 2011 04:53:24 +0000 (04:53 +0000)]
switch to using a smallvector to avoid allocations for most normal size instructions.

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

13 years agotidy some things up.
Chris Lattner [Sun, 22 May 2011 04:52:24 +0000 (04:52 +0000)]
tidy some things up.

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

13 years agoFix some minor typos and grammar.
Chris Lattner [Sun, 22 May 2011 04:44:48 +0000 (04:44 +0000)]
Fix some minor typos and grammar.

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

13 years agoImplement emission of all Win64 exception tables. Make the COFF streamer emit
Charles Davis [Sun, 22 May 2011 04:15:07 +0000 (04:15 +0000)]
Implement emission of all Win64 exception tables. Make the COFF streamer emit
these tables.

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

13 years agoMake the COFF streamer emit unwind info when processing a .seh_handlerdata
Charles Davis [Sun, 22 May 2011 03:01:05 +0000 (03:01 +0000)]
Make the COFF streamer emit unwind info when processing a .seh_handlerdata
directive.

Implement emission of Win64 EH unwind info.

Pull in <cassert> in MCWin64EH.h so it can use the assert() macro.

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

13 years agoFix grammar in test.
Nick Lewycky [Sun, 22 May 2011 01:16:00 +0000 (01:16 +0000)]
Fix grammar in test.

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

13 years agoDon't allow unaligned offsets and sizes in the Win64 EH directives.
Charles Davis [Sun, 22 May 2011 00:56:20 +0000 (00:56 +0000)]
Don't allow unaligned offsets and sizes in the Win64 EH directives.
Also, fix threshold for 'Big' register saves.

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

13 years agorandom comment cleanups.
Chris Lattner [Sun, 22 May 2011 00:50:53 +0000 (00:50 +0000)]
random comment cleanups.

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

13 years agofix a file system case sensitivity issue.
Chris Lattner [Sun, 22 May 2011 00:37:51 +0000 (00:37 +0000)]
fix a file system case sensitivity issue.

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

13 years agoremove StandardPasses, it has been replaced with PassManagerBuilder
Chris Lattner [Sun, 22 May 2011 00:30:45 +0000 (00:30 +0000)]
remove StandardPasses, it has been replaced with PassManagerBuilder

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

13 years agoswitch opt to using PassManagerBuilder.h
Chris Lattner [Sun, 22 May 2011 00:21:33 +0000 (00:21 +0000)]
switch opt to using PassManagerBuilder.h

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

13 years agoswitch llvm-ld. It has a terrible mechanism that people can add extra
Chris Lattner [Sun, 22 May 2011 00:21:15 +0000 (00:21 +0000)]
switch llvm-ld.  It has a terrible mechanism that people can add extra
passes, it should be converted to use extension points.

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

13 years agoswitch bugpoint and liblto to PassManagerBuilder.
Chris Lattner [Sun, 22 May 2011 00:20:07 +0000 (00:20 +0000)]
switch bugpoint and liblto to PassManagerBuilder.

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

13 years agoadd support for LTO passes.
Chris Lattner [Sun, 22 May 2011 00:14:20 +0000 (00:14 +0000)]
add support for LTO passes.

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

13 years agoeliminate dependence on StandardPasses.h. The code generator's pass pipeline
Chris Lattner [Sun, 22 May 2011 00:13:44 +0000 (00:13 +0000)]
eliminate dependence on StandardPasses.h.  The code generator's pass pipeline
should eventually convert to PMBuilder, but I don't plan to do this.

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

13 years agoInclude DataTypes.h from this header to get the uint*_t types.
Charles Davis [Sun, 22 May 2011 00:05:26 +0000 (00:05 +0000)]
Include DataTypes.h from this header to get the uint*_t types.

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

13 years agoAllow access to the .pdata and .xdata sections through the TargetAsmInfo
Charles Davis [Sun, 22 May 2011 00:03:24 +0000 (00:03 +0000)]
Allow access to the .pdata and .xdata sections through the TargetAsmInfo
class.

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

13 years agoadd an extension point mechanism that allow plugins to add stuff to
Chris Lattner [Sat, 21 May 2011 23:50:37 +0000 (23:50 +0000)]
add an extension point mechanism that allow plugins to add stuff to
the pass manager.

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

13 years agoAdd CreateLifetimeStart and CreateLifetimeEnd to the IRBuilder, with plans to
Nick Lewycky [Sat, 21 May 2011 23:14:36 +0000 (23:14 +0000)]
Add CreateLifetimeStart and CreateLifetimeEnd to the IRBuilder, with plans to
use these soon.

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

13 years agoRevert commit 131781, to see if it fixes the x86-64 dragonegg buildbot.
Duncan Sands [Sat, 21 May 2011 20:54:46 +0000 (20:54 +0000)]
Revert commit 131781, to see if it fixes the x86-64 dragonegg buildbot.
Original log message:
When BasicAA can determine that two pointers have the same base but
differ by a dynamic offset, return PartialAlias instead of MayAlias.
See the comment in the code for details. This fixes PR9971.

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

13 years agoadd a new PassManagerBuilder class to replace StandardPasses.h
Chris Lattner [Sat, 21 May 2011 20:39:42 +0000 (20:39 +0000)]
add a new PassManagerBuilder class to replace StandardPasses.h

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

13 years agoadd a copy ctor to TargetLibraryInfo.
Chris Lattner [Sat, 21 May 2011 20:09:13 +0000 (20:09 +0000)]
add a copy ctor to TargetLibraryInfo.

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

13 years agoPR7952: Make isa<> use the same logic as cast<>, so that they both work
Eli Friedman [Sat, 21 May 2011 19:13:10 +0000 (19:13 +0000)]
PR7952: Make isa<> use the same logic as cast<>, so that they both work
consistently.

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

13 years agoX86: smulo -> add is now done target-independently in DAGCombiner, remove the patterns.
Benjamin Kramer [Sat, 21 May 2011 18:32:01 +0000 (18:32 +0000)]
X86: smulo -> add is now done target-independently in DAGCombiner, remove the patterns.

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

13 years agoImplement mulo x, 2 -> addo x, x in DAGCombiner.
Benjamin Kramer [Sat, 21 May 2011 18:31:55 +0000 (18:31 +0000)]
Implement mulo x, 2 -> addo x, x in DAGCombiner.

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

13 years agoMerge and FileCheckize test cases.
Benjamin Kramer [Sat, 21 May 2011 18:31:48 +0000 (18:31 +0000)]
Merge and FileCheckize test cases.

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

13 years agoRevert "InstCombine: Turn mul.with.overflow(X, 2) into the cheaper add.with.overflow...
Benjamin Kramer [Sat, 21 May 2011 18:31:42 +0000 (18:31 +0000)]
Revert "InstCombine: Turn mul.with.overflow(X, 2) into the cheaper add.with.overflow(X, X)"

It's better to do this in codegen, mul.with.overflow(X, 2) is more canonical because it has only one use on "X".

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

13 years agoDon't allow .seh_handler and .seh_handlerdata directives inside chained
Charles Davis [Sat, 21 May 2011 17:36:25 +0000 (17:36 +0000)]
Don't allow .seh_handler and .seh_handlerdata directives inside chained
unwind areas.

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

13 years agoA handler for a function in the Win64 EH scheme can be both an unwind handler
Charles Davis [Sat, 21 May 2011 15:57:49 +0000 (15:57 +0000)]
A handler for a function in the Win64 EH scheme can be both an unwind handler
and an exception handler. Handle that case.

Also, add an 'Emitted' member to the MCWin64EHUnwindInfo struct. It will be
needed later.

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

13 years agoInstCombine: Turn mul.with.overflow(X, 2) into the cheaper add.with.overflow(X, X)
Benjamin Kramer [Sat, 21 May 2011 09:22:06 +0000 (09:22 +0000)]
InstCombine: Turn mul.with.overflow(X, 2) into the cheaper add.with.overflow(X, X)

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

13 years agoFix PR9978 by adding RIP to GR64_TC so it can be used as an address in PIC code. It
Cameron Zwarich [Sat, 21 May 2011 04:13:49 +0000 (04:13 +0000)]
Fix PR9978 by adding RIP to GR64_TC so it can be used as an address in PIC code. It
is already in GR64 for the same reasons. Since it isn't allocatable it can't cause
any problems.

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

13 years agoUse the correct register to access stack frame objects.
Akira Hatanaka [Sat, 21 May 2011 03:01:03 +0000 (03:01 +0000)]
Use the correct register to access stack frame objects.

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

13 years agoInsert instructions that copy $sp to or from $fp at the right locations.
Akira Hatanaka [Sat, 21 May 2011 02:29:26 +0000 (02:29 +0000)]
Insert instructions that copy $sp to or from $fp at the right locations.

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

13 years agoWhen BasicAA can determine that two pointers have the same base but
Dan Gohman [Sat, 21 May 2011 01:05:08 +0000 (01:05 +0000)]
When BasicAA can determine that two pointers have the same base but
differ by a dynamic offset, return PartialAlias instead of MayAlias.
See the comment in the code for details. This fixes PR9971.

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

13 years agoHave Program::Wait return -2 for crashed and timeouts instead of embedding
Andrew Trick [Sat, 21 May 2011 00:56:46 +0000 (00:56 +0000)]
Have Program::Wait return -2 for crashed and timeouts instead of embedding
info in the error message. Per Dan's request.

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

13 years agoSet the "LastFrameInst" field when streaming a .seh_setframe directive. This
Charles Davis [Sat, 21 May 2011 00:09:04 +0000 (00:09 +0000)]
Set the "LastFrameInst" field when streaming a .seh_setframe directive. This
is needed for an upcoming patch.

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

13 years agoFix PR9962 by properly constraining register classes in RemoveCopyByCommutingDef...
Cameron Zwarich [Fri, 20 May 2011 23:25:36 +0000 (23:25 +0000)]
Fix PR9962 by properly constraining register classes in RemoveCopyByCommutingDef(). This
actually fixes most of the VerifyCoalescing failures in test-suite.

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

13 years agoChange the order fixed objects are created in MipsTargetLowering::LowerCall in
Akira Hatanaka [Fri, 20 May 2011 23:22:14 +0000 (23:22 +0000)]
Change the order fixed objects are created in MipsTargetLowering::LowerCall in
preparation for reversing StackDirection.

Fixed objects are created in the following order:
 1. Incoming arguments passed on stack.
 2. va_arg objects (include both arguments that are passed in registers and
    pointer to the location of the first va_arg argument).
 3. $gp restore slot.
 4. Outgoing arguments passed on stack.
 5. Pointer to alloca'd space.

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

13 years agoFix typo. When will I learn?
Charles Davis [Fri, 20 May 2011 22:23:34 +0000 (22:23 +0000)]
Fix typo. When will I learn?

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

13 years agoAdd fast-isel support for byval calls on x86.
Eli Friedman [Fri, 20 May 2011 22:21:04 +0000 (22:21 +0000)]
Add fast-isel support for byval calls on x86.

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

13 years agoAdd .pdata and .xdata sections to the COFF TLOF implementation.
Charles Davis [Fri, 20 May 2011 22:13:55 +0000 (22:13 +0000)]
Add .pdata and .xdata sections to the COFF TLOF implementation.

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

13 years agoNo reason not to allow defining the CFA as a reg w/ offset zero.
Jim Grosbach [Fri, 20 May 2011 21:50:09 +0000 (21:50 +0000)]
No reason not to allow defining the CFA as a reg w/ offset zero.

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

13 years agoIn CC_MipsO32, allocate a stack space regardless of whether the argument is
Akira Hatanaka [Fri, 20 May 2011 21:39:54 +0000 (21:39 +0000)]
In CC_MipsO32, allocate a stack space regardless of whether the argument is
passed in register or on the stack.

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

13 years agoFix typo.
Jim Grosbach [Fri, 20 May 2011 21:35:39 +0000 (21:35 +0000)]
Fix typo.

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

13 years agoAdd support for frame info use of the .cfi_def_cfa directive.
Jim Grosbach [Fri, 20 May 2011 21:23:17 +0000 (21:23 +0000)]
Add support for frame info use of the .cfi_def_cfa directive.

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

13 years agoAdd missing leading \t when printing .cfi_def_cfa in the asmstreamer.
Jim Grosbach [Fri, 20 May 2011 21:22:37 +0000 (21:22 +0000)]
Add missing leading \t when printing .cfi_def_cfa in the asmstreamer.

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

13 years agoDefine functions that get/set maximum call frame size.
Akira Hatanaka [Fri, 20 May 2011 20:11:17 +0000 (20:11 +0000)]
Define functions that get/set maximum call frame size.

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

13 years agoadds some attributes to attribute section when cpu is "xscale"
Rafael Espindola [Fri, 20 May 2011 20:10:34 +0000 (20:10 +0000)]
adds some attributes to attribute section when cpu is "xscale"
(this is what used in Android NDK, when architecture is ARMv5)

patch by Koan-Sin Tan

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

13 years agofixes target address tBL and tBLX and sets relocation type
Rafael Espindola [Fri, 20 May 2011 20:01:01 +0000 (20:01 +0000)]
fixes target address tBL and tBLX and sets relocation type
of tBL/tBLX to R_ARM_THM_CALL (ARM ELF 4.7.1.6)

Patch by koan-sin tan.

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

13 years agoAdd asserts in StringRef to make sure we avoid undefined behavior:
Argyrios Kyrtzidis [Fri, 20 May 2011 19:24:12 +0000 (19:24 +0000)]
Add asserts in StringRef to make sure we avoid undefined behavior:

-strlen should not be called with NULL. Also guarantee that StringRef's Length is 0 if Data is NULL.
-memcmp should not be called with NULL (even if size is 0)

Patch by Matthieu Monrocq!

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

13 years agoRe-commit 131641 with fixes; de-pseudoize MOVSX16rr8 and friends.
Stuart Hastings [Fri, 20 May 2011 19:04:40 +0000 (19:04 +0000)]
Re-commit 131641 with fixes; de-pseudoize MOVSX16rr8 and friends.
rdar://problem/8614450

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

13 years agoMake $fp and $ra callee-saved registers and let PrologEpilogInserter handle
Akira Hatanaka [Fri, 20 May 2011 18:39:33 +0000 (18:39 +0000)]
Make $fp and $ra callee-saved registers and let PrologEpilogInserter handle
saving and restoring them.

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

13 years agoindvars: Prototyping Sign/ZeroExtend elimination without canonical IVs.
Andrew Trick [Fri, 20 May 2011 18:25:42 +0000 (18:25 +0000)]
indvars: Prototyping Sign/ZeroExtend elimination without canonical IVs.

No functionality enabled by default. Use -disable-iv-rewrite.
Extended IVUsers to keep track of the phi that represents the users' IV.
Added the WidenIV transform to replace a narrow IV with a wide IV
by doing a one-for-one replacement of IV users instead of expanding the
SCEV expressions. [sz]exts are removed and truncs are inserted.

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