Chris Lattner
c277b19e97
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.
llvm-svn: 131884
2011-05-23 00:03:39 +00:00
Chris Lattner
5fd8380a35
add a helper method to get the byval alignment of an argument.
...
llvm-svn: 131883
2011-05-22 23:57:23 +00:00
Chris Lattner
ca9723d80b
Eliminate some temporary variables, and don't call getByValTypeAlignment
...
when we're just going to throw the result away. No functionality change.
llvm-svn: 131880
2011-05-22 23:23:02 +00:00
Chris Lattner
5442c034a8
add a missing alias to make us more bug compatible with gcc, PR9378
...
llvm-svn: 131874
2011-05-22 22:31:57 +00:00
Chris Lattner
78663aa9f5
implement PR9315, constant folding exp2 in terms of pow (since hosts without
...
C99 runtimes don't have exp2).
llvm-svn: 131872
2011-05-22 22:22:35 +00:00
Renato Golin
759db3cbe3
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.
...
llvm-svn: 131868
2011-05-22 21:41:23 +00:00
Charles Davis
a4187a96c9
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.
llvm-svn: 131866
2011-05-22 21:12:15 +00:00
Chris Lattner
3066a7e5ad
add a note.
...
llvm-svn: 131863
2011-05-22 18:28:46 +00:00
Chris Lattner
84f101ea45
add some random notes.
...
llvm-svn: 131862
2011-05-22 18:26:48 +00:00
Evan Cheng
a2e8770368
Teach ValueTracking about x86 crc32 intrinsics.
...
llvm-svn: 131861
2011-05-22 18:25:30 +00:00
Chris Lattner
8ed794f599
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
llvm-svn: 131860
2011-05-22 18:18:41 +00:00
Johnny Chen
6e8aeaa2f4
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.
llvm-svn: 131859
2011-05-22 17:51:04 +00:00
Chris Lattner
44516c3ba3
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.
llvm-svn: 131858
2011-05-22 17:39:56 +00:00
Frits van Bommel
df58ece78a
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.
llvm-svn: 131855
2011-05-22 16:24:18 +00:00
Chris Lattner
98ce5cd957
fix PR9856, an incorrectly conservative assertion: a global can be
...
"stored once" even if its address is compared.
llvm-svn: 131849
2011-05-22 07:15:13 +00:00
Chris Lattner
6cce3b63ab
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).
llvm-svn: 131847
2011-05-22 07:03:34 +00:00
Chris Lattner
75adf06d44
fix a bug for hosts without round, PR8893.
...
llvm-svn: 131842
2011-05-22 06:03:53 +00:00
Chris Lattner
9359dea740
move PR9408 here.
...
llvm-svn: 131841
2011-05-22 05:45:06 +00:00
Nick Lewycky
9f7644d549
Teach the inliner to emit llvm.lifetime.start/end, to scope the local variables
...
of the inlinee to the code representing the original function.
llvm-svn: 131838
2011-05-22 05:22:10 +00:00
Chris Lattner
7eb3367809
switch to using a smallvector to avoid allocations for most normal size instructions.
...
llvm-svn: 131837
2011-05-22 04:53:24 +00:00
Chris Lattner
b58a888c57
tidy some things up.
...
llvm-svn: 131836
2011-05-22 04:52:24 +00:00
Charles Davis
d74119d139
Implement emission of all Win64 exception tables. Make the COFF streamer emit
...
these tables.
llvm-svn: 131833
2011-05-22 04:15:07 +00:00
Charles Davis
c23700bb65
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.
llvm-svn: 131832
2011-05-22 03:01:05 +00:00
Charles Davis
a537e589c9
Don't allow unaligned offsets and sizes in the Win64 EH directives.
...
Also, fix threshold for 'Big' register saves.
llvm-svn: 131830
2011-05-22 00:56:20 +00:00
Chris Lattner
69a52dd280
random comment cleanups.
...
llvm-svn: 131829
2011-05-22 00:50:53 +00:00
Chris Lattner
03d83a7b9b
remove StandardPasses, it has been replaced with PassManagerBuilder
...
llvm-svn: 131827
2011-05-22 00:30:45 +00:00
Chris Lattner
c383dd2c87
eliminate dependence on StandardPasses.h. The code generator's pass pipeline
...
should eventually convert to PMBuilder, but I don't plan to do this.
llvm-svn: 131819
2011-05-22 00:13:44 +00:00
Nick Lewycky
0539f44b9f
Add CreateLifetimeStart and CreateLifetimeEnd to the IRBuilder, with plans to
...
use these soon.
llvm-svn: 131812
2011-05-21 23:14:36 +00:00
Duncan Sands
c228e6bdea
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.
llvm-svn: 131809
2011-05-21 20:54:46 +00:00
Chris Lattner
777808dcaf
add a copy ctor to TargetLibraryInfo.
...
llvm-svn: 131806
2011-05-21 20:09:13 +00:00
Eli Friedman
58beee1262
PR7952: Make isa<> use the same logic as cast<>, so that they both work
...
consistently.
llvm-svn: 131803
2011-05-21 19:13:10 +00:00
Benjamin Kramer
85e86083d5
X86: smulo -> add is now done target-independently in DAGCombiner, remove the patterns.
...
llvm-svn: 131801
2011-05-21 18:32:01 +00:00
Benjamin Kramer
df3070e83d
Implement mulo x, 2 -> addo x, x in DAGCombiner.
...
llvm-svn: 131800
2011-05-21 18:31:55 +00:00
Benjamin Kramer
24f75ab769
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".
llvm-svn: 131798
2011-05-21 18:31:42 +00:00
Charles Davis
525855fe48
Don't allow .seh_handler and .seh_handlerdata directives inside chained
...
unwind areas.
llvm-svn: 131795
2011-05-21 17:36:25 +00:00
Charles Davis
7f9c007dce
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.
llvm-svn: 131791
2011-05-21 15:57:49 +00:00
Benjamin Kramer
51d1eac4bc
InstCombine: Turn mul.with.overflow(X, 2) into the cheaper add.with.overflow(X, X)
...
llvm-svn: 131789
2011-05-21 09:22:06 +00:00
Cameron Zwarich
28ea8de263
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.
llvm-svn: 131787
2011-05-21 04:13:49 +00:00
Akira Hatanaka
af8143cdde
Use the correct register to access stack frame objects.
...
llvm-svn: 131785
2011-05-21 03:01:03 +00:00
Akira Hatanaka
6605a1e1a6
Insert instructions that copy $sp to or from $fp at the right locations.
...
llvm-svn: 131784
2011-05-21 02:29:26 +00:00
Dan Gohman
048c261e5d
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.
llvm-svn: 131781
2011-05-21 01:05:08 +00:00
Andrew Trick
9f867fd2dc
Have Program::Wait return -2 for crashed and timeouts instead of embedding
...
info in the error message. Per Dan's request.
llvm-svn: 131780
2011-05-21 00:56:46 +00:00
Charles Davis
520128d52f
Set the "LastFrameInst" field when streaming a .seh_setframe directive. This
...
is needed for an upcoming patch.
llvm-svn: 131772
2011-05-21 00:09:04 +00:00
Cameron Zwarich
00ec3d1f9f
Fix PR9962 by properly constraining register classes in RemoveCopyByCommutingDef(). This
...
actually fixes most of the VerifyCoalescing failures in test-suite.
llvm-svn: 131768
2011-05-20 23:25:36 +00:00
Akira Hatanaka
66b7b0949f
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.
llvm-svn: 131767
2011-05-20 23:22:14 +00:00
Charles Davis
445c467ced
Fix typo. When will I learn?
...
llvm-svn: 131765
2011-05-20 22:23:34 +00:00
Eli Friedman
dfd96ebe52
Add fast-isel support for byval calls on x86.
...
llvm-svn: 131764
2011-05-20 22:21:04 +00:00
Charles Davis
989cc73ef3
Add .pdata and .xdata sections to the COFF TLOF implementation.
...
llvm-svn: 131763
2011-05-20 22:13:55 +00:00
Jim Grosbach
909aff492f
No reason not to allow defining the CFA as a reg w/ offset zero.
...
llvm-svn: 131760
2011-05-20 21:50:09 +00:00
Akira Hatanaka
84f0431846
In CC_MipsO32, allocate a stack space regardless of whether the argument is
...
passed in register or on the stack.
llvm-svn: 131758
2011-05-20 21:39:54 +00:00