aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/CodeGen
AgeCommit message (Collapse)AuthorFilesLines
2011-01-04Turn the EdgeBundles class into a stand-alone machine CFG analysis pass.Jakob Stoklund Olesen4-88/+81
The analysis will be needed by both the greedy register allocator and the X86FloatingPoint pass. It only needs to be computed once when the CFG doesn't change. This pass is very fast, usually showing up as 0.0% wall time. llvm-svn: 122832
2011-01-04Switch to path halving from path compression for a small speedup. This alsoCameron Zwarich1-6/+12
makes getLeader() nonrecursive. llvm-svn: 122811
2011-01-04Eliminate repeated allocation of a per-BB DenseMap for a 4.6% reduction of timeCameron Zwarich1-6/+5
spent in StrongPHIElimination on 403.gcc. llvm-svn: 122803
2011-01-04Clean up a funky pass registration that got passed over when I got rid of ↵Owen Anderson1-7/+1
static constructors. llvm-svn: 122795
2011-01-03Use a RecyclingAllocator to allocate values for MachineCSE's ScopedHashTable forCameron Zwarich1-3/+7
a 28% speedup of MachineCSE time on 403.gcc. llvm-svn: 122735
2011-01-02split dom frontier handling stuff out to its own DominanceFrontier header,Chris Lattner1-0/+1
so that Dominators.h is *just* domtree. Also prune #includes a bit. llvm-svn: 122714
2011-01-02Try to reuse the value when lowering memset.Benjamin Kramer1-3/+21
This allows us to compile: void test(char *s, int a) { __builtin_memset(s, a, 15); } into 1 mul + 3 stores instead of 3 muls + 3 stores. llvm-svn: 122710
2011-01-02Lower the i8 extension in memset to a multiply instead of a potentially long ↵Benjamin Kramer1-15/+17
series of shifts and ors. We could implement a DAGCombine to turn x * 0x0101 back into logic operations on targets that doesn't support the multiply or it is slow (p4) if someone cares enough. Example code: void test(char *s, int a) { __builtin_memset(s, a, 4); } before: _test: ## @test movzbl 8(%esp), %eax movl %eax, %ecx shll $8, %ecx orl %eax, %ecx movl %ecx, %eax shll $16, %eax orl %ecx, %eax movl 4(%esp), %ecx movl %eax, 4(%ecx) movl %eax, (%ecx) ret after: _test: ## @test movzbl 8(%esp), %eax imull $16843009, %eax, %eax ## imm = 0x1010101 movl 4(%esp), %ecx movl %eax, 4(%ecx) movl %eax, (%ecx) ret llvm-svn: 122707
2010-12-30Use getVRegDef() instead of def_iterator. This leads to fewer defs being addedCameron Zwarich1-4/+3
with 2-address instructions, for about a 3.5% speedup of StrongPHIElimination on 403.gcc. llvm-svn: 122635
2010-12-29None of the other pass names in CodeGen have terminating periods.Cameron Zwarich1-2/+2
llvm-svn: 122628
2010-12-29Instead of processing every instruction when splitting interferences, onlyCameron Zwarich1-27/+61
process those instructions that define phi sources. This is a 47% speedup of StrongPHIElimination compile time on 403.gcc. llvm-svn: 122627
2010-12-29Add a missing word to a comment.Cameron Zwarich1-1/+1
llvm-svn: 122625
2010-12-29Add text explaining an assertion.Cameron Zwarich1-1/+3
llvm-svn: 122617
2010-12-28Simplify some code in MachineVerifier that was doing the correct thing, but notCameron Zwarich1-10/+11
in the most obvious way. llvm-svn: 122610
2010-12-28Revert the optimization in r122596. It is correct for all current targets, butCameron Zwarich1-1/+8
it relies on assumptions that may not be true in the future. llvm-svn: 122608
2010-12-28Avoid iterating every operand of an instruction in StrongPHIElimination, sinceCameron Zwarich1-4/+3
we are only interested in the defs when discovering interferences. This is a 28% speedup running StrongPHIElimination on 403.gcc. llvm-svn: 122596
2010-12-28Pacify the compiler. BestWeight cannot in fact be used uninitializedDuncan Sands1-1/+1
in this function, but the compiler was warning that it might be when doing a release build. llvm-svn: 122595
2010-12-27Change an assertion to assert what the code actually relies upon.Cameron Zwarich1-1/+1
llvm-svn: 122586
2010-12-27Land a first cut at StrongPHIElimination. There are only 5 new test failuresCameron Zwarich1-64/+590
when running without the verifier, and I have not yet checked them to see if the new results are still correct. There are more verifier failures, but they all seem to be additional occurrences of verifier failures that occur with the existing PHIElimination pass. There are a few obvious issues with the code: 1) It doesn't properly update the register equivalence classes during copy insertion, and instead recomputes them before merging live intervals and renaming registers. I wanted to keep this first patch simple for debugging purposes, but it shouldn't be very hard to do this. 2) It doesn't mix the renaming and live interval merging with the copy insertion process, which leads to a lot of virtual register churn. Virtual registers and live intervals are created, only to later be merged into others. The code should be smarter and only create a new virtual register if there is no existing register in the same congruence class. 3) In one place the code uses a DenseMap per basic block, which is unnecessary heap allocation. There should be an inline storage version of DenseMap. I did a quick compile-time test of running llc on 403.gcc with and without StrongPHIElimination. It is slightly slower with StrongPHIElimination, because the small decrease in the coalescer runtime can't beat the increase in phi elimination runtime. Perhaps fixing the above performance issues will narrow the gap. I also haven't yet run any tests of the quality of the generated code. llvm-svn: 122582
2010-12-27Add knowledge of phi-def and phi-kill valnos to MachineVerifier's predecessorCameron Zwarich1-1/+17
valno verification. The "Different value live out of predecessor" check is incorrect in the case of phi-def valnos, so just skip that check for phi-def valnos and instead check that all of the valnos for predecessors have phi-kill. Fixes PR8863. llvm-svn: 122581
2010-12-24Minor cleanup related to my latest scheduler changes.Andrew Trick1-3/+5
llvm-svn: 122545
2010-12-24Fix a few cases where the scheduler is not checking for phys reg copies. The ↵Andrew Trick2-4/+11
scheduling node may have a NULL DAG node, yuck. llvm-svn: 122544
2010-12-24Various bits of framework needed for precise machine-level selectionAndrew Trick8-129/+508
DAG scheduling during isel. Most new functionality is currently guarded by -enable-sched-cycles and -enable-sched-hazard. Added InstrItineraryData::IssueWidth field, currently derived from ARM itineraries, but could be initialized differently on other targets. Added ScheduleHazardRecognizer::MaxLookAhead to indicate whether it is active, and if so how many cycles of state it holds. Added SchedulingPriorityQueue::HasReadyFilter to allowing gating entry into the scheduler's available queue. ScoreboardHazardRecognizer now accesses the ScheduleDAG in order to get information about it's SUnits, provides RecedeCycle for bottom-up scheduling, correctly computes scoreboard depth, tracks IssueCount, and considers potential stall cycles when checking for hazards. ScheduleDAGRRList now models machine cycles and hazards (under flags). It tracks MinAvailableCycle, drives the hazard recognizer and priority queue's ready filter, manages a new PendingQueue, properly accounts for stall cycles, etc. llvm-svn: 122541
2010-12-24whitespaceAndrew Trick3-178/+178
llvm-svn: 122539
2010-12-24Simplify a check for implicit defs and remove a FIXME.Cameron Zwarich1-8/+6
llvm-svn: 122537
2010-12-23flags -> glue for selectiondagChris Lattner6-78/+77
llvm-svn: 122509
2010-12-23sdisel flag -> glue.Chris Lattner1-77/+76
llvm-svn: 122507
2010-12-23Reorganize ListScheduleBottomUp in preparation for modeling machine cycles ↵Andrew Trick1-130/+153
and instruction issue. llvm-svn: 122491
2010-12-23Converted LiveRegCycles to LiveRegGens. It's easier to work with and allows ↵Andrew Trick1-17/+18
multiple nodes per cycle. llvm-svn: 122474
2010-12-23In CheckForLiveRegDef use TRI->getOverlaps.Andrew Trick1-6/+9
llvm-svn: 122473
2010-12-23Fixes PR8823: add-with-overflow-128.llAndrew Trick1-12/+33
In the bottom-up selection DAG scheduling, handle two-address instructions that read/write unspillable registers. Treat the entire chain of two-address nodes as a single live range. llvm-svn: 122472
2010-12-23Change all self assignments X=X to (void)X, so that we can turn on aJeffrey Yasskin4-9/+9
new gcc warning that complains on self-assignments and self-initializations. llvm-svn: 122458
2010-12-22DAGCombine add (sext i1), X into sub X, (zext i1) if sext from i1 is ↵Benjamin Kramer1-0/+9
illegal. The latter usually compiles into smaller code. example code: unsigned foo(unsigned x, unsigned y) { if (x != 0) y--; return y; } before: _foo: ## @foo cmpl $1, 4(%esp) ## encoding: [0x83,0x7c,0x24,0x04,0x01] sbbl %eax, %eax ## encoding: [0x19,0xc0] notl %eax ## encoding: [0xf7,0xd0] addl 8(%esp), %eax ## encoding: [0x03,0x44,0x24,0x08] ret ## encoding: [0xc3] after: _foo: ## @foo cmpl $1, 4(%esp) ## encoding: [0x83,0x7c,0x24,0x04,0x01] movl 8(%esp), %eax ## encoding: [0x8b,0x44,0x24,0x08] adcl $-1, %eax ## encoding: [0x83,0xd0,0xff] ret ## encoding: [0xc3] llvm-svn: 122455
2010-12-22When RegAllocGreedy decides to spill the interferences of the current register,Jakob Stoklund Olesen1-37/+89
pick the victim with the lowest total spill weight. llvm-svn: 122445
2010-12-22Include a shadow of the original CFG edges in the edge bundle graph.Jakob Stoklund Olesen1-0/+4
llvm-svn: 122444
2010-12-22Fix a bug in ReduceLoadWidth that wasn't handling extendingChris Lattner1-1/+4
loads properly. We miscompiled the testcase into: _test: ## @test movl $128, (%rdi) movzbl 1(%rdi), %eax ret Now we get a proper: _test: ## @test movl $128, (%rdi) movsbl (%rdi), %eax movzbl %ah, %eax ret This fixes PR8757. llvm-svn: 122392
2010-12-22more cleanups, move a check for "roundedness" earlier to rejectChris Lattner1-14/+20
unhanded cases faster and simplify code. llvm-svn: 122391
2010-12-22reduce indentation and improve comments, no functionality change.Chris Lattner1-51/+53
llvm-svn: 122389
2010-12-21In DelayForLiveRegsBottomUp, handle instructions that read and writeAndrew Trick1-15/+4
the same physical register. Simplifies the fix from the previous checkin r122211. llvm-svn: 122370
2010-12-21whitespaceAndrew Trick1-42/+42
llvm-svn: 122368
2010-12-21Reapply 122353-122355 with fixes. 122354 was wrong;Dale Johannesen1-4/+31
the shift type was needed one place, the shift count type another. The transform in 123555 had the same problem. llvm-svn: 122366
2010-12-21Revert 122353-122355 for the moment, they broke stuff.Dale Johannesen1-29/+3
llvm-svn: 122360
2010-12-21Add a new transform to DAGCombiner.Dale Johannesen1-0/+26
llvm-svn: 122355
2010-12-21Get the type of a shift from the shift, not from its shiftDale Johannesen1-1/+1
count operand. These should be the same but apparently are not always, and this is cleaner anyway. This improves the code in an existing test. llvm-svn: 122354
2010-12-21Shift by the word size is invalid IR; don't create it.Dale Johannesen1-2/+2
llvm-svn: 122353
2010-12-21fix some typosChris Lattner1-2/+1
llvm-svn: 122349
2010-12-21Fix indentation, add comment.Stuart Hastings1-4/+6
llvm-svn: 122345
2010-12-21Missing logic for nested CALLSEQ_START/END.Stuart Hastings1-2/+5
llvm-svn: 122342
2010-12-21Incremental progress towards a new implementation of StrongPHIElimination. MostCameron Zwarich1-3/+186
of the problems with my last attempt were in the updating of LiveIntervals rather than the coalescing itself. Therefore, I decided to get that right first by essentially reimplementing the existing PHIElimination using LiveIntervals. It works correctly, with only a few tests failing (which may not be legitimate failures) and no new verifier failures (at least as far as I can tell, I didn't count the number per file). llvm-svn: 122321
2010-12-21rename MVT::Flag to MVT::Glue. "Flag" is a terrible name forChris Lattner12-60/+60
something that just glues two nodes together, even if it is sometimes used for flags. llvm-svn: 122310