Bill Wendling
db0996c822
Replace the "movnt" intrinsics with a native store + nontemporal metadata bit.
...
<rdar://problem/8460511>
llvm-svn: 130791
2011-05-03 21:11:17 +00:00
Jakob Stoklund Olesen
eaa6ed1ad8
Gracefully handle invalid live ranges. Fix PR9831.
...
Register coalescing can sometimes create live ranges that end in the middle of a
basic block without any killing instruction. When SplitKit detects this, it will
repair the live range by shrinking it to its uses.
Live range splitting also needs to know about this. When the range shrinks so
much that it becomes allocatable, live range splitting fails because it can't
find a good split point. It is paranoid about making progress, so an allocatable
range is considered an error.
The coalescer should really not be creating these bad live ranges. They appear
when coalescing dead copies.
llvm-svn: 130787
2011-05-03 20:42:13 +00:00
Duncan Sands
0a9c1246d7
Implement some basic simplifications involving min/max, for example
...
max(a,b) >= a -> true. According to my super-optimizer, these are
by far the most common simplifications (of the -instsimplify kind)
that occur in the testsuite and aren't caught by -std-compile-opts.
llvm-svn: 130780
2011-05-03 19:53:10 +00:00
Akira Hatanaka
22fc723818
Fix function MipsRegisterInfo::getRegisterNumbering.
...
llvm-svn: 130774
2011-05-03 18:41:54 +00:00
Bob Wilson
09585e1c5d
Temporarily disable use of divmod compiler-rt functions for iOS.
...
llvm-svn: 130766
2011-05-03 17:33:22 +00:00
Bruno Cardoso Lopes
86c6e7057d
Fold ARM coprocessor intrinsics patterns into the instructions defs whenever
...
it's possible.
llvm-svn: 130764
2011-05-03 17:29:29 +00:00
Bruno Cardoso Lopes
168c9005b5
Add a few ARM coprocessor intrinsics. Testcases included
...
llvm-svn: 130763
2011-05-03 17:29:22 +00:00
Devang Patel
e02e58528a
If the front end has emitted llvm.dbg.cu and other debug info anchors (clang does it now) then use them directly. This saves one scan of entire module, to collect debug info, which in turns saves few machine cycles at compile time.
...
llvm-svn: 130759
2011-05-03 16:45:22 +00:00
Devang Patel
09fa69e151
Use llvm.dbg.cu named metadata to collect compile units.
...
llvm-svn: 130756
2011-05-03 16:18:28 +00:00
Benjamin Kramer
9c373c1c7a
Remove unused variables caught by GCC's -Wunused-but-set-variable.
...
llvm-svn: 130755
2011-05-03 16:00:27 +00:00
Michael J. Spencer
9973738b65
Add pentium{3,4}m cpus. Patch by Alexander Best!
...
llvm-svn: 130749
2011-05-03 03:42:50 +00:00
Eric Christopher
d2aa241378
xmm0 is an implicit parameter in this and so shouldn't be in the
...
string template.
Fixes rdar://8493866
llvm-svn: 130747
2011-05-03 01:28:32 +00:00
Dan Gohman
6136e94897
Add an unfolded offset field to LSR's Formula record. This is used to
...
model constants which can be added to base registers via add-immediate
instructions which don't require an additional register to materialize
the immediate.
llvm-svn: 130743
2011-05-03 00:46:49 +00:00
Owen Anderson
66fd073974
Other parts of the SelectionDAG framework assume that targets use their pointer type for vector indices. Make the vector unrolling code respect that.
...
llvm-svn: 130733
2011-05-02 22:25:45 +00:00
Devang Patel
bb35e8ba88
Scanning entire basic block may be too expensive in terms of compile time. Instead, just use whatever location info first non-phi instruction has.
...
llvm-svn: 130729
2011-05-02 21:57:00 +00:00
Jakob Stoklund Olesen
16f7cf6a2f
Handle <def,undef> in the second loop as well.
...
llvm-svn: 130718
2011-05-02 20:36:53 +00:00
Eric Christopher
39b56b4b9f
Apparently the check for direct calls is unnecessary.
...
llvm-svn: 130716
2011-05-02 20:16:33 +00:00
Jakob Stoklund Olesen
6297a715dc
Use the PrintReg adaptor to correctly print live-in registers in debug output.
...
llvm-svn: 130715
2011-05-02 20:06:30 +00:00
Jakob Stoklund Olesen
7dffc8ecf2
Only ignore <undef> use operands, keep the <def,undef> ops.
...
Def operands may also have an <undef> flag, but that just means that a
sub-register redef doesn't actually read the super-register. For physical
registers, it has no meaning.
llvm-svn: 130714
2011-05-02 20:06:28 +00:00
Duncan Sands
f91c5ab341
Fix PR9579: when simplifying a compare to "true" or "false", and it was
...
a vector compare, generate a vector result rather than i1 (and crashing).
llvm-svn: 130706
2011-05-02 18:51:41 +00:00
Duncan Sands
6b699f863f
Remove unused variable.
...
llvm-svn: 130705
2011-05-02 18:41:29 +00:00
Devang Patel
420ab5f180
Emit debug info for global variables first.
...
This works around a limitation in gdb which is reported by following inherit.exp test failures from gdb testsuite.
gdb.cp/inherit.exp: print g_vB.vB::vb
gdb.cp/inherit.exp: print g_vB.vB::vx
gdb.cp/inherit.exp: print g_vC.vC::vc
gdb.cp/inherit.exp: print g_vC.vC::vx
gdb.cp/inherit.exp: print g_vD.vB::vb
...
llvm-svn: 130702
2011-05-02 18:19:17 +00:00
Duncan Sands
a3e3699c88
Move some rem transforms out of instcombine and into instsimplify.
...
This automagically provides a transform noticed by my super-optimizer
as occurring quite often: "rem x, (select cond, x, 1)" -> 0.
llvm-svn: 130694
2011-05-02 16:27:02 +00:00
Rafael Espindola
5164e6e8b2
Add 130690 back.
...
llvm-svn: 130693
2011-05-02 15:58:16 +00:00
Rafael Espindola
e406670954
Only produce the eh_frame section if we have at least one personality function.
...
llvm-svn: 130692
2011-05-02 15:49:52 +00:00
Rafael Espindola
a392475865
Revert while I debug the tests that use march but not mtriple.
...
llvm-svn: 130691
2011-05-02 15:42:31 +00:00
Rafael Espindola
c2aad4f2a3
Move ppc OS X to cfi too. I am building it on an old ppc mini, but it will take some time.
...
llvm-svn: 130690
2011-05-02 15:00:52 +00:00
Jakob Stoklund Olesen
7d4067936a
Minimize the slot indexes spanned by register ranges created when splitting.
...
When an interfering live range ends at a dead slot index between two
instructions, make sure that the inserted copy instruction gets a slot index
after the dead ones. This makes it possible to avoid the interference.
Ideally, there shouldn't be interference ending at a deleted instruction, but
physical register coalescing can sometimes do that to sub-registers.
This fixes PR9823.
llvm-svn: 130687
2011-05-02 05:29:58 +00:00
Nick Lewycky
e75ffa1b78
In option typo correction, consider -foo=VALUE flags as two distinct parts. The
...
comments claimed it did this, but the LHS value was actually an unused variable.
The new system considers only the '-foo' part when comparing it for typos
against flags that have values, but still look at the whole string for flags
that don't. That way, we'll still correct '-inst=combine' to '-instcombine'.
llvm-svn: 130685
2011-05-02 05:24:47 +00:00
Nick Lewycky
5f1eb968f0
Remove dead variable pointed out by GCC 4.6 warnings, and reflow this a little
...
to scope a variable more tightly per llvm coding style. No functional change.
llvm-svn: 130684
2011-05-02 05:05:29 +00:00
Chris Lattner
23f61a09af
enhance memcpyopt to obey -fno-builtin and friends. This addresses a
...
problem reported on cfe-dev.
llvm-svn: 130661
2011-05-01 18:27:11 +00:00
Rafael Espindola
fc8223670a
Add r130623 back now that ELF has been fixed to work with -fno-dwarf2-cfi-asm.
...
llvm-svn: 130658
2011-05-01 15:44:13 +00:00
NAKAMURA Takumi
4471f82e91
Windows/DynamicLibrary.inc: Clean up ELM_Callback. We may check the decl instead of the versions of individual libraries.
...
autoconf: Add checking ELM_Callback decl for mingw32 and mingw-w64.
cmake/config-ix.cmake: Add checking ELM_Callback decl for win32.
llvm-svn: 130657
2011-05-01 13:29:49 +00:00
Chandler Carruth
ddc91b25e3
Remove an unused variable from this function introduced in r130637,
...
likely a result of copy/paste.
llvm-svn: 130640
2011-05-01 06:14:10 +00:00
Rafael Espindola
750cb61553
GCC uses a different encoding of pointers in the FDE when using
...
-fno-dwarf2-cfi-asm. Implement the same behavior.
llvm-svn: 130637
2011-05-01 04:49:54 +00:00
Rafael Espindola
95215a76cd
I forgot these files in the previous commit.
...
llvm-svn: 130635
2011-05-01 04:19:24 +00:00
Rafael Espindola
fd05785324
Simplify the handling of pcrel relocations on ELF. Now we do the right thing
...
for all symbol differences and can drop the old EmitPCRelSymbolValue
method.
This also make getExprForFDESymbol on ELF equal to the one on MachO, and it
can be made non-virtual.
llvm-svn: 130634
2011-05-01 03:50:49 +00:00
Rafael Espindola
b7c2286055
Revert the previous patch while I figure out how to make llvm-gcc
...
less agressive about disabling cfi on linux :-(
llvm-svn: 130626
2011-04-30 23:03:44 +00:00
Jakob Stoklund Olesen
2348cdd67f
X86AsmPrinter doesn't know how to handle the X86II::MO_GOT_ABSOLUTE_ADDRESS flag
...
after folding ADD32ri to ADD32mi, so don't do that.
This only happens when the greedy register allocator gets itself in trouble and
spills %vreg9 here:
16L %vreg9<def> = MOVPC32r 0, %ESP<imp-use>; GR32:%vreg9
48L %vreg9<def> = ADD32ri %vreg9, <es:_GLOBAL_OFFSET_TABLE_>[TF=1], %EFLAGS<imp-def,dead>; GR32:%vreg9
That should never happen, the live range should be split instead.
llvm-svn: 130625
2011-04-30 23:00:05 +00:00
Rafael Espindola
5265bc483e
Enable CFI on OS X.
...
Currently the output should be almost identical to the one produced by CodeGen
to make the transition easier.
The only two differences I know of are:
* Some files get an extra advance loc of size 0. This will be fixed when
relaxations are enabled.
* The optimization of declaring an EH symbol as an external variable is not
implemented. This is a subset of adding the nounwind attribute, so we if really
this at -O0 we should probably do it at the IL level.
llvm-svn: 130623
2011-04-30 22:29:54 +00:00
Jakob Stoklund Olesen
38a0b94dce
When a physreg is live-in and live through a basic block, make sure its live
...
range covers the entire block.
The live range can't be terminated at a random instruction.
llvm-svn: 130619
2011-04-30 19:12:33 +00:00
Benjamin Kramer
9aa91b1f4e
InstCombine: Turn (zext A) udiv (zext B) into (zext (A udiv B)). Same for urem or constant B.
...
This obviously helps a lot if the division would be turned into a libcall
(think i64 udiv on i386), but div is also one of the few remaining instructions
on modern CPUs that become more expensive when the bitwidth gets bigger.
This also helps register pressure on i386 when dividing chars, divb needs
two 8-bit parts of a 16 bit register as input where divl uses two registers.
int foo(unsigned char a) { return a/10; }
int bar(unsigned char a, unsigned char b) { return a/b; }
compiles into (x86_64)
_foo:
imull $205, %edi, %eax
shrl $11, %eax
ret
_bar:
movzbl %dil, %eax
divb %sil, %al
movzbl %al, %eax
ret
llvm-svn: 130615
2011-04-30 18:16:07 +00:00
Benjamin Kramer
57b3df59b9
Use SimplifyDemandedBits on div instructions.
...
This folds away silly stuff like (a&255)/1000 -> 0.
llvm-svn: 130614
2011-04-30 18:16:00 +00:00
Rafael Espindola
bde52bca69
Implement MCAsmStreamer::EmitEHSymAttributes. Doing this in the asm streamer
...
is a bit ugly, but doing it on the base MCStreamer would be redundant
with the object streamer which does it using SD.
llvm-svn: 130611
2011-04-30 16:34:57 +00:00
Rafael Espindola
0b474c2d15
Handle PrivateExtern eh symbols.
...
llvm-svn: 130609
2011-04-30 16:22:46 +00:00
Jakob Stoklund Olesen
ec9b4a6b8b
Avoid using stale entries form the sibling value map.
...
This could happen when trying to use a value that had been eliminated after dead
code elimination and folding loads.
llvm-svn: 130597
2011-04-30 06:42:21 +00:00
Jakob Stoklund Olesen
357dd36136
Use hysteresis for local live range splitting as well.
...
llvm-svn: 130596
2011-04-30 05:07:46 +00:00
Rafael Espindola
a3181d12c6
Add all the plumbing needed for MC to expand cfi to the old tables in
...
the final assembly. It is the same technique used when targeting
assemblers that don't support .loc.
llvm-svn: 130587
2011-04-30 03:44:37 +00:00
Rafael Espindola
1d1eced025
Implement MCAsmStreamer::EmitDwarfAdvanceFrameAddr.
...
llvm-svn: 130585
2011-04-30 03:21:04 +00:00
Jakob Stoklund Olesen
d50e5eb8c3
Update comment.
...
llvm-svn: 130582
2011-04-30 03:13:08 +00:00
Jakob Stoklund Olesen
6e399a6ecb
Use a greedy algorithm for allocating registers.
...
llvm-svn: 130568
2011-04-30 01:37:54 +00:00
Bill Wendling
9f638ab181
Print out the 'nontemporal' info on a store.
...
llvm-svn: 130562
2011-04-29 23:45:22 +00:00
Eli Friedman
4105ed1523
Make FastEmit_ri_ try a bit harder to succeed for supported operations; FastEmit_i can fail for non-Thumb2 ARM. Makes ARMSimplifyAddress work correctly, and reduces the number of fast-isel bailouts on non-Thumb ARM.
...
llvm-svn: 130560
2011-04-29 23:34:52 +00:00
Eric Christopher
e02e07c3a6
80-col.
...
llvm-svn: 130558
2011-04-29 23:12:01 +00:00
Eli Friedman
468dfabce0
Zap a couple now-unused functions.
...
llvm-svn: 130557
2011-04-29 22:56:48 +00:00
Eli Friedman
328bad02fa
Switch to ImmLeaf (which can be used by FastISel) for a few more common ARM/Thumb2 patterns.
...
llvm-svn: 130552
2011-04-29 22:48:03 +00:00
Devang Patel
a8e7411c74
Assing line number info to new PHIs created by SSA updater.
...
llvm-svn: 130551
2011-04-29 22:28:59 +00:00
Eric Christopher
7708746c33
Add FastEmitInst_ii for the arm fast isel generator. It doesn't use it, but
...
if it ever did it needs the def machinery.
llvm-svn: 130549
2011-04-29 22:07:50 +00:00
Eric Christopher
26b8ac4b8c
Some cleanup and optimize fallthrough more.
...
llvm-svn: 130546
2011-04-29 21:56:31 +00:00
Rafael Espindola
6a85f9b42e
Avoid some uses of .uleb128. This is a small speedup and more importantly
...
lets this code be used when producing assembly code for old assemblers without
uleb support.
llvm-svn: 130544
2011-04-29 21:50:57 +00:00
Rafael Espindola
6c961e1b75
Implement MCAsmStreamer::EmitCFIDefCfa.
...
llvm-svn: 130543
2011-04-29 21:41:06 +00:00
Devang Patel
84d7eb7252
Print new instructions without DebugLoc.
...
llvm-svn: 130542
2011-04-29 21:36:04 +00:00
Eli Friedman
86caced370
Re-committing r130454, which does not in fact break anything.
...
Fix a rather obscure crash caused by ARM fast-isel generating code which redefines a register.
rdar://problem/9338332 .
llvm-svn: 130539
2011-04-29 21:22:56 +00:00
Devang Patel
c1f7c1d469
Preserve line number information.
...
llvm-svn: 130536
2011-04-29 20:38:55 +00:00
Eric Christopher
8d46b47787
Add trunc->branch support, this won't help with clang's i8->i1 truncations
...
for bools, but is a start.
llvm-svn: 130534
2011-04-29 20:02:39 +00:00
Peter Collingbourne
616044acd5
SimplifyCFG: Expose phi node folding cost threshold as command line parameter
...
llvm-svn: 130528
2011-04-29 18:47:38 +00:00
Peter Collingbourne
e3511e15e0
SimplifyCFG: Add CostRemaining parameter to DominatesMergePoint
...
llvm-svn: 130527
2011-04-29 18:47:31 +00:00
Peter Collingbourne
61f6602acd
SimplifyCFG: Add Trunc, ZExt and SExt to the list of cheap instructions for phi node folding
...
llvm-svn: 130526
2011-04-29 18:47:25 +00:00
Daniel Dunbar
72032861c6
MCAsmLayout: Add support for computing the symbol offset of variables. Not
...
currently used, because variables don't get reported as being "defined".
llvm-svn: 130524
2011-04-29 18:20:20 +00:00
Daniel Dunbar
bea7b93c88
MC: Change variable symbols to be recognized as defined, by assigning their sections based on FindAssociatedSection().
...
llvm-svn: 130523
2011-04-29 18:20:17 +00:00
Daniel Dunbar
b200f93125
MC/Mach-O: Update getSymbolAddress() to support evaluation of variables.
...
llvm-svn: 130522
2011-04-29 18:13:42 +00:00
Daniel Dunbar
29ba55cfe4
MC/Mach-O: Allow emission of relocations for variables in some more cases.
...
llvm-svn: 130520
2011-04-29 18:10:47 +00:00
Daniel Dunbar
b9c2b6c50d
MC/Mach-O: Find section ordinal's by looking at the symbol, instead of assuming they are present in a fragment.
...
llvm-svn: 130519
2011-04-29 18:07:43 +00:00
Devang Patel
124ae13421
Hoist MCLineEntry construction AsmPrinter so that anyone who derives from AsmPrinter can have line number entries.
...
PR 9810
llvm-svn: 130518
2011-04-29 18:00:54 +00:00
Daniel Dunbar
dc3e4cc5ed
MCExpr: Add FindAssociatedSection, which attempts to mirror the 'as' semantics
...
that associate sections with expressions.
llvm-svn: 130517
2011-04-29 18:00:03 +00:00
Daniel Dunbar
1bf128eaeb
MC/AsmParser: Generalize a check.
...
llvm-svn: 130515
2011-04-29 17:53:11 +00:00
Douglas Gregor
dd8061e09f
Fix a C++0x portability issue with std::make_pair. Explicitly providing template arguments no longer works when the call arguments are lvalues.
...
llvm-svn: 130513
2011-04-29 16:57:12 +00:00
Douglas Gregor
0e50682f26
Include <pthread.h> before we use pthread_self/pthread_kill
...
llvm-svn: 130510
2011-04-29 16:12:17 +00:00
Rafael Espindola
1fc5bf9fc5
The last hack for producing bit identical output with cfi on OS X.
...
llvm-svn: 130504
2011-04-29 15:09:53 +00:00
Rafael Espindola
697edc89a5
Change DwarfCFIException's member variables to track what it actually
...
emmits: .cfi_personality, .cfi_lsda and the moves.
llvm-svn: 130503
2011-04-29 14:48:51 +00:00
Andrew Trick
e794e17524
Teach Thumb2 isel to fold and->rotr ==> ROR.
...
Generalization of Nate Begeman's patch!
llvm-svn: 130502
2011-04-29 14:18:15 +00:00
Rafael Espindola
b7a012a282
Factor some code to needsCFIMoves. Avoid printing moves when we don't have to.
...
llvm-svn: 130501
2011-04-29 14:14:06 +00:00
Benjamin Kramer
6708499b6d
This is done.
...
llvm-svn: 130499
2011-04-29 14:09:57 +00:00
Benjamin Kramer
f0e3f04470
Balance parentheses.
...
llvm-svn: 130489
2011-04-29 08:41:23 +00:00
Benjamin Kramer
16f18ed7b5
InstCombine: turn (C1 << A) << C2) into (C1 << C2) << A)
...
Fixes PR9809.
llvm-svn: 130485
2011-04-29 08:15:41 +00:00
Chris Lattner
011eae7512
clean up after Sean's r127646 patch.
...
llvm-svn: 130475
2011-04-29 05:40:18 +00:00
Chris Lattner
1d0c25756e
use the MachineInstrBuilder operator-> to simplify some code.
...
There are probably more instances of this floating around.
llvm-svn: 130474
2011-04-29 05:24:29 +00:00
Rafael Espindola
68067664c3
Last bit by bit compatibility patch to MCDwarf.cpp: If a FDE with no LSDA is
...
assigned to a CIE that requires one, just output a 0.
llvm-svn: 130472
2011-04-29 03:06:29 +00:00
Rafael Espindola
7c7151512c
Add an alternative implementation of CIE and FDE emission that outputs them
...
in the same order as the one in CodeGen.
llvm-svn: 130471
2011-04-29 02:42:28 +00:00
Eric Christopher
9ade5e2495
Update comments and checks to match reality.
...
llvm-svn: 130464
2011-04-29 00:07:20 +00:00
Eric Christopher
501d2e2c14
Whitespace.
...
llvm-svn: 130463
2011-04-29 00:03:10 +00:00
Eli Friedman
517728b1ae
Revert r130454; apparently this doesn't actually work.
...
llvm-svn: 130462
2011-04-28 23:55:14 +00:00
Eli Friedman
e4ecd42926
Fix a rather obscure crash caused by ARM fast-isel generating code which redefines a register.
...
rdar://problem/9338332 .
llvm-svn: 130454
2011-04-28 23:03:25 +00:00
Devang Patel
80d1d3aaec
Preserve line number information.
...
llvm-svn: 130450
2011-04-28 22:48:14 +00:00
Matt Beaumont-Gay
c99298ab5e
Coalesce some DEBUGs (moving an only-used-in-DEBUG variable's declaration into the DEBUG)
...
llvm-svn: 130448
2011-04-28 22:26:05 +00:00
Benjamin Kramer
cf9d1ad62e
We require threse bits to be zero, too.
...
This shouldn't happen in practice because the icmp would be a constant.
Add a check so we don't miscompile code if something goes wrong.
llvm-svn: 130446
2011-04-28 21:38:51 +00:00
Nick Lewycky
6aa79492a5
Only read *predecessor once so as to fix a theoretical issue where it changes
...
between two reads (threading).
Fix an off-by-one in the indirect counter table that I meant to revert after an
earlier experiment. Whoops!
Implement GCOV_PREFIX. Doesn't handle GCOV_PREFIX_STRIP yet.
Fix an off-by-one in string emission. Extra whoops!
Tolerate DISubprograms that have null Function*'s attached to them. I don't yet
understand what this means, but it happens when you have a global static with
a non-trivial constructor/destructor.
Fix a crash on switch statements with a single successor (default-only).
llvm-svn: 130443
2011-04-28 21:35:49 +00:00
Daniel Dunbar
a86188bf8e
Target/X86/MC: Add an option for disabling arith relaxation, for my own testing
...
purposes.
llvm-svn: 130438
2011-04-28 21:23:31 +00:00
Rafael Espindola
6bd6a70837
Add the getExprForFDESymbol method that responsible for computing the
...
expressions used in the FDE to refer to symbols.
llvm-svn: 130437
2011-04-28 21:04:39 +00:00
Devang Patel
d36bdb5208
Beautify debug info probe output.
...
llvm-svn: 130435
2011-04-28 20:46:18 +00:00
Ted Kremenek
e203bbb47e
Add MemoryBuffer::getBufferKind() to report whether a memory buffer uses malloc'ed or mmap'ed memory. This is for performance analysis.
...
llvm-svn: 130432
2011-04-28 20:34:18 +00:00
Devang Patel
72aa1a8a68
Remove DbgDeclare only if all uses are converted.
...
llvm-svn: 130431
2011-04-28 20:32:02 +00:00
Lenny Maiorani
367342e209
Remove bounded StringRef::compare() since nothing but Clang SA was using it and it is just as easy to use StringRef::substr() preceding StringRef::compare() to achieve the same thing.
...
llvm-svn: 130430
2011-04-28 20:20:12 +00:00
Eli Friedman
7cd5101ad3
fast-isel sret calls, try 2. We actually do need to do something on x86-32. rdar://problem/9303592 .
...
llvm-svn: 130429
2011-04-28 20:19:12 +00:00
Benjamin Kramer
101720fb58
Fix a comment.
...
llvm-svn: 130428
2011-04-28 20:09:57 +00:00
Chris Lattner
a5452c0d67
improve comment.
...
llvm-svn: 130426
2011-04-28 20:02:57 +00:00
Devang Patel
33d87d97f6
Do not lose line number info while eliminating tail call.
...
llvm-svn: 130419
2011-04-28 18:43:39 +00:00
Chris Lattner
1777601a74
final step needed to resolve PR6627, which allows us to flatten the code down to
...
a nice and tidy:
%x1 = load i32* %0, align 4
%1 = icmp eq i32 %x1, 1179403647
br i1 %1, label %if.then, label %if.end
instead of doing lots of loads and branches. May the FreeBSD bootloader
long fit in its allocated space.
llvm-svn: 130416
2011-04-28 18:15:47 +00:00
Chris Lattner
45e393fc9c
code cleanups only.
...
llvm-svn: 130414
2011-04-28 18:08:21 +00:00
Eli Friedman
d5a80ca3c8
Revert r130348; causing buildbot issues on x86-32.
...
llvm-svn: 130412
2011-04-28 18:06:10 +00:00
Devang Patel
b63596436f
Add command line option to print debug info in human readable form as comment in llvm IR output. This, i.e -enable-debug-info-comment, is very useful if you want to easily find out which optimization pass is losing line number information.
...
llvm-svn: 130409
2011-04-28 17:41:38 +00:00
Andrew Trick
c4456ae6ec
Reapply r130340: Fix for PR9730.
...
llvm-svn: 130408
2011-04-28 17:30:04 +00:00
Benjamin Kramer
4145c0d3b1
InstCombine: Merge "(trunc x) == C1 & (and x, CA) == C2" into a single and+icmp.
...
This happens when GVN widens loads. Part of PR6627.
llvm-svn: 130405
2011-04-28 16:58:40 +00:00
Eric Christopher
4f012fd0a1
Be more layout aware here and swap the successor and branch condition
...
if it means we get a fallthrough.
llvm-svn: 130404
2011-04-28 16:52:09 +00:00
Chris Lattner
f81f789b6c
centralize "marking for deletion" into a helper function. Pass GVN around to
...
static functions instead of passing around tons of random ivars.
llvm-svn: 130403
2011-04-28 16:36:48 +00:00
Chris Lattner
6cec6ab275
Promote toErase to be an ivar of the GVN class.
...
llvm-svn: 130401
2011-04-28 16:18:52 +00:00
Rafael Espindola
c5dac4df2e
Add a getExprForPersonalitySymbol method to MCAsmInfo. Use it when
...
converting the symbol passed to .cfi_personality into bytes is the file.
llvm-svn: 130400
2011-04-28 16:09:09 +00:00
Rafael Espindola
349c3298da
Mark the EH symbol global or weak if the corresponding function is.
...
llvm-svn: 130397
2011-04-28 12:50:37 +00:00
Chandler Carruth
93da3c8233
Fix the last -Wnon-pod-memset I'm seeing. This is benign, but appears
...
a bit more sinister as the memset doesn't do what the constructor does.
There seems to be a cleaner solution than a cast here though, instead we
can point the memset destination into the union its actually trying to
clear.
An alternative is to point to the Untyped member of this union. Review
appreciated, and if that is cleaner I'm happy to switch. All of these
should be functionally equivalent to the original code.
llvm-svn: 130395
2011-04-28 08:37:18 +00:00
Chris Lattner
827a270a2a
teach GVN to widen integer loads when they are overaligned, when doing an
...
wider load would allow elimination of subsequent loads, and when the wider
load is still a native integer type. This eliminates a ton of loads on
various benchmarks involving struct fields, though it is somewhat hobbled
by clang not being very aggressive about field alignment.
This is yet another step along the way towards resolving PR6627.
llvm-svn: 130390
2011-04-28 07:29:08 +00:00
Eric Christopher
a98cd22d96
Let the immediate leaf pattern take transforms and switch the signed
...
immediate patterns in arm to using the pattern.
Handles rdar://9299434
llvm-svn: 130386
2011-04-28 05:49:04 +00:00
Chris Lattner
2a75c72e1c
move PR9803 to this readme.
...
llvm-svn: 130385
2011-04-28 05:33:16 +00:00
Rafael Espindola
2eeee8cfef
Add a small temporary hack for producing identical eh_frame sections on OS X.
...
This removes one of the main advantages of moving eh_frame to MC, but
makes the transition a lot easier to debug (run md5).
llvm-svn: 130379
2011-04-28 04:04:14 +00:00
Rafael Espindola
bf60fb0a37
Produce the EH_frame# symbols if needed.
...
llvm-svn: 130378
2011-04-28 03:26:11 +00:00
Rafael Espindola
96b07932a3
Forward isFunctionEHFrameSymbolPrivate. If it is false, produce the foo.eh
...
symbols.
llvm-svn: 130375
2011-04-28 02:46:42 +00:00
Devang Patel
3e021533cd
Teach dwarf writer to handle complex address expression for .debug_loc entries.
...
This fixes clang generated blocks' variables' debug info.
Radar 9279956.
llvm-svn: 130373
2011-04-28 02:22:40 +00:00
Eli Friedman
33c133919a
Fix a silly mistake in r130338.
...
llvm-svn: 130360
2011-04-28 00:42:03 +00:00
Justin Holewinski
45c30df303
PTX: support for select_cc and fixes for setcc
...
- expansion of SELECT_CC into SETCC
- force SETCC result type to i1
- custom selection for handling i1 using SETCC
Patch by Dan Bailey
llvm-svn: 130358
2011-04-28 00:19:56 +00:00
Justin Holewinski
498f703d84
PTX: support for select
...
- selection of SELP instruction
- new selp.ll test
Patch by Dan Bailey
llvm-svn: 130357
2011-04-28 00:19:55 +00:00
Justin Holewinski
e7d272e68b
PTX: mov fix and rounding correction for cvt
...
- fix typo in MOV
- correct fp rounding on CVT
- new cvt.ll test
Patch by Dan Bailey
llvm-svn: 130356
2011-04-28 00:19:54 +00:00
Justin Holewinski
f6880019d1
PTX: support for fneg
...
- selection of FNEG instruction
- new fneg.ll test
Patch by Dan Bailey
llvm-svn: 130355
2011-04-28 00:19:53 +00:00
Justin Holewinski
99e03f1943
PTX: support for zext loads and trunc stores
...
- expansion of EXTLOAD and TRUNCSTORE instructions
Patch by Dan Bailey
llvm-svn: 130354
2011-04-28 00:19:52 +00:00
Justin Holewinski
18e6ac83ea
PTX: support for bitwise operations on predicates
...
- selection of bitwise preds (AND, OR, XOR)
- new bitwise.ll test
Patch by Dan Bailey
llvm-svn: 130353
2011-04-28 00:19:51 +00:00
Justin Holewinski
638f0eb116
PTX: patch to AsmPrinter
...
- immediate value cast as long not int
- handles initializer for constant array
Patch by Dan Bailey
llvm-svn: 130352
2011-04-28 00:19:50 +00:00
Andrew Trick
1e34241abd
Reverting r130340 in the unlikely event that it's responsible for a llvm-gcc stage2 compiler error.
...
llvm-svn: 130350
2011-04-28 00:13:59 +00:00
Eli Friedman
8bd572fc58
fast-isel sret. We actually don't need to do anything special on x86. :) rdar://problem/9303592 .
...
llvm-svn: 130348
2011-04-27 23:58:52 +00:00
Rafael Espindola
ce83fc3463
Remove unnecessary argument.
...
llvm-svn: 130343
2011-04-27 23:17:57 +00:00
Rafael Espindola
08704349da
Rename getPersonalityPICSymbol to getCFIPersonalitySymbol, document it, and
...
give it a bit more responsibility. Also implement it for MachO.
If hacked to use cfi, 32 bit MachO will produce
.cfi_personality 155, L___gxx_personality_v0$non_lazy_ptr
and 64 bit will produce
.cfi_presonality ___gxx_personality_v0
The general idea is that .cfi_personality gets passed the final symbol. It is
up to codegen to produce it if using indirect representation (like 32 bit
MachO), but it is up to MC to decide which relocations to create.
llvm-svn: 130341
2011-04-27 23:08:15 +00:00
Andrew Trick
29ac7b8858
Fixes PR9730: indvars: An asserting value handle still pointed to this value
...
Modified LinearFunctionTestReplace to push the condition on the dead
list instead of eagerly deleting it. This can cause unnecessary
IV rewrites, which should have no effect on codegen and will not be an
issue once we stop generating canonical IVs.
llvm-svn: 130340
2011-04-27 23:00:03 +00:00
Devang Patel
77dc541b00
Simplify handling of variables with complex address (i.e. blocks variables)
...
llvm-svn: 130339
2011-04-27 22:45:24 +00:00
Eli Friedman
406c471b69
Make the fast-isel code for literal 0.0 a bit shorter/faster, since 0.0 is common. rdar://problem/9303592 .
...
llvm-svn: 130338
2011-04-27 22:41:55 +00:00
Eli Friedman
121d27e9e4
Remove unused function.
...
llvm-svn: 130337
2011-04-27 22:21:02 +00:00
Rafael Espindola
3989776770
Fix indentation.
...
llvm-svn: 130331
2011-04-27 21:29:52 +00:00
Kevin Enderby
886894cb70
Fix a bug in the case that there is no add or subtract symbol and the offset
...
value is zero so it does not add a NULL expr operand.
llvm-svn: 130330
2011-04-27 21:02:27 +00:00
Dan Gohman
5394c70d1e
Teach BasicAA about arm.neon.vld1 and vst1.
...
llvm-svn: 130327
2011-04-27 20:44:28 +00:00
Devang Patel
e3745fdcf3
Revert r130178. It turned out to be not the optimal path to emit complex location expressions.
...
llvm-svn: 130326
2011-04-27 20:29:27 +00:00
Evan Cheng
9808d31b9e
If converter was being too cute. It look for root BBs (which don't have
...
successors) and use inverse depth first search to traverse the BBs. However
that doesn't work when the CFG has infinite loops. Simply do a linear
traversal of all BBs work just fine.
rdar://9344645
llvm-svn: 130324
2011-04-27 19:32:43 +00:00
Dan Gohman
39b3a1ef7f
When analyzing functions known to only access argument pointees,
...
only check arguments with pointer types. Update the documentation
of IntrReadArgMem reflect this.
While here, add support for TBAA tags on intrinsic calls.
llvm-svn: 130317
2011-04-27 18:39:03 +00:00
Andrew Trick
7d1eea86d9
Corrects an old, old typo in a case that doesn't seem to be reached in practice.
...
llvm-svn: 130316
2011-04-27 18:17:36 +00:00
Devang Patel
12bf0ab4b5
Simplify cfg inserts a call to trap when unreachable code is detected. Assign DebugLoc to this new trap instruction.
...
llvm-svn: 130315
2011-04-27 17:59:27 +00:00
Jakob Stoklund Olesen
71d3b895ba
Also add <imp-def> operands for defined and dead super-registers when rewriting.
...
We cannot rely on the <imp-def> operands added by LiveIntervals in all cases as
demonstrated by the test case.
llvm-svn: 130313
2011-04-27 17:42:31 +00:00
Rafael Espindola
27c0c9bb87
Factor a bit of code to MCStreamer::EmitLabel. Keep track of the last
...
non private symbol. This will be use for handling
foo:
.cfi_startproc
...
On OS X where we have to create a foo.eh symbol.
llvm-svn: 130305
2011-04-27 15:21:19 +00:00
Duncan Sands
085ad3b81a
Stop trying to have instcombine preserve LCSSA form: this was not
...
effective in avoiding recomputation of LCSSA form; the widespread
use of instsimplify (which looks through phi nodes) means it was
not preserving LCSSA form anyway; and instcombine is no longer
scheduled in the middle of the loop passes so this doesn't matter
anymore.
llvm-svn: 130301
2011-04-27 10:55:12 +00:00
Andrew Trick
01eff820ae
Test case and comment for PR9633.
...
llvm-svn: 130294
2011-04-27 05:42:17 +00:00
Eli Friedman
bcc6914146
Refactor out code to fast-isel a memcpy operation with a small constant
...
length. (I'm planning to use this to implement byval.)
llvm-svn: 130274
2011-04-27 01:45:07 +00:00
Rafael Espindola
ae124da625
Force some values to be absolute and align based on the FDE pointers size. A small
...
step towards using .cfi_* on OS X.
llvm-svn: 130273
2011-04-27 01:43:49 +00:00
Eli Friedman
0eea0293d9
Fix an edge case involving branches in fast-isel on x86.
...
rdar://problem/9303306 .
llvm-svn: 130272
2011-04-27 01:34:27 +00:00
Andrew Trick
759ba0802d
Fix for PR9633 [indvars] Assertion `isa<X>(Val) && "cast<Ty>() argument of incompatible type!"' failed.
...
Added a type check in ScalarEvolution::computeSCEVAtScope to handle the case in which operands of an
AddRecExpr in the current scope are folded.
llvm-svn: 130271
2011-04-27 01:21:25 +00:00
Chris Lattner
7aab2799ae
Enhance memdep to return clobber relation between noalias loads when
...
an earlier load could be widened to encompass a later load. For example,
if we see:
X = load i8* P, align 4
Y = load i8* (P+3), align 1
and we have a 32-bit native integer type, we can widen the former load
to i32 which then makes the second load redundant. GVN can't actually
do anything with this load/load relation yet, so this isn't testable, but
it is the next step to resolving PR6627, and a fairly general class of
"merge neighboring loads" missed optimizations.
llvm-svn: 130250
2011-04-26 22:42:01 +00:00
Jakob Stoklund Olesen
eef2327360
Add a safe-guard against repeated splitting for some rare cases.
...
The number of blocks covered by a live range must be strictly decreasing when
splitting, otherwise we can't allow repeated splitting.
llvm-svn: 130249
2011-04-26 22:33:12 +00:00
Chris Lattner
32dc9bd1bb
use AA::isMustAlias to simplify some calls.
...
llvm-svn: 130248
2011-04-26 21:53:34 +00:00
Chris Lattner
6b96621a8a
remove support for llvm.invariant.end from memdep. It is a
...
work-in-progress that is not progressing, and it has issues.
llvm-svn: 130247
2011-04-26 21:50:51 +00:00
Evan Cheng
1355bbdd11
Be careful about scheduling nodes above previous calls. It increase usages of
...
more callee-saved registers and introduce copies. Only allows it if scheduling
a node above calls would end up lessen register pressure.
Call operands also has added ABI restrictions for register allocation, so be
extra careful with hoisting them above calls.
rdar://9329627
llvm-svn: 130245
2011-04-26 21:31:35 +00:00
Chris Lattner
1b06c71668
Transform: "icmp eq (trunc (lshr(X, cst1)), cst" to "icmp (and X, mask), cst"
...
when X has multiple uses. This is useful for exposing secondary optimizations,
but the X86 backend isn't ready for this when X has a single use. For example,
this can disable load folding.
This is inching towards resolving PR6627.
llvm-svn: 130238
2011-04-26 20:18:20 +00:00
Chris Lattner
31b106d7dd
some random cleanups, no functionality change.
...
llvm-svn: 130237
2011-04-26 20:02:45 +00:00
Jim Grosbach
d4b733e4d8
ARM and Thumb2 support for atomic MIN/MAX/UMIN/UMAX loads.
...
rdar://9326019
llvm-svn: 130234
2011-04-26 19:44:18 +00:00
Rafael Espindola
a4fa5ce911
Print the label if we will use it in debug_frame.
...
llvm-svn: 130232
2011-04-26 19:26:53 +00:00
Devang Patel
ba5fbf17df
Refactor code. Keep dwarf register operation selection logic at one place.
...
llvm-svn: 130231
2011-04-26 19:06:18 +00:00
Jakob Stoklund Olesen
3b7b7bcc7f
Use the new TRI->getLargestLegalSuperClass hook to constrain register class inflation.
...
This has two effects: 1. We never inflate to a larger register class than what
the sub-target can handle. 2. Completely unconstrained virtual registers get the
largest possible register class.
llvm-svn: 130229
2011-04-26 18:52:36 +00:00
Jakob Stoklund Olesen
803a200077
Add a TRI::getLargestLegalSuperClass hook to provide an upper limit on register class inflation.
...
The hook will be used by the register allocator when recomputing register
classes after removing constraints.
Thumb1 code doesn't allow anything larger than tGPR, and x86 needs to ensure
that the spill size doesn't change.
llvm-svn: 130228
2011-04-26 18:52:33 +00:00
Devang Patel
b5ea255fb4
Fix an off by one error while accessing complex address element of a DIVariable.
...
This worked untill now because stars are aligned (i.e. num of complex address elments are always 0 or 2+ and when it is 2+ at least two elements are access together)
llvm-svn: 130225
2011-04-26 18:24:39 +00:00
Chris Lattner
eb045f9c02
Improve the bail-out predicate to really only kick in when phi
...
translation fails. We were bailing out in some cases that would
cause us to miss GVN'ing some non-local cases away.
llvm-svn: 130206
2011-04-26 17:41:02 +00:00
Dan Gohman
7da91aee83
Fast-isel support for simple inline asms.
...
llvm-svn: 130205
2011-04-26 17:18:34 +00:00
Duncan Sands
d4ea3ec87f
Another example of a static table that wasn't marked static.
...
llvm-svn: 130193
2011-04-26 07:30:10 +00:00
Chris Lattner
189ca1498f
don't emit the symbol name twice for local bss and common
...
symbols. For example, don't emit:
.comm _i,4,2 ## @i
## @i
instead emit:
.comm _i,4,2 ## @i
llvm-svn: 130192
2011-04-26 06:14:13 +00:00
Evan Cheng
2f64754031
Fix typo
...
llvm-svn: 130190
2011-04-26 04:57:37 +00:00
Rafael Espindola
80cb3cb1d6
Print all the moves at a given label instead of just the first one.
...
Remove previous DwarfCFI hack.
llvm-svn: 130187
2011-04-26 03:58:56 +00:00
Nick Lewycky
c58d293a6f
Rename everything to follow LLVM style ... I think.
...
Add support for switch and indirectbr edges. This works by densely numbering
all blocks which have such terminators, and then separately numbering the
possible successors. The predecessors write down a number, the successor knows
its own number (as a ConstantInt) and sends that and the pointer to the number
the predecessor wrote down to the runtime, who looks up the counter in a
per-function table.
Coverage data should now be functional, but I haven't tested it on anything
other than my 2-file synthetic test program for coverage.
llvm-svn: 130186
2011-04-26 03:54:16 +00:00
Rafael Espindola
3584ab6cc6
No relocation produces a SLEB or ULEB, make sure they are handled in MC.
...
llvm-svn: 130181
2011-04-26 02:17:58 +00:00
Chris Lattner
6f83d06ffa
Enhance MemDep: When alias analysis returns a partial alias result,
...
return it as a clobber. This allows GVN to do smart things.
Enhance GVN to be smart about the case when a small load is clobbered
by a larger overlapping load. In this case, forward the value. This
allows us to compile stuff like this:
int test(void *P) {
int tmp = *(unsigned int*)P;
return tmp+*((unsigned char*)P+1);
}
into:
_test: ## @test
movl (%rdi), %ecx
movzbl %ch, %eax
addl %ecx, %eax
ret
which has one load. We already handled the case where the smaller
load was from a must-aliased base pointer.
llvm-svn: 130180
2011-04-26 01:21:15 +00:00
Devang Patel
cae2fbd6fc
Let dwarf writer allocate extra space in the debug location expression. This space, if requested, will be used for complex addresses of the Blocks' variables.
...
llvm-svn: 130178
2011-04-26 00:12:46 +00:00
Devang Patel
2606f4d6d2
Rename a local variable.
...
llvm-svn: 130171
2011-04-25 23:05:21 +00:00
Devang Patel
8ce24133fd
Rename a method to match what it really does.
...
s/addVariableAddress/addFrameVariableAddress/g
llvm-svn: 130170
2011-04-25 23:02:17 +00:00
Devang Patel
2688e4aba6
Do not drop a variable's complex address if it is not based on frame base.
...
Observed this while reading code, so I do not have a test case handy here.
llvm-svn: 130167
2011-04-25 22:52:55 +00:00
Dan Gohman
6acd95b3c1
Fix an iterator invalidation bug.
...
llvm-svn: 130166
2011-04-25 22:48:29 +00:00
Chris Lattner
f5ba0415df
mark a large static table static. Pointed out by Michael Ilseman!
...
llvm-svn: 130160
2011-04-25 22:14:33 +00:00
Chris Lattner
63e9190f71
allow adding a FoldingSetNodeID to a FastFoldingSetNode, resolving PR9499,
...
patch by Johannes Schaub!
llvm-svn: 130151
2011-04-25 20:58:50 +00:00
Chris Lattner
6e29892430
add a missed bitfield instcombine.
...
llvm-svn: 130137
2011-04-25 18:44:26 +00:00
Akira Hatanaka
0e7ee666b7
Lower BlockAddress node when relocation-model is static.
...
llvm-svn: 130131
2011-04-25 17:10:45 +00:00
Devang Patel
734f2218ac
A dbg.declare may not be in entry block, even if it is referring to an incoming argument. However, It is appropriate to emit DBG_VALUE referring to this incoming argument in entry block in MachineFunction.
...
llvm-svn: 130129
2011-04-25 16:33:52 +00:00
Chandler Carruth
9b73c8e293
Remove some hard coded CR-LFs. Some of these were the entire files, one of
...
these was just one line of a file. Explicitly set the eol-style property on the
files to try and ensure this fix stays.
llvm-svn: 130125
2011-04-25 07:11:23 +00:00
Duncan Sands
56ca6292dc
Fix comment typo. Noticed by Liu.
...
llvm-svn: 130120
2011-04-25 06:21:43 +00:00
Rafael Espindola
a076199e71
Simplify the logic. Noticed by aKor.
...
llvm-svn: 130116
2011-04-24 19:55:34 +00:00
Rafael Espindola
5c54ecc9af
Synchronize the conditions for producing a .cfi_startproc and a .cfi_endproc.
...
Fixes PR9787.
llvm-svn: 130115
2011-04-24 19:00:34 +00:00
Sebastian Redl
5519ff9d4e
Fix Target/ARM/Thumb1FrameLowering.h header guard.
...
llvm-svn: 130097
2011-04-24 15:47:01 +00:00
Sebastian Redl
1b86ea80bb
Give MC/MCDisassembler/Disassembler.h a header guard.
...
llvm-svn: 130096
2011-04-24 15:46:56 +00:00
Sebastian Redl
b8a62aa3c9
Give SplitKit.h a header guard.
...
llvm-svn: 130095
2011-04-24 15:46:51 +00:00
Jay Foad
f7adb3204e
Fix an assert to check exactly what it says.
...
llvm-svn: 130093
2011-04-24 14:30:00 +00:00
Jay Foad
dbf81d8ddf
PR9214: Convert the DIBuilder API to use ArrayRef.
...
llvm-svn: 130086
2011-04-24 10:11:03 +00:00
Jay Foad
1a180156b6
Remove unused STL header includes.
...
llvm-svn: 130068
2011-04-23 19:53:52 +00:00