f4ea1d5f79 
								
							 
						 
						
							
							
								
								SimplifyCFG: Turn switches into sub+icmp+branch if possible.  
							
							... 
							
							
							
							This makes the job of the later optzn passes easier, allowing the vast amount of
icmp transforms to chew on it.
We transform 840 switches in gcc.c, leading to a 16k byte shrink of the resulting
binary on i386-linux.
The testcase from README.txt now compiles into
  decl  %edi
  cmpl  $3, %edi
  sbbl  %eax, %eax
  andl  $1, %eax
  ret
llvm-svn: 124724 
							
						 
						
							2011-02-02 15:56:22 +00:00  
				
					
						
							
							
								 
						
							
								d983eba7dc 
								
							 
						 
						
							
							
								
								Re-apply r124518 with fix. Watch out for invalidated iterator.  
							
							... 
							
							
							
							llvm-svn: 124526 
							
						 
						
							2011-01-29 04:46:23 +00:00  
				
					
						
							
							
								 
						
							
								65b8ccf6ac 
								
							 
						 
						
							
							
								
								Revert r124518. It broke Linux self-host.  
							
							... 
							
							
							
							llvm-svn: 124522 
							
						 
						
							2011-01-29 02:43:04 +00:00  
				
					
						
							
							
								 
						
							
								d4eff31476 
								
							 
						 
						
							
							
								
								Re-commit r124462 with fixes. Tail recursion elim will now dup ret into unconditional predecessor to enable TCE on demand.  
							
							... 
							
							
							
							llvm-svn: 124518 
							
						 
						
							2011-01-29 01:29:26 +00:00  
				
					
						
							
							
								 
						
							
								aaa9606b2f 
								
							 
						 
						
							
							
								
								Revert r124462. There are a few big regressions that I need to fix first.  
							
							... 
							
							
							
							llvm-svn: 124478 
							
						 
						
							2011-01-28 07:12:38 +00:00  
				
					
						
							
							
								 
						
							
								417fca86c4 
								
							 
						 
						
							
							
								
								- Stop simplifycfg from duplicating "ret" instructions into unconditional  
							
							... 
							
							
							
							branches. PR8575, rdar://5134905, rdar://8911460.
- Allow codegen tail duplication to dup small return blocks after register
  allocation is done.
llvm-svn: 124462 
							
						 
						
							2011-01-28 02:19:21 +00:00  
				
					
						
							
							
								 
						
							
								b4017769ae 
								
							 
						 
						
							
							
								
								fix PR9017, a bug where we'd assert when promoting in unreachable  
							
							... 
							
							
							
							code.
llvm-svn: 124100 
							
						 
						
							2011-01-24 03:29:07 +00:00  
				
					
						
							
							
								 
						
							
								23289c385a 
								
							 
						 
						
							
							
								
								fix PR9015, a crash linking recursive metadata.  
							
							... 
							
							
							
							llvm-svn: 124099 
							
						 
						
							2011-01-24 03:18:24 +00:00  
				
					
						
							
							
								 
						
							
								07d6fe34b3 
								
							 
						 
						
							
							
								
								Convert two std::vectors to SmallVectors for a 3.4% speedup running -scalarrepl  
							
							... 
							
							
							
							on test-suite + SPEC2000 & SPEC2006.
llvm-svn: 124068 
							
						 
						
							2011-01-23 08:03:04 +00:00  
				
					
						
							
							
								 
						
							
								fc210c79b7 
								
							 
						 
						
							
							
								
								Convert a std::map to a DenseMap for another 1.7% speedup on -scalarrepl.  
							
							... 
							
							
							
							llvm-svn: 123732 
							
						 
						
							2011-01-18 04:50:38 +00:00  
				
					
						
							
							
								 
						
							
								6968c41ac8 
								
							 
						 
						
							
							
								
								Make a std::vector a SmallVector<*, 32> like the other vectors in the same  
							
							... 
							
							
							
							function. This seems to be about a 1.5% speedup of -scalarrepl on test-suite
with SPEC2000 and SPEC2006.
llvm-svn: 123731 
							
						 
						
							2011-01-18 04:41:32 +00:00  
				
					
						
							
							
								 
						
							
								b703654edc 
								
							 
						 
						
							
							
								
								Remove code for updating dominance frontiers and some outdated references to  
							
							... 
							
							
							
							dominance and post-dominance frontiers.
llvm-svn: 123725 
							
						 
						
							2011-01-18 04:11:31 +00:00  
				
					
						
							
							
								 
						
							
								4694e69540 
								
							 
						 
						
							
							
								
								Remove outdated references to dominance frontiers.  
							
							... 
							
							
							
							llvm-svn: 123724 
							
						 
						
							2011-01-18 03:53:26 +00:00  
				
					
						
							
							
								 
						
							
								b410858a5f 
								
							 
						 
						
							
							
								
								Roll r123609 back in with two changes that fix test failures with expensive  
							
							... 
							
							
							
							checks enabled:
1) Use '<' to compare integers in a comparison function rather than '<='.
2) Use the uniqued set DefBlocks rather than Info.DefiningBlocks to initialize
the priority queue.
The speedup of scalarrepl on test-suite + SPEC2000 + SPEC2006 is a bit less, at
just under 16% rather than 17%.
llvm-svn: 123662 
							
						 
						
							2011-01-17 17:38:41 +00:00  
				
					
						
							
							
								 
						
							
								67431d7943 
								
							 
						 
						
							
							
								
								Roll out r123609 due to failures on the llvm-x86_64-linux-checks bot.  
							
							... 
							
							
							
							llvm-svn: 123618 
							
						 
						
							2011-01-17 07:26:51 +00:00  
				
					
						
							
							
								 
						
							
								814cd9233e 
								
							 
						 
						
							
							
								
								Eliminate the use of dominance frontiers in PromoteMemToReg. In addition to  
							
							... 
							
							
							
							eliminating a potentially quadratic data structure, this also gives a 17%
speedup when running -scalarrepl on test-suite + SPEC2000 + SPEC2006. My initial
experiment gave a greater speedup around 25%, but I moved the dominator tree
level computation from dominator tree construction to PromoteMemToReg.
Since this approach to computing IDFs has a much lower overhead than the old
code using precomputed DFs, it is worth looking at using this new code for the
second scalarrepl pass as well.
llvm-svn: 123609 
							
						 
						
							2011-01-17 01:08:59 +00:00  
				
					
						
							
							
								 
						
							
								b68ec5c339 
								
							 
						 
						
							
							
								
								Generalize LoadAndStorePromoter a bit and switch LICM  
							
							... 
							
							
							
							to use it.
llvm-svn: 123501 
							
						 
						
							2011-01-15 00:12:35 +00:00  
				
					
						
							
							
								 
						
							
								95294b8796 
								
							 
						 
						
							
							
								
								Add a new LoadAndStorePromoter class, which implements the general  
							
							... 
							
							
							
							"promote a bunch of load and stores" logic, allowing the code to
be shared and reused.
llvm-svn: 123456 
							
						 
						
							2011-01-14 19:36:13 +00:00  
				
					
						
							
							
								 
						
							
								90f3a9a1c7 
								
							 
						 
						
							
							
								
								indentation  
							
							... 
							
							
							
							llvm-svn: 123426 
							
						 
						
							2011-01-14 04:23:53 +00:00  
				
					
						
							
							
								 
						
							
								f2407aa98b 
								
							 
						 
						
							
							
								
								Fix a non-deterministic loop in llvm::MergeBlockIntoPredecessor.  
							
							... 
							
							
							
							DT->changeImmediateDominator() trivially ignores identity updates, so there is
really no need for the uniqueing provided by SmallPtrSet.
I expect this to fix PR8954.
llvm-svn: 123286 
							
						 
						
							2011-01-11 22:54:38 +00:00  
				
					
						
							
							
								 
						
							
								d41db8f9cb 
								
							 
						 
						
							
							
								
								this pass claims to preserve scev, make sure to tell it about deletions.  
							
							... 
							
							
							
							llvm-svn: 123247 
							
						 
						
							2011-01-11 18:14:50 +00:00  
				
					
						
							
							
								 
						
							
								8e158495f1 
								
							 
						 
						
							
							
								
								Factor the actual simplification out of SimplifyIndirectBrOnSelect and into a new helper function so it can be reused in e.g. an upcoming SimplifySwitchOnSelect.  
							
							... 
							
							
							
							No functional change.
llvm-svn: 123234 
							
						 
						
							2011-01-11 12:52:11 +00:00  
				
					
						
							
							
								 
						
							
								e2523b287c 
								
							 
						 
						
							
							
								
								when MergeBlockIntoPredecessor merges two blocks, update MemDep if it  
							
							... 
							
							
							
							is floating around in the ether.
llvm-svn: 123223 
							
						 
						
							2011-01-11 08:16:49 +00:00  
				
					
						
							
							
								 
						
							
								f6ae904e34 
								
							 
						 
						
							
							
								
								Fix FoldSingleEntryPHINodes to update memdep and AA when it deletes  
							
							... 
							
							
							
							phi nodes.  It is called from MergeBlockIntoPredecessor which is 
called from GVN, which claims to preserve these.
I'm skeptical that this is the actual problem behind PR8954, but
this is a stab in the right direction.
llvm-svn: 123222 
							
						 
						
							2011-01-11 08:13:40 +00:00  
				
					
						
							
							
								 
						
							
								dfcfcb49fa 
								
							 
						 
						
							
							
								
								random cleanups  
							
							... 
							
							
							
							llvm-svn: 123221 
							
						 
						
							2011-01-11 08:00:40 +00:00  
				
					
						
							
							
								 
						
							
								930b716e1b 
								
							 
						 
						
							
							
								
								various code cleanups, enhance MergeBlockIntoPredecessor to preserve  
							
							... 
							
							
							
							loop info.
llvm-svn: 123074 
							
						 
						
							2011-01-08 19:08:40 +00:00  
				
					
						
							
							
								 
						
							
								30d95f9f87 
								
							 
						 
						
							
							
								
								reduce nesting.  
							
							... 
							
							
							
							llvm-svn: 123071 
							
						 
						
							2011-01-08 18:47:43 +00:00  
				
					
						
							
							
								 
						
							
								84986b298a 
								
							 
						 
						
							
							
								
								Make more passes preserve dominators (or state that they preserve dominators if  
							
							... 
							
							
							
							they all ready do). This removes two dominator recomputations prior to isel,
which is a 1% improvement in total llc time for 403.gcc.
The only potentially suspect thing is making GCStrategy recompute dominators if
it used a custom lowering strategy.
llvm-svn: 123064 
							
						 
						
							2011-01-08 17:01:52 +00:00  
				
					
						
							
							
								 
						
							
								43f8d16482 
								
							 
						 
						
							
							
								
								Revamp the ValueMapper interfaces in a couple ways:  
							
							... 
							
							
							
							1. Take a flags argument instead of a bool.  This makes
   it more clear to the reader what it is used for.
2. Add a flag that says that "remapping a value not in the
   map is ok".
3. Reimplement MapValue to share a bunch of code and be a lot
   more efficient.  For lookup failures, don't drop null values
   into the map.
4. Using the new flag a bunch of code can vaporize in LinkModules
   and LoopUnswitch, kill it.
No functionality change.
llvm-svn: 123058 
							
						 
						
							2011-01-08 08:15:20 +00:00  
				
					
						
							
							
								 
						
							
								89afb43b1e 
								
							 
						 
						
							
							
								
								Remove all uses of the "ugly" method BranchInst::setUnconditionalDest().  
							
							... 
							
							
							
							llvm-svn: 123025 
							
						 
						
							2011-01-07 20:25:56 +00:00  
				
					
						
							
							
								 
						
							
								697de77339 
								
							 
						 
						
							
							
								
								Speed up instsimplify by about 10-15% by not bothering to retry  
							
							... 
							
							
							
							InstructionSimplify on instructions that didn't change since the
last time round the loop.
llvm-svn: 122745 
							
						 
						
							2011-01-03 10:50:04 +00:00  
				
					
						
							
							
								 
						
							
								bf0aa927cc 
								
							 
						 
						
							
							
								
								split dom frontier handling stuff out to its own DominanceFrontier header,  
							
							... 
							
							
							
							so that Dominators.h is *just* domtree.  Also prune #includes a bit.
llvm-svn: 122714 
							
						 
						
							2011-01-02 22:09:33 +00:00  
				
					
						
							
							
								 
						
							
								64f1c0dcda 
								
							 
						 
						
							
							
								
								Fix PR8702 by not having LoopSimplify claim to preserve LCSSA form.  As described  
							
							... 
							
							
							
							in the PR, the pass could break LCSSA form when inserting preheaders.  It probably
would be easy enough to fix this, but since currently we always go into LCSSA form
after running this pass, doing so is not urgent.
llvm-svn: 122695 
							
						 
						
							2011-01-02 13:38:21 +00:00  
				
					
						
							
							
								 
						
							
								2c440fa403 
								
							 
						 
						
							
							
								
								Simplify this pass by using a depth-first iterator to ensure that all  
							
							... 
							
							
							
							operands are visited before the instructions themselves.
llvm-svn: 122647 
							
						 
						
							2010-12-31 17:49:05 +00:00  
				
					
						
							
							
								 
						
							
								6cc7126ed9 
								
							 
						 
						
							
							
								
								Zap dead instructions harder.  
							
							... 
							
							
							
							llvm-svn: 122645 
							
						 
						
							2010-12-31 16:17:54 +00:00  
				
					
						
							
							
								 
						
							
								570dd787a6 
								
							 
						 
						
							
							
								
								Make a bunch of symbols internal.  
							
							... 
							
							
							
							llvm-svn: 122642 
							
						 
						
							2010-12-30 22:34:44 +00:00  
				
					
						
							
							
								 
						
							
								84bd73c527 
								
							 
						 
						
							
							
								
								BuildLibCalls: Nuke EmitMemCpy, EmitMemMove and EmitMemSet. They are dead and superseded by IRBuilder.  
							
							... 
							
							
							
							llvm-svn: 122576 
							
						 
						
							2010-12-27 00:25:32 +00:00  
				
					
						
							
							
								 
						
							
								d729d0dcdb 
								
							 
						 
						
							
							
								
								don't lose TD info  
							
							... 
							
							
							
							llvm-svn: 122556 
							
						 
						
							2010-12-25 20:52:04 +00:00  
				
					
						
							
							
								 
						
							
								20fca48341 
								
							 
						 
						
							
							
								
								switch the inliner alignment enforcement stuff to use the  
							
							... 
							
							
							
							getOrEnforceKnownAlignment function, which simplifies the code
and makes it stronger.
llvm-svn: 122555 
							
						 
						
							2010-12-25 20:42:38 +00:00  
				
					
						
							
							
								 
						
							
								6fcd32e7d7 
								
							 
						 
						
							
							
								
								Move getOrEnforceKnownAlignment out of instcombine into Transforms/Utils.  
							
							... 
							
							
							
							llvm-svn: 122554 
							
						 
						
							2010-12-25 20:37:57 +00:00  
				
					
						
							
							
								 
						
							
								9b43f33620 
								
							 
						 
						
							
							
								
								Change all self assignments X=X to (void)X, so that we can turn on a  
							
							... 
							
							
							
							new gcc warning that complains on self-assignments and
self-initializations.
llvm-svn: 122458 
							
						 
						
							2010-12-23 00:58:24 +00:00  
				
					
						
							
							
								 
						
							
								3b8af41a3e 
								
							 
						 
						
							
							
								
								Visit instructions deterministically.  Use a FIFO so as to approximately  
							
							... 
							
							
							
							visit instructions before their uses, since InstructionSimplify does a
better job in that case.  All this prompted by Frits van Bommel.
llvm-svn: 122343 
							
						 
						
							2010-12-21 17:08:55 +00:00  
				
					
						
							
							
								 
						
							
								e7cbb64ec0 
								
							 
						 
						
							
							
								
								If an instruction simplifies, try again to simplify any uses of it.  This is  
							
							... 
							
							
							
							not very important since the pass is only used for testing, but it does make
it more realistic.  Suggested by Frits van Bommel.
llvm-svn: 122336 
							
						 
						
							2010-12-21 16:12:03 +00:00  
				
					
						
							
							
								 
						
							
								eaff500c7b 
								
							 
						 
						
							
							
								
								Oops, forgot to add the pass itself!  
							
							... 
							
							
							
							llvm-svn: 122265 
							
						 
						
							2010-12-20 21:07:42 +00:00  
				
					
						
							
							
								 
						
							
								a436cbe4bf 
								
							 
						 
						
							
							
								
								Add a new convenience pass for testing InstructionSimplify.  Previously  
							
							... 
							
							
							
							it could only be tested indirectly, via instcombine, gvn or some other
pass that makes use of InstructionSimplify, which means that testcases
had to be carefully contrived to dance around any other transformations
that that pass did.
llvm-svn: 122264 
							
						 
						
							2010-12-20 20:54:37 +00:00  
				
					
						
							
							
								 
						
							
								0f11495289 
								
							 
						 
						
							
							
								
								when eliding a byval copy due to inlining a readonly function, we have  
							
							... 
							
							
							
							to make sure that the reused alloca has sufficient alignment.
llvm-svn: 122236 
							
						 
						
							2010-12-20 08:10:40 +00:00  
				
					
						
							
							
								 
						
							
								0099744506 
								
							 
						 
						
							
							
								
								pull byval processing out to its own helper function.  
							
							... 
							
							
							
							llvm-svn: 122235 
							
						 
						
							2010-12-20 07:57:41 +00:00  
				
					
						
							
							
								 
						
							
								7394680a00 
								
							 
						 
						
							
							
								
								fix PR8769, a miscompilation by inliner when inlining a function with a byval  
							
							... 
							
							
							
							argument.  The generated alloca has to have at least the alignment of the
byval, if not, the client may be making assumptions that the new alloca won't
satisfy.
llvm-svn: 122234 
							
						 
						
							2010-12-20 07:45:28 +00:00  
				
					
						
							
							
								 
						
							
								6b8b4855ff 
								
							 
						 
						
							
							
								
								simplify this a bit.  
							
							... 
							
							
							
							llvm-svn: 122156 
							
						 
						
							2010-12-18 20:22:49 +00:00  
				
					
						
							
							
								 
						
							
								e5f49c4ff2 
								
							 
						 
						
							
							
								
								SimplifyCFG: Ranges can be larger than 64 bits. Fixes Release-selfhost build.  
							
							... 
							
							
							
							llvm-svn: 122054 
							
						 
						
							2010-12-17 10:48:14 +00:00  
				
					
						
							
							
								 
						
							
								d14b0f1db7 
								
							 
						 
						
							
							
								
								improve switch formation to handle small range  
							
							... 
							
							
							
							comparisons formed by comparisons.  For example,
this:
void foo(unsigned x) {
  if (x == 0 || x == 1 || x == 3 || x == 4 || x == 6) 
    bar();
}
compiles into:
_foo:                                   ## @foo
## BB#0:                                ## %entry
	cmpl	$6, %edi
	ja	LBB0_2
## BB#1:                                ## %entry
	movl	%edi, %eax
	movl	$91, %ecx
	btq	%rax, %rcx
	jb	LBB0_3
instead of:
_foo:                                   ## @foo
## BB#0:                                ## %entry
	cmpl	$2, %edi
	jb	LBB0_4
## BB#1:                                ## %switch.early.test
	cmpl	$6, %edi
	ja	LBB0_3
## BB#2:                                ## %switch.early.test
	movl	%edi, %eax
	movl	$88, %ecx
	btq	%rax, %rcx
	jb	LBB0_4
This catches a bunch of cases in GCC, which look like this:
 %804 = load i32* @which_alternative, align 4, !tbaa !0 
 %805 = icmp ult i32 %804, 2
 %806 = icmp eq i32 %804, 3
 %or.cond121 = or i1 %805, %806
 %807 = icmp eq i32 %804, 4
 %or.cond124 = or i1 %or.cond121, %807
 br i1 %or.cond124, label %.thread, label %808
turning this into a range comparison.
llvm-svn: 122045 
							
						 
						
							2010-12-17 06:20:15 +00:00  
				
					
						
							
							
								 
						
							
								e893e2601e 
								
							 
						 
						
							
							
								
								make qsort predicate more conformant by returning 0 for equal values.  
							
							... 
							
							
							
							llvm-svn: 121838 
							
						 
						
							2010-12-15 04:52:41 +00:00  
				
					
						
							
							
								 
						
							
								7499b452c1 
								
							 
						 
						
							
							
								
								- Insert new instructions before DomBlock's terminator,  
							
							... 
							
							
							
							which is simpler than finding a place to insert in BB.
 - Don't perform the 'if condition hoisting' xform on certain
   i1 PHIs, as it interferes with switch formation.
This re-fixes "example 7", without breaking the world hopefully.
llvm-svn: 121764 
							
						 
						
							2010-12-14 08:46:09 +00:00  
				
					
						
							
							
								 
						
							
								335f0e4ad4 
								
							 
						 
						
							
							
								
								fix two significant issues with FoldTwoEntryPHINode:  
							
							... 
							
							
							
							first, it can kick in on blocks whose conditions have been
folded to a constant, even though one of the edges will be
trivially folded.
second, it doesn't clean up the "if diamond" that it just 
eliminated away.  This is a problem because other simplifycfg
xforms kick in depending on the order of block visitation,
causing pointless work.
llvm-svn: 121762 
							
						 
						
							2010-12-14 08:01:53 +00:00  
				
					
						
							
							
								 
						
							
								dc20a7d38c 
								
							 
						 
						
							
							
								
								remove the instsimplify logic I added in r121754.  It is apparently  
							
							... 
							
							
							
							breaking the selfhost builds, though I can't fathom how.
llvm-svn: 121761 
							
						 
						
							2010-12-14 07:53:03 +00:00  
				
					
						
							
							
								 
						
							
								9ac168d0ab 
								
							 
						 
						
							
							
								
								clean up logic, convert std::set to SmallPtrSet, handle the case  
							
							... 
							
							
							
							when all 2-entry phis are simplified away.
llvm-svn: 121760 
							
						 
						
							2010-12-14 07:41:39 +00:00  
				
					
						
							
							
								 
						
							
								9fd838d31b 
								
							 
						 
						
							
							
								
								tidy up a bit, move DEBUG down to when we commit to doing the transform so we  
							
							... 
							
							
							
							don't print it unless the xform happens.
llvm-svn: 121758 
							
						 
						
							2010-12-14 07:23:10 +00:00  
				
					
						
							
							
								 
						
							
								b42d293faa 
								
							 
						 
						
							
							
								
								use SimplifyInstruction instead of reimplementing part of it.  
							
							... 
							
							
							
							llvm-svn: 121757 
							
						 
						
							2010-12-14 07:20:29 +00:00  
				
					
						
							
							
								 
						
							
								fb73de482c 
								
							 
						 
						
							
							
								
								simplify GetIfCondition by using getSinglePredecessor.  
							
							... 
							
							
							
							llvm-svn: 121756 
							
						 
						
							2010-12-14 07:15:21 +00:00  
				
					
						
							
							
								 
						
							
								0f4d67bd88 
								
							 
						 
						
							
							
								
								use AddPredecessorToBlock in 3 places instead of a manual loop.  
							
							... 
							
							
							
							llvm-svn: 121755 
							
						 
						
							2010-12-14 07:09:42 +00:00  
				
					
						
							
							
								 
						
							
								a07cc6f4fd 
								
							 
						 
						
							
							
								
								make FoldTwoEntryPHINode use instsimplify a bit, make  
							
							... 
							
							
							
							GetIfCondition faster by avoiding pred_iterator.  No
really interesting change.
llvm-svn: 121754 
							
						 
						
							2010-12-14 07:00:00 +00:00  
				
					
						
							
							
								 
						
							
								afd2a8cfbb 
								
							 
						 
						
							
							
								
								remove the dead (and terrible) llvm::RemoveSuccessor function.  
							
							... 
							
							
							
							llvm-svn: 121753 
							
						 
						
							2010-12-14 06:51:55 +00:00  
				
					
						
							
							
								 
						
							
								d7beca3782 
								
							 
						 
						
							
							
								
								improve DEBUG's a bit, switch to eraseFromParent() to simplify  
							
							... 
							
							
							
							code a bit, switch from constant folding to instsimplify.
llvm-svn: 121751 
							
						 
						
							2010-12-14 06:17:25 +00:00  
				
					
						
							
							
								 
						
							
								5a9d59d918 
								
							 
						 
						
							
							
								
								reapply my recent change that disables a piece of the switch formation  
							
							... 
							
							
							
							work, but fixes 400.perlbmk.
llvm-svn: 121749 
							
						 
						
							2010-12-14 05:57:30 +00:00  
				
					
						
							
							
								 
						
							
								3e5648896e 
								
							 
						 
						
							
							
								
								Fix recent buildbot breakage by pulling SimplifyCFG back to its state as of r121694, the most recent state  
							
							... 
							
							
							
							where I'm confident there were no crashes or miscompilations.  XFAIL the test added since then for now.
llvm-svn: 121733 
							
						 
						
							2010-12-13 23:49:28 +00:00  
				
					
						
							
							
								 
						
							
								a6e5d5694a 
								
							 
						 
						
							
							
								
								temporarily disable part of my previous patch, which causes an iterator invalidation issue, causing a crash on some versions of perlbmk.  
							
							... 
							
							
							
							llvm-svn: 121728 
							
						 
						
							2010-12-13 23:02:19 +00:00  
				
					
						
							
							
								 
						
							
								2d434e594e 
								
							 
						 
						
							
							
								
								add some DEBUG's.  
							
							... 
							
							
							
							llvm-svn: 121711 
							
						 
						
							2010-12-13 19:55:30 +00:00  
				
					
						
							
							
								 
						
							
								1e155ab7e1 
								
							 
						 
						
							
							
								
								Fix sort predicate. qsort(3)'s predicate semantics differ from std::sort's. Fixes PR 8780.  
							
							... 
							
							
							
							llvm-svn: 121705 
							
						 
						
							2010-12-13 18:20:38 +00:00  
				
					
						
							
							
								 
						
							
								fb836f8c1a 
								
							 
						 
						
							
							
								
								reinstate my patch: the miscompile was caused by an inverted branch in the  
							
							... 
							
							
							
							'and' case.
llvm-svn: 121695 
							
						 
						
							2010-12-13 08:12:19 +00:00  
				
					
						
							
							
								 
						
							
								79db357d80 
								
							 
						 
						
							
							
								
								Completely disable the optimization I added in r121680 until  
							
							... 
							
							
							
							I can track down a miscompile.  This should bring the buildbots
back to life
llvm-svn: 121693 
							
						 
						
							2010-12-13 07:41:29 +00:00  
				
					
						
							
							
								 
						
							
								fbeb55844b 
								
							 
						 
						
							
							
								
								Make simplifycfg reprocess newly formed "br (cond1 | cond2)" conditions  
							
							... 
							
							
							
							when simplifying, allowing them to be eagerly turned into switches.  This
is the last step required to get "Example 7" from this blog post:
http://blog.regehr.org/archives/320 
On X86, we now generate this machine code, which (to my eye) seems better
than the ICC generated code:
_crud:                                  ## @crud
## BB#0:                                ## %entry
	cmpb	$33, %dil
	jb	LBB0_4
## BB#1:                                ## %switch.early.test
	addb	$-34, %dil
	cmpb	$58, %dil
	ja	LBB0_3
## BB#2:                                ## %switch.early.test
	movzbl	%dil, %eax
	movabsq	$288230376537592865, %rcx ## imm = 0x400000017001421
	btq	%rax, %rcx
	jb	LBB0_4
LBB0_3:                                 ## %lor.rhs
	xorl	%eax, %eax
	ret
LBB0_4:                                 ## %lor.end
	movl	$1, %eax
	ret
llvm-svn: 121690 
							
						 
						
							2010-12-13 07:00:06 +00:00  
				
					
						
							
							
								 
						
							
								1d05761df4 
								
							 
						 
						
							
							
								
								make this logic a bit simpler.  
							
							... 
							
							
							
							llvm-svn: 121689 
							
						 
						
							2010-12-13 06:36:51 +00:00  
				
					
						
							
							
								 
						
							
								25c3af35d8 
								
							 
						 
						
							
							
								
								split all the guts of SimplifyCFGOpt::run out into one function  
							
							... 
							
							
							
							per terminator kind.
llvm-svn: 121688 
							
						 
						
							2010-12-13 06:25:44 +00:00  
				
					
						
							
							
								 
						
							
								cb570f87e5 
								
							 
						 
						
							
							
								
								fix a bug in r121680 that upset the various buildbots.  
							
							... 
							
							
							
							llvm-svn: 121687 
							
						 
						
							2010-12-13 05:34:18 +00:00  
				
					
						
							
							
								 
						
							
								a6db741f3d 
								
							 
						 
						
							
							
								
								refactor the speculative execution logic to be factored into the cond branch code instead of  
							
							... 
							
							
							
							doing a cfg search for every block simplified.
llvm-svn: 121686 
							
						 
						
							2010-12-13 05:26:52 +00:00  
				
					
						
							
							
								 
						
							
								466f54ffcf 
								
							 
						 
						
							
							
								
								simplify a bunch of code.  
							
							... 
							
							
							
							llvm-svn: 121685 
							
						 
						
							2010-12-13 05:20:28 +00:00  
				
					
						
							
							
								 
						
							
								6df7bdd810 
								
							 
						 
						
							
							
								
								move HoistThenElseCodeToIf up to a more logical and efficient-to-handle place.  
							
							... 
							
							
							
							llvm-svn: 121684 
							
						 
						
							2010-12-13 05:15:29 +00:00  
				
					
						
							
							
								 
						
							
								2e3832d9a0 
								
							 
						 
						
							
							
								
								move 'MergeBlocksIntoPredecessor' call earlier.  Use  
							
							... 
							
							
							
							getSinglePredecessor to simplify code.
llvm-svn: 121683 
							
						 
						
							2010-12-13 05:10:48 +00:00  
				
					
						
							
							
								 
						
							
								a69c443459 
								
							 
						 
						
							
							
								
								factor new code out to a SimplifyBranchOnICmpChain helper function.  
							
							... 
							
							
							
							llvm-svn: 121681 
							
						 
						
							2010-12-13 05:03:41 +00:00  
				
					
						
							
							
								 
						
							
								a442f24a36 
								
							 
						 
						
							
							
								
								enhance the "change or icmp's into switch" xform to handle one value in an  
							
							... 
							
							
							
							'or sequence' that it doesn't understand.  This allows us to optimize
something insane like this:
int crud (unsigned char c, unsigned x)
 {
   if(((((((((( (int) c <= 32 ||
                    (int) c == 46) || (int) c == 44)
                  || (int) c == 58) || (int) c == 59) || (int) c == 60)
               || (int) c == 62) || (int) c == 34) || (int) c == 92)
            || (int) c == 39) != 0)
     foo();
 }
into:
define i32 @crud(i8 zeroext %c, i32 %x) nounwind ssp noredzone {
entry:
  %cmp = icmp ult i8 %c, 33
  br i1 %cmp, label %if.then, label %switch.early.test
switch.early.test:                                ; preds = %entry
  switch i8 %c, label %if.end [
    i8 39, label %if.then
    i8 44, label %if.then
    i8 58, label %if.then
    i8 59, label %if.then
    i8 60, label %if.then
    i8 62, label %if.then
    i8 46, label %if.then
    i8 92, label %if.then
    i8 34, label %if.then
  ]
by pulling the < comparison out ahead of the newly formed switch.
llvm-svn: 121680 
							
						 
						
							2010-12-13 04:50:38 +00:00  
				
					
						
							
							
								 
						
							
								5a177e681e 
								
							 
						 
						
							
							
								
								merge two very similar functions into one that has a bool argument.  
							
							... 
							
							
							
							llvm-svn: 121678 
							
						 
						
							2010-12-13 04:26:26 +00:00  
				
					
						
							
							
								 
						
							
								9b1af510cb 
								
							 
						 
						
							
							
								
								don't bother handling non-canonical icmp's  
							
							... 
							
							
							
							llvm-svn: 121676 
							
						 
						
							2010-12-13 04:18:32 +00:00  
				
					
						
							
							
								 
						
							
								395252d93e 
								
							 
						 
						
							
							
								
								inline a function, making the result much simpler.  
							
							... 
							
							
							
							llvm-svn: 121675 
							
						 
						
							2010-12-13 04:15:19 +00:00  
				
					
						
							
							
								 
						
							
								62cc76e9cc 
								
							 
						 
						
							
							
								
								Fix my previous patch to handle a degenerate case that the llvm-gcc  
							
							... 
							
							
							
							bootstrap buildbot tripped over.
llvm-svn: 121674 
							
						 
						
							2010-12-13 03:43:57 +00:00  
				
					
						
							
							
								 
						
							
								11dafaa3ec 
								
							 
						 
						
							
							
								
								convert some methods to be static functions  
							
							... 
							
							
							
							llvm-svn: 121673 
							
						 
						
							2010-12-13 03:30:12 +00:00  
				
					
						
							
							
								 
						
							
								4642d79fb0 
								
							 
						 
						
							
							
								
								zap two more std::sorts.  
							
							... 
							
							
							
							llvm-svn: 121672 
							
						 
						
							2010-12-13 03:24:30 +00:00  
				
					
						
							
							
								 
						
							
								d9bacc088a 
								
							 
						 
						
							
							
								
								fix a fairly serious oversight with switch formation from  
							
							... 
							
							
							
							or'd conditions.  Previously we'd compile something like this:
int crud (unsigned char c) {
   return c == 62 || c == 34 || c == 92;
}
into:
  switch i8 %c, label %lor.rhs [
    i8 62, label %lor.end
    i8 34, label %lor.end
  ]
lor.rhs:                                          ; preds = %entry
  %cmp8 = icmp eq i8 %c, 92
  br label %lor.end
lor.end:                                          ; preds = %entry, %entry, %lor.rhs
  %0 = phi i1 [ true, %entry ], [ %cmp8, %lor.rhs ], [ true, %entry ]
  %lor.ext = zext i1 %0 to i32
  ret i32 %lor.ext
which failed to merge the compare-with-92 into the switch.  With this patch
we simplify this all the way to:
  switch i8 %c, label %lor.rhs [
    i8 62, label %lor.end
    i8 34, label %lor.end
    i8 92, label %lor.end
  ]
lor.rhs:                                          ; preds = %entry
  br label %lor.end
lor.end:                                          ; preds = %entry, %entry, %entry, %lor.rhs
  %0 = phi i1 [ true, %entry ], [ false, %lor.rhs ], [ true, %entry ], [ true, %entry ]
  %lor.ext = zext i1 %0 to i32
  ret i32 %lor.ext
which is much better for codegen's switch lowering stuff.  This kicks in 33 times
on 176.gcc (for example) cutting 103 instructions off the generated code.
llvm-svn: 121671 
							
						 
						
							2010-12-13 03:18:54 +00:00  
				
					
						
							
							
								 
						
							
								7c8e6047d6 
								
							 
						 
						
							
							
								
								convert an std::sort to array_pod_sort.  
							
							... 
							
							
							
							llvm-svn: 121669 
							
						 
						
							2010-12-13 02:00:58 +00:00  
				
					
						
							
							
								 
						
							
								1475987634 
								
							 
						 
						
							
							
								
								move the "br (X == 0 | X == 1), T, F" -> switch optimization to a new  
							
							... 
							
							
							
							location in simplifycfg.  In the old days, SimplifyCFG was never run on
the entry block, so we had to scan over all preds of the BB passed into
simplifycfg to do this xform, now we can just check blocks ending with
a condbranch.  This avoids a scan over all preds of every simplified 
block, which should be a significant compile-time perf win on functions
with lots of edges.  No functionality change.
llvm-svn: 121668 
							
						 
						
							2010-12-13 01:57:34 +00:00  
				
					
						
							
							
								 
						
							
								4088e2b8e4 
								
							 
						 
						
							
							
								
								reduce indentation and generally simplify code, no functionality change.  
							
							... 
							
							
							
							llvm-svn: 121667 
							
						 
						
							2010-12-13 01:47:07 +00:00  
				
					
						
							
							
								 
						
							
								7cb7867d7a 
								
							 
						 
						
							
							
								
								use getFirstNonPHIOrDbg to simplify this code.  
							
							... 
							
							
							
							llvm-svn: 121664 
							
						 
						
							2010-12-13 01:28:06 +00:00  
				
					
						
							
							
								 
						
							
								cd3af96a8f 
								
							 
						 
						
							
							
								
								improve comment  
							
							... 
							
							
							
							llvm-svn: 120994 
							
						 
						
							2010-12-06 07:43:04 +00:00  
				
					
						
							
							
								 
						
							
								8fb69ee805 
								
							 
						 
						
							
							
								
								Teach SimplifyCFG to turn  
							
							... 
							
							
							
							(indirectbr (select cond, blockaddress(@fn, BlockA),
                            blockaddress(@fn, BlockB)))
into
  (br cond, BlockA, BlockB).
llvm-svn: 120943 
							
						 
						
							2010-12-05 18:29:03 +00:00  
				
					
						
							
							
								 
						
							
								b438ef236c 
								
							 
						 
						
							
							
								
								remove the pointless check of MemoryUseIntrinsic from  
							
							... 
							
							
							
							is trivially dead, since these have side effects.  This makes the
(misnamed) MemoryUseIntrinsic class dead, so remove it.
llvm-svn: 120382 
							
						 
						
							2010-11-30 02:03:47 +00:00  
				
					
						
							
							
								 
						
							
								433c1679cf 
								
							 
						 
						
							
							
								
								Replace calls to ConstantFoldInstruction with calls to SimplifyInstruction  
							
							... 
							
							
							
							in two places that are really interested in simplified instructions, not
constants.
llvm-svn: 120044 
							
						 
						
							2010-11-23 20:26:33 +00:00  
				
					
						
							
							
								 
						
							
								c6648eb4c3 
								
							 
						 
						
							
							
								
								Don't keep track of inserted phis in PromoteMemoryToRegister: the information  
							
							... 
							
							
							
							is never used.  Patch by Cameron Zwarich.
llvm-svn: 119963 
							
						 
						
							2010-11-22 09:41:24 +00:00  
				
					
						
							
							
								 
						
							
								ddd1b7b801 
								
							 
						 
						
							
							
								
								Simplify code. No change in functionality.  
							
							... 
							
							
							
							llvm-svn: 119908 
							
						 
						
							2010-11-20 18:43:35 +00:00  
				
					
						
							
							
								 
						
							
								aef146b890 
								
							 
						 
						
							
							
								
								Factor code for testing whether replacing one value with another  
							
							... 
							
							
							
							preserves LCSSA form out of ScalarEvolution and into the LoopInfo
class.  Use it to check that SimplifyInstruction simplifications
are not breaking LCSSA form.  Fixes PR8622.
llvm-svn: 119727 
							
						 
						
							2010-11-18 19:59:41 +00:00  
				
					
						
							
							
								 
						
							
								9d9a4e2ca2 
								
							 
						 
						
							
							
								
								Have InlineFunction use SimplifyInstruction rather than  
							
							... 
							
							
							
							hasConstantValue.  I was leery of using SimplifyInstruction
while the IR was still in a half-baked state, which is the
reason for delaying the simplification until the IR is fully
cooked.
llvm-svn: 119494 
							
						 
						
							2010-11-17 11:16:23 +00:00  
				
					
						
							
							
								 
						
							
								ba0b22c785 
								
							 
						 
						
							
							
								
								Have RemovePredecessorAndSimplify you SimplifyInstruction  
							
							... 
							
							
							
							rather than hasConstantValue.
llvm-svn: 119457 
							
						 
						
							2010-11-17 04:12:05 +00:00  
				
					
						
							
							
								 
						
							
								637049515f 
								
							 
						 
						
							
							
								
								Have a few places that want to simplify phi nodes use SimplifyInstruction  
							
							... 
							
							
							
							rather than calling hasConstantValue.  No intended functionality change.
llvm-svn: 119352 
							
						 
						
							2010-11-16 17:41:24 +00:00  
				
					
						
							
							
								 
						
							
								e8360b7182 
								
							 
						 
						
							
							
								
								Inline asm multiple alternative constraints development phase 2 - improved basic logic, added initial platform support.  
							
							... 
							
							
							
							llvm-svn: 117667 
							
						 
						
							2010-10-29 17:29:13 +00:00  
				
					
						
							
							
								 
						
							
								31c803b2ba 
								
							 
						 
						
							
							
								
								Fix PR8445: a block with no predecessors may be the entry block, in which case  
							
							... 
							
							
							
							it isn't unreachable and should not be zapped.  The check for the entry block
was missing in one case: a block containing a unwind instruction.  While there,
do some small cleanups: "M" is not a great name for a Function* (it would be
more appropriate for a Module*), change it to "Fn"; use Fn in more places.
llvm-svn: 117224 
							
						 
						
							2010-10-24 12:23:30 +00:00  
				
					
						
							
							
								 
						
							
								88c54b82c1 
								
							 
						 
						
							
							
								
								Switch attribute macros to use 'LLVM_' as a prefix. We retain the old names  
							
							... 
							
							
							
							until other LLVM projects using these are cleaned up.
llvm-svn: 117200 
							
						 
						
							2010-10-23 08:10:43 +00:00  
				
					
						
							
							
								 
						
							
								a4fefc1949 
								
							 
						 
						
							
							
								
								Passes do not need to recursively initialize passes that they preserve, if  
							
							... 
							
							
							
							they do not also require them.  This allows us to reduce inter-pass linkage
dependencies.
llvm-svn: 116854 
							
						 
						
							2010-10-19 20:08:44 +00:00  
				
					
						
							
							
								 
						
							
								6c18d1aac0 
								
							 
						 
						
							
							
								
								Get rid of static constructors for pass registration.  Instead, every pass exposes an initializeMyPassFunction(), which  
							
							... 
							
							
							
							must be called in the pass's constructor.  This function uses static dependency declarations to recursively initialize
the pass's dependencies.
Clients that only create passes through the createFooPass() APIs will require no changes.  Clients that want to use the
CommandLine options for passes will need to manually call the appropriate initialization functions in PassInitialization.h
before parsing commandline arguments.
I have tested this with all standard configurations of clang and llvm-gcc on Darwin.  It is possible that there are problems
with the static dependencies that will only be visible with non-standard options.  If you encounter any crash in pass
registration/creation, please send the testcase to me directly.
llvm-svn: 116820 
							
						 
						
							2010-10-19 17:21:58 +00:00  
				
					
						
							
							
								 
						
							
								218f3206fa 
								
							 
						 
						
							
							
								
								Transfer debug loc to lowered call.  
							
							... 
							
							
							
							Patch by Alexander Herz!
llvm-svn: 116733 
							
						 
						
							2010-10-18 18:53:44 +00:00  
				
					
						
							
							
								 
						
							
								c2240adcc7 
								
							 
						 
						
							
							
								
								Fix PR8313 by changing ValueToValueMap use a TrackingVH.  
							
							... 
							
							
							
							llvm-svn: 116390 
							
						 
						
							2010-10-13 02:08:17 +00:00  
				
					
						
							
							
								 
						
							
								229e38f0fe 
								
							 
						 
						
							
							
								
								Be more consistent in using ValueToValueMapTy.  
							
							... 
							
							
							
							llvm-svn: 116387 
							
						 
						
							2010-10-13 01:36:30 +00:00  
				
					
						
							
							
								 
						
							
								8ac477ffb5 
								
							 
						 
						
							
							
								
								Begin adding static dependence information to passes, which will allow us to  
							
							... 
							
							
							
							perform initialization without static constructors AND without explicit initialization
by the client.  For the moment, passes are required to initialize both their
(potential) dependencies and any passes they preserve.  I hope to be able to relax
the latter requirement in the future.
llvm-svn: 116334 
							
						 
						
							2010-10-12 19:48:12 +00:00  
				
					
						
							
							
								 
						
							
								df7a4f2515 
								
							 
						 
						
							
							
								
								Now with fewer extraneous semicolons!  
							
							... 
							
							
							
							llvm-svn: 115996 
							
						 
						
							2010-10-07 22:25:06 +00:00  
				
					
						
							
							
								 
						
							
								4698c5d7f7 
								
							 
						 
						
							
							
								
								Next step on the getting-rid-of-static-ctors train: begin adding per-library  
							
							... 
							
							
							
							initialization functions that initialize the set of passes implemented in
that library.  Add C bindings for these functions as well.
llvm-svn: 115927 
							
						 
						
							2010-10-07 17:55:47 +00:00  
				
					
						
							
							
								 
						
							
								5e19bfcde3 
								
							 
						 
						
							
							
								
								Move the pass initialization helper functions into the llvm namespace, and add  
							
							... 
							
							
							
							a header declaring them all.  This is also where we will declare per-library pass-set
initializer functions down the road.
llvm-svn: 115900 
							
						 
						
							2010-10-07 04:13:08 +00:00  
				
					
						
							
							
								 
						
							
								b4b12535e8 
								
							 
						 
						
							
							
								
								Removed a bunch of unnecessary target_link_libraries.  
							
							... 
							
							
							
							llvm-svn: 114999 
							
						 
						
							2010-09-28 22:39:14 +00:00  
				
					
						
							
							
								 
						
							
								ded5f66813 
								
							 
						 
						
							
							
								
								Get rid of pop_macro warnings on MSVC.  
							
							... 
							
							
							
							llvm-svn: 114750 
							
						 
						
							2010-09-24 19:48:47 +00:00  
				
					
						
							
							
								 
						
							
								93c9b2ea93 
								
							 
						 
						
							
							
								
								Revert "CMake: Get rid of LLVMLibDeps.cmake and export the libraries normally."  
							
							... 
							
							
							
							This reverts commit r113632
Conflicts:
	cmake/modules/AddLLVM.cmake
llvm-svn: 113819 
							
						 
						
							2010-09-13 23:59:48 +00:00  
				
					
						
							
							
								 
						
							
								1094c80281 
								
							 
						 
						
							
							
								
								Added skeleton for inline asm multiple alternative constraint support.  
							
							... 
							
							
							
							llvm-svn: 113766 
							
						 
						
							2010-09-13 18:15:37 +00:00  
				
					
						
							
							
								 
						
							
								2f5f696b66 
								
							 
						 
						
							
							
								
								typoes  
							
							... 
							
							
							
							llvm-svn: 113647 
							
						 
						
							2010-09-10 22:25:58 +00:00  
				
					
						
							
							
								 
						
							
								dc38d36ccb 
								
							 
						 
						
							
							
								
								CMake: Get rid of LLVMLibDeps.cmake and export the libraries normally.  
							
							... 
							
							
							
							llvm-svn: 113632 
							
						 
						
							2010-09-10 21:14:25 +00:00  
				
					
						
							
							
								 
						
							
								487e250109 
								
							 
						 
						
							
							
								
								Fix LoopSimplify to notify ScalarEvolution when splitting a loop backedge  
							
							... 
							
							
							
							into an inner loop, as the new loop iteration may differ substantially.
This fixes PR8078.
llvm-svn: 113057 
							
						 
						
							2010-09-04 02:42:48 +00:00  
				
					
						
							
							
								 
						
							
								6778149f7e 
								
							 
						 
						
							
							
								
								Reapply commit 112699, speculatively reverted by echristo, since  
							
							... 
							
							
							
							I'm sure it is harmless.  Original commit message:
If PrototypeValue is erased in the middle of using the SSAUpdator
then the SSAUpdator may access freed memory.  Instead, simply pass
in the type and name explicitly, which is all that was used anyway.
llvm-svn: 112810 
							
						 
						
							2010-09-02 08:14:03 +00:00  
				
					
						
							
							
								 
						
							
								a5d315c665 
								
							 
						 
						
							
							
								
								Speculatively revert 112699 and 112702, they seem to be causing  
							
							... 
							
							
							
							self host errors on clang-x86-64.
llvm-svn: 112719 
							
						 
						
							2010-09-01 17:29:10 +00:00  
				
					
						
							
							
								 
						
							
								f7b18437b5 
								
							 
						 
						
							
							
								
								If PrototypeValue is erased in the middle of using the SSAUpdator  
							
							... 
							
							
							
							then the SSAUpdator may access freed memory.  Instead, simply pass
in the type and name explicitly, which is all that was used anyway.
llvm-svn: 112699 
							
						 
						
							2010-09-01 10:29:33 +00:00  
				
					
						
							
							
								 
						
							
								c3fb03e289 
								
							 
						 
						
							
							
								
								implement SSAUpdater::RewriteUseAfterInsertions, a helpful form of RewriteUse.  
							
							... 
							
							
							
							llvm-svn: 112409 
							
						 
						
							2010-08-29 04:54:06 +00:00  
				
					
						
							
							
								 
						
							
								504e5100d3 
								
							 
						 
						
							
							
								
								remove the ABCD and SSI passes.  They don't have any clients that  
							
							... 
							
							
							
							I'm aware of, aren't maintained, and LVI will be replacing their value.
nlewycky approved this on irc.
llvm-svn: 112355 
							
						 
						
							2010-08-28 03:51:24 +00:00  
				
					
						
							
							
								 
						
							
								ca26f79051 
								
							 
						 
						
							
							
								
								Reapply r112091 and r111922, support for metadata linking, with a  
							
							... 
							
							
							
							fix: add a flag to MapValue and friends which indicates whether
any module-level mappings are being made. In the common case of
inlining, no module-level mappings are needed, so MapValue doesn't
need to examine non-function-local metadata, which can be very
expensive in the case of a large module with really deep metadata
(e.g. a large C++ program compiled with -g).
This flag is a little awkward; perhaps eventually it can be moved
into the ClonedCodeInfo class.
llvm-svn: 112190 
							
						 
						
							2010-08-26 15:41:53 +00:00  
				
					
						
							
							
								 
						
							
								ce45863f0d 
								
							 
						 
						
							
							
								
								Revert r111922, "MapValue support for MDNodes. This is similar to r109117,  
							
							... 
							
							
							
							except ...", it is causing *massive* performance regressions when building Clang
with itself (-O3 -g).
llvm-svn: 112158 
							
						 
						
							2010-08-26 03:48:11 +00:00  
				
					
						
							
							
								 
						
							
								95fe13c720 
								
							 
						 
						
							
							
								
								Revert r112091, "Remap metadata attached to instructions when remapping  
							
							... 
							
							
							
							individual ...", which depends on r111922, which I am reverting.
llvm-svn: 112157 
							
						 
						
							2010-08-26 03:48:08 +00:00  
				
					
						
							
							
								 
						
							
								fd824487a3 
								
							 
						 
						
							
							
								
								Remap metadata attached to instructions when remapping individual  
							
							... 
							
							
							
							instructions, not when remapping modules.
llvm-svn: 112091 
							
						 
						
							2010-08-25 21:36:50 +00:00  
				
					
						
							
							
								 
						
							
								a209503467 
								
							 
						 
						
							
							
								
								Use MapValue in the Linker instead of having a private function  
							
							... 
							
							
							
							which does the same thing. This eliminates redundant code and
handles MDNodes better. MDNode linking still doesn't fully
work yet though.
llvm-svn: 111941 
							
						 
						
							2010-08-24 18:50:07 +00:00  
				
					
						
							
							
								 
						
							
								6901283544 
								
							 
						 
						
							
							
								
								MapValue support for MDNodes. This is similar to r109117, except  
							
							... 
							
							
							
							that it avoids a lot of unnecessary cloning by avoiding remapping
MDNode cycles when none of the nodes in the cycle actually need to
be remapped. Also it uses the new temporary MDNode mechanism.
llvm-svn: 111922 
							
						 
						
							2010-08-24 17:10:10 +00:00  
				
					
						
							
							
								 
						
							
								d31d82d75c 
								
							 
						 
						
							
							
								
								Now that PassInfo and Pass::ID have been separated, move the rest of the passes over to the new registration API.  
							
							... 
							
							
							
							llvm-svn: 111815 
							
						 
						
							2010-08-23 17:52:01 +00:00  
				
					
						
							
							
								 
						
							
								f0b5b67ba5 
								
							 
						 
						
							
							
								
								fit in 80 cols  
							
							... 
							
							
							
							llvm-svn: 111348 
							
						 
						
							2010-08-18 03:13:35 +00:00  
				
					
						
							
							
								 
						
							
								b45de95345 
								
							 
						 
						
							
							
								
								remove some dead code.  
							
							... 
							
							
							
							llvm-svn: 111344 
							
						 
						
							2010-08-18 02:41:56 +00:00  
				
					
						
							
							
								 
						
							
								941020ed72 
								
							 
						 
						
							
							
								
								Use the getUniquePredecessor() utility function, instead of doing  
							
							... 
							
							
							
							what it does manually.
llvm-svn: 111248 
							
						 
						
							2010-08-17 17:07:02 +00:00  
				
					
						
							
							
								 
						
							
								6e964c7fb4 
								
							 
						 
						
							
							
								
								Avoid #include <ScalarEvolution.h> in LoopSimplify.cpp, which doesn't  
							
							... 
							
							
							
							actually use ScalarEvolution.
llvm-svn: 111124 
							
						 
						
							2010-08-16 14:44:03 +00:00  
				
					
						
							
							
								 
						
							
								250b754428 
								
							 
						 
						
							
							
								
								Instead, teach SimplifyCFG to trim non-address-taken blocks from  
							
							... 
							
							
							
							indirectbr destination lists.
llvm-svn: 111122 
							
						 
						
							2010-08-16 14:41:14 +00:00  
				
					
						
							
							
								 
						
							
								aa445c0751 
								
							 
						 
						
							
							
								
								LoopSimplify shouldn't split loop backedges that use indirectbr. PR7867.  
							
							... 
							
							
							
							llvm-svn: 111061 
							
						 
						
							2010-08-14 00:43:09 +00:00  
				
					
						
							
							
								 
						
							
								4a63fad976 
								
							 
						 
						
							
							
								
								Teach SimplifyCFG how to simplify indirectbr instructions.  
							
							... 
							
							
							
							- Eliminate redundant successors.
 - Convert an indirectbr with one successor into a direct branch.
Also, generalize SimplifyCFG to be able to be run on a function entry block.
It knows quite a few simplifications which are applicable to the entry
block, and it only needs a few checks to avoid trouble with the entry block.
llvm-svn: 111060 
							
						 
						
							2010-08-14 00:29:42 +00:00  
				
					
						
							
							
								 
						
							
								0f7892b8ae 
								
							 
						 
						
							
							
								
								Eliminate PromoteMemoryToRegisterID; just use addPreserved("mem2reg")  
							
							... 
							
							
							
							instead, as an example of what this looks like.
llvm-svn: 110478 
							
						 
						
							2010-08-06 21:48:06 +00:00  
				
					
						
							
							
								 
						
							
								a7aed18624 
								
							 
						 
						
							
							
								
								Reapply r110396, with fixes to appease the Linux buildbot gods.  
							
							... 
							
							
							
							llvm-svn: 110460 
							
						 
						
							2010-08-06 18:33:48 +00:00  
				
					
						
							
							
								 
						
							
								bda59bd247 
								
							 
						 
						
							
							
								
								Revert r110396 to fix buildbots.  
							
							... 
							
							
							
							llvm-svn: 110410 
							
						 
						
							2010-08-06 00:23:35 +00:00  
				
					
						
							
							
								 
						
							
								755aceb5d0 
								
							 
						 
						
							
							
								
								Don't use PassInfo* as a type identifier for passes.  Instead, use the address of the static  
							
							... 
							
							
							
							ID member as the sole unique type identifier.  Clean up APIs related to this change.
llvm-svn: 110396 
							
						 
						
							2010-08-05 23:42:04 +00:00  
				
					
						
							
							
								 
						
							
								f0084e1333 
								
							 
						 
						
							
							
								
								simplify  
							
							... 
							
							
							
							llvm-svn: 109589 
							
						 
						
							2010-07-28 15:52:43 +00:00  
				
					
						
							
							
								 
						
							
								7b0a5fd2a5 
								
							 
						 
						
							
							
								
								simplify: CallSite::get --> CallSite constructor  
							
							... 
							
							
							
							llvm-svn: 109506 
							
						 
						
							2010-07-27 15:02:37 +00:00  
				
					
						
							
							
								 
						
							
								0141c13b22 
								
							 
						 
						
							
							
								
								Remove LCSSA's bogus dependence on LoopSimplify and LoopSimplify's bogus  
							
							... 
							
							
							
							dependence on DominanceFrontier. Instead, add an explicit DominanceFrontier
pass in StandardPasses.h to ensure that it gets scheduled at the right
time.
Declare that loop unrolling preserves ScalarEvolution, and shuffle some
getAnalysisUsages.
This eliminates one LoopSimplify and one LCCSA run in the standard
compile opts sequence.
llvm-svn: 109413 
							
						 
						
							2010-07-26 18:11:16 +00:00  
				
					
						
							
							
								 
						
							
								a7908ae369 
								
							 
						 
						
							
							
								
								Preserve ScalarEvolution in the loop unroller.  
							
							... 
							
							
							
							llvm-svn: 109412 
							
						 
						
							2010-07-26 18:02:06 +00:00  
				
					
						
							
							
								 
						
							
								7bc0443f2b 
								
							 
						 
						
							
							
								
								Revert this because we can't clone cyclic MDNodes which are creating during a  
							
							... 
							
							
							
							build of llvm-gcc.
llvm-svn: 109355 
							
						 
						
							2010-07-24 20:54:02 +00:00  
				
					
						
							
							
								 
						
							
								14b69d59dd 
								
							 
						 
						
							
							
								
								Whether function-local or not, a MDNode may reference a Function in which case  
							
							... 
							
							
							
							it needs to be mapped to refer to the function in the new module, not the old
one. Fixes PR7700.
llvm-svn: 109353 
							
						 
						
							2010-07-24 19:43:25 +00:00  
				
					
						
							
							
								 
						
							
								5fa3813329 
								
							 
						 
						
							
							
								
								Speculatively revert 109117  
							
							... 
							
							
							
							llvm-svn: 109132 
							
						 
						
							2010-07-22 18:44:00 +00:00  
				
					
						
							
							
								 
						
							
								59f9970ba5 
								
							 
						 
						
							
							
								
								keep in 80 cols  
							
							... 
							
							
							
							llvm-svn: 109122 
							
						 
						
							2010-07-22 17:18:03 +00:00  
				
					
						
							
							
								 
						
							
								fac440cfb6 
								
							 
						 
						
							
							
								
								Map MDNode correctly.  
							
							... 
							
							
							
							A non function local MDNode can have an operand which is cloned by MapValue(). 
llvm-svn: 109117 
							
						 
						
							2010-07-22 16:35:00 +00:00  
				
					
						
							
							
								 
						
							
								dde79d8f1a 
								
							 
						 
						
							
							
								
								mass elimination of reliance on automatic iterator dereferencing  
							
							... 
							
							
							
							llvm-svn: 109103 
							
						 
						
							2010-07-22 13:36:47 +00:00  
				
					
						
							
							
								 
						
							
								36f25dfd33 
								
							 
						 
						
							
							
								
								pass dereferenced iterator to dyn_cast  
							
							... 
							
							
							
							llvm-svn: 109098 
							
						 
						
							2010-07-22 11:43:44 +00:00  
				
					
						
							
							
								 
						
							
								3e44ea1917 
								
							 
						 
						
							
							
								
								undo 80 column trespassing I caused  
							
							... 
							
							
							
							llvm-svn: 109092 
							
						 
						
							2010-07-22 10:37:47 +00:00  
				
					
						
							
							
								 
						
							
								2637cc1a38 
								
							 
						 
						
							
							
								
								Make NamedMDNode not be a subclass of Value, and simplify the interface  
							
							... 
							
							
							
							for creating and populating NamedMDNodes.
llvm-svn: 109061 
							
						 
						
							2010-07-21 23:38:33 +00:00  
				
					
						
							
							
								 
						
							
								a57b97e7e7 
								
							 
						 
						
							
							
								
								Fix batch of converting RegisterPass<> to INTIALIZE_PASS().  
							
							... 
							
							
							
							llvm-svn: 109045 
							
						 
						
							2010-07-21 22:09:45 +00:00  
				
					
						
							
							
								 
						
							
								7373bd9973 
								
							 
						 
						
							
							
								
								Use DebugLocs instead of MDNodes.  
							
							... 
							
							
							
							llvm-svn: 108967 
							
						 
						
							2010-07-20 23:49:05 +00:00  
				
					
						
							
							
								 
						
							
								5c2e65b7bf 
								
							 
						 
						
							
							
								
								Don't look up the "dbg" metadata kind by name.  
							
							... 
							
							
							
							llvm-svn: 108961 
							
						 
						
							2010-07-20 23:09:34 +00:00  
				
					
						
							
							
								 
						
							
								efd7f9c360 
								
							 
						 
						
							
							
								
								Reorder the contents of various getAnalysisUsage functions, eliminating  
							
							... 
							
							
							
							a redundant loopsimplify run from the default -O2 sequence.
llvm-svn: 108539 
							
						 
						
							2010-07-16 17:58:45 +00:00  
				
					
						
							
							
								 
						
							
								6d673953e3 
								
							 
						 
						
							
							
								
								eliminate CallInst::ArgOffset  
							
							... 
							
							
							
							llvm-svn: 108522 
							
						 
						
							2010-07-16 09:38:02 +00:00  
				
					
						
							
							
								 
						
							
								13700ebb02 
								
							 
						 
						
							
							
								
								Remove unneeded check, and correct style.  
							
							... 
							
							
							
							llvm-svn: 108427 
							
						 
						
							2010-07-15 16:38:22 +00:00  
				
					
						
							
							
								 
						
							
								e41ab07c61 
								
							 
						 
						
							
							
								
								make various clients of ReplaceAndSimplifyAllUses tolerate  
							
							... 
							
							
							
							it *changing* the things it replaces, not just causing them
to drop to null.  There is no functionality change yet, but 
this is required for a subsequent patch.
llvm-svn: 108414 
							
						 
						
							2010-07-15 06:06:04 +00:00  
				
					
						
							
							
								 
						
							
								2cfe91379b 
								
							 
						 
						
							
							
								
								Extend SimplifyCFG's common-destination folding heuristic to allow a single  
							
							... 
							
							
							
							"bonus" instruction to be speculatively executed.  Add a heuristic to
ensure we're not tripping up out-of-order execution by checking that this bonus
instruction only uses values that were already guaranteed to be available.
This allows us to eliminate the short circuit in (x&1)&&(x&2).
llvm-svn: 108351 
							
						 
						
							2010-07-14 19:52:16 +00:00  
				
					
						
							
							
								 
						
							
								8629f12bb8 
								
							 
						 
						
							
							
								
								cache dereferenced iterators  
							
							... 
							
							
							
							llvm-svn: 108133 
							
						 
						
							2010-07-12 10:59:23 +00:00  
				
					
						
							
							
								 
						
							
								d993402df3 
								
							 
						 
						
							
							
								
								cache dereferenced iterators  
							
							... 
							
							
							
							llvm-svn: 108132 
							
						 
						
							2010-07-12 10:49:54 +00:00  
				
					
						
							
							
								 
						
							
								fd8e7d4a0f 
								
							 
						 
						
							
							
								
								cache result of operator*  
							
							... 
							
							
							
							llvm-svn: 107984 
							
						 
						
							2010-07-09 16:31:08 +00:00  
				
					
						
							
							
								 
						
							
								e7650c7c29 
								
							 
						 
						
							
							
								
								cache result of operator*  
							
							... 
							
							
							
							llvm-svn: 107983 
							
						 
						
							2010-07-09 16:26:41 +00:00  
				
					
						
							
							
								 
						
							
								04af1e4f65 
								
							 
						 
						
							
							
								
								cache result of operator*  
							
							... 
							
							
							
							llvm-svn: 107981 
							
						 
						
							2010-07-09 16:17:52 +00:00  
				
					
						
							
							
								 
						
							
								6d8870fc35 
								
							 
						 
						
							
							
								
								cache result of operator*  
							
							... 
							
							
							
							llvm-svn: 107975 
							
						 
						
							2010-07-09 15:25:42 +00:00  
				
					
						
							
							
								 
						
							
								329c4d8ed9 
								
							 
						 
						
							
							
								
								cache result of operator*  
							
							... 
							
							
							
							llvm-svn: 107974 
							
						 
						
							2010-07-09 15:25:09 +00:00  
				
					
						
							
							
								 
						
							
								4247949ce9 
								
							 
						 
						
							
							
								
								cache result of operator*  
							
							... 
							
							
							
							llvm-svn: 107968 
							
						 
						
							2010-07-09 14:29:14 +00:00  
				
					
						
							
							
								 
						
							
								a02f232c1b 
								
							 
						 
						
							
							
								
								cache result of operator*  
							
							... 
							
							
							
							llvm-svn: 107966 
							
						 
						
							2010-07-09 14:18:23 +00:00  
				
					
						
							
							
								 
						
							
								f0821f39ee 
								
							 
						 
						
							
							
								
								cache operator*'s result (in multiple functions)  
							
							... 
							
							
							
							llvm-svn: 107965 
							
						 
						
							2010-07-09 14:02:13 +00:00  
				
					
						
							
							
								 
						
							
								cefe3831b7 
								
							 
						 
						
							
							
								
								MDString is already checked earlier.  
							
							... 
							
							
							
							llvm-svn: 107516 
							
						 
						
							2010-07-02 21:13:23 +00:00  
				
					
						
							
							
								 
						
							
								e74c78d539 
								
							 
						 
						
							
							
								
								lowerinvoke needs to handle aggregate function args like sjlj eh does.  
							
							... 
							
							
							
							llvm-svn: 107335 
							
						 
						
							2010-06-30 22:22:59 +00:00  
				
					
						
							
							
								 
						
							
								e9acc46f65 
								
							 
						 
						
							
							
								
								use getArgOperand instead of getOperand  
							
							... 
							
							
							
							llvm-svn: 107269 
							
						 
						
							2010-06-30 09:14:26 +00:00  
				
					
						
							
							
								 
						
							
								ec60adf161 
								
							 
						 
						
							
							
								
								use CallInst::ArgOffset  
							
							... 
							
							
							
							llvm-svn: 107003 
							
						 
						
							2010-06-28 12:30:07 +00:00  
				
					
						
							
							
								 
						
							
								2de43a7c5c 
								
							 
						 
						
							
							
								
								use ArgOperand API and CallInst::ArgOffset  
							
							... 
							
							
							
							llvm-svn: 107002 
							
						 
						
							2010-06-28 12:29:20 +00:00  
				
					
						
							
							
								 
						
							
								ce97d55ad9 
								
							 
						 
						
							
							
								
								The hasMemory argument is irrelevant to how the argument  
							
							... 
							
							
							
							for an "i" constraint should get lowered; PR 6309.  While
this argument was passed around a lot, this is the only
place it was used, so it goes away from a lot of other
places.
llvm-svn: 106893 
							
						 
						
							2010-06-25 21:55:36 +00:00  
				
					
						
							
							
								 
						
							
								e3ba486c9f 
								
							 
						 
						
							
							
								
								use ArgOperand API (one more hunk I could split)  
							
							... 
							
							
							
							llvm-svn: 106825 
							
						 
						
							2010-06-25 07:58:41 +00:00  
				
					
						
							
							
								 
						
							
								5f3e656a1b 
								
							 
						 
						
							
							
								
								use ArgOperand API (some hunks I could split)  
							
							... 
							
							
							
							llvm-svn: 106824 
							
						 
						
							2010-06-25 07:57:14 +00:00  
				
					
						
							
							
								 
						
							
								42f620cc55 
								
							 
						 
						
							
							
								
								use callsite to obtain all arguments  
							
							... 
							
							
							
							llvm-svn: 106728 
							
						 
						
							2010-06-24 09:56:43 +00:00  
				
					
						
							
							
								 
						
							
								0dc3c2d37e 
								
							 
						 
						
							
							
								
								Use ValueMap instead of DenseMap.  
							
							... 
							
							
							
							The ValueMapper used by various cloning utility maps MDNodes also.
llvm-svn: 106706 
							
						 
						
							2010-06-24 00:33:28 +00:00  
				
					
						
							
							
								 
						
							
								d8dedee96d 
								
							 
						 
						
							
							
								
								Use available typedef for " DenseMap<const Value*, Value*>".  
							
							... 
							
							
							
							llvm-svn: 106699 
							
						 
						
							2010-06-24 00:00:42 +00:00  
				
					
						
							
							
								 
						
							
								b8f11de105 
								
							 
						 
						
							
							
								
								Cosmetic change.  
							
							... 
							
							
							
							Do not use "ValueMap" as a name for a local variable or an argument.
llvm-svn: 106698 
							
						 
						
							2010-06-23 23:55:51 +00:00  
				
					
						
							
							
								 
						
							
								9ad629367d 
								
							 
						 
						
							
							
								
								Revert 106592 for now. It causes clang-selfhost build failure.  
							
							... 
							
							
							
							llvm-svn: 106598 
							
						 
						
							2010-06-22 23:29:55 +00:00  
				
					
						
							
							
								 
						
							
								87f75f75be 
								
							 
						 
						
							
							
								
								If a metadata operand is seeded in value map and the metadata should also be seeded in value map. This is not limited to function local metadata.  
							
							... 
							
							
							
							Failure to seed metdata in such cases causes troubles when in a cloned module, metadata from a new module refers to values in old module. Usually this results in mysterious bugpoint crashes. For example,
 Checking to see if we can delete global inits: Unknown constant!
 UNREACHABLE executed at /d/g/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp:904!
llvm-svn: 106592 
							
						 
						
							2010-06-22 22:53:21 +00:00  
				
					
						
							
							
								 
						
							
								e43c6487da 
								
							 
						 
						
							
							
								
								While cloning a module, clone metadata attached with instructions.  
							
							... 
							
							
							
							llvm-svn: 106591 
							
						 
						
							2010-06-22 22:50:42 +00:00  
				
					
						
							
							
								 
						
							
								e3fbbd19ed 
								
							 
						 
						
							
							
								
								Clone named metadata while cloning a module.  
							
							... 
							
							
							
							Reapply Bob's patch.
llvm-svn: 106560 
							
						 
						
							2010-06-22 18:52:38 +00:00  
				
					
						
							
							
								 
						
							
								d2d1ae105d 
								
							 
						 
						
							
							
								
								Use pre-increment instead of post-increment when the result is not used.  
							
							... 
							
							
							
							llvm-svn: 106542 
							
						 
						
							2010-06-22 15:08:57 +00:00  
				
					
						
							
							
								 
						
							
								f040dec68a 
								
							 
						 
						
							
							
								
								Revert 106528. It is causing self host failures.  
							
							... 
							
							
							
							llvm-svn: 106529 
							
						 
						
							2010-06-22 06:14:09 +00:00  
				
					
						
							
							
								 
						
							
								b195eb4acf 
								
							 
						 
						
							
							
								
								Do not rely on DenseMap slot which can be easily invalidated when DenseMap grows.  
							
							... 
							
							
							
							llvm-svn: 106528 
							
						 
						
							2010-06-22 05:16:56 +00:00  
				
					
						
							
							
								 
						
							
								6c1fc79cab 
								
							 
						 
						
							
							
								
								Revert my change to clone named metadata.  Buildbots are complaining.  
							
							... 
							
							
							
							--- Reverse-merging r106508 into '.':
U    lib/Transforms/Utils/CloneModule.cpp
llvm-svn: 106521 
							
						 
						
							2010-06-22 02:08:51 +00:00  
				
					
						
							
							
								 
						
							
								5f9575c1cd 
								
							 
						 
						
							
							
								
								Include named metadata when cloning a module.  
							
							... 
							
							
							
							llvm-svn: 106508 
							
						 
						
							2010-06-22 00:11:03 +00:00  
				
					
						
							
							
								 
						
							
								dd41bba517 
								
							 
						 
						
							
							
								
								Use A.append(...) instead of A.insert(A.end(), ...) when A is a  
							
							... 
							
							
							
							SmallVector, and other SmallVector simplifications.
llvm-svn: 106452 
							
						 
						
							2010-06-21 19:47:52 +00:00  
				
					
						
							
							
								 
						
							
								e94f1ded24 
								
							 
						 
						
							
							
								
								remove trailing whitespace  
							
							... 
							
							
							
							llvm-svn: 106164 
							
						 
						
							2010-06-16 22:41:09 +00:00  
				
					
						
							
							
								 
						
							
								1118860e3a 
								
							 
						 
						
							
							
								
								simplify-libcalls: fold strstr(a, b) == a -> strncmp(a, b, strlen(b)) == 0  
							
							... 
							
							
							
							llvm-svn: 106047 
							
						 
						
							2010-06-15 21:34:25 +00:00  
				
					
						
							
							
								 
						
							
								36da24b546 
								
							 
						 
						
							
							
								
								Copy location info for current function argument from dbg.declare if respective store instruction does not have any location info.  
							
							... 
							
							
							
							llvm-svn: 105490 
							
						 
						
							2010-06-04 22:27:30 +00:00  
				
					
						
							
							
								 
						
							
								5ba76b94f8 
								
							 
						 
						
							
							
								
								Remove unused code  
							
							... 
							
							
							
							llvm-svn: 105293 
							
						 
						
							2010-06-01 21:56:30 +00:00