c23bcbc498 
								
							 
						 
						
							
							
								
								Preserve line number information.  
							
							... 
							
							
							
							llvm-svn: 131480 
							
						 
						
							2011-05-17 19:43:06 +00:00  
				
					
						
							
							
								 
						
							
								a0b682db62 
								
							 
						 
						
							
							
								
								There is no need to force DebugLoc on a PHI at this point.  
							
							... 
							
							
							
							llvm-svn: 131427 
							
						 
						
							2011-05-16 22:05:03 +00:00  
				
					
						
							
							
								 
						
							
								8e60ff11db 
								
							 
						 
						
							
							
								
								Preserve debug info for unused zero extended boolean argument.  
							
							... 
							
							
							
							Radar 9422775.
llvm-svn: 131422 
							
						 
						
							2011-05-16 21:24:05 +00:00  
				
					
						
							
							
								 
						
							
								d96205c4e5 
								
							 
						 
						
							
							
								
								SimplifyCFG: Use ComputeMaskedBits to prune dead cases from switch instructions.  
							
							... 
							
							
							
							llvm-svn: 131345 
							
						 
						
							2011-05-14 15:57:25 +00:00  
				
					
						
							
							
								 
						
							
								ac794d46bf 
								
							 
						 
						
							
							
								
								Set debug location for new PHI nodes created in exit block.  
							
							... 
							
							
							
							llvm-svn: 130894 
							
						 
						
							2011-05-04 23:58:22 +00:00  
				
					
						
							
							
								 
						
							
								bb35e8ba88 
								
							 
						 
						
							
							
								
								Scanning entire basic block may be too expensive in terms of compile time. Instead, just use whatever location info first non-phi instruction has.  
							
							... 
							
							
							
							llvm-svn: 130729 
							
						 
						
							2011-05-02 21:57:00 +00:00  
				
					
						
							
							
								 
						
							
								a8e7411c74 
								
							 
						 
						
							
							
								
								Assing line number info to new PHIs created by SSA updater.  
							
							... 
							
							
							
							llvm-svn: 130551 
							
						 
						
							2011-04-29 22:28:59 +00:00  
				
					
						
							
							
								 
						
							
								616044acd5 
								
							 
						 
						
							
							
								
								SimplifyCFG: Expose phi node folding cost threshold as command line parameter  
							
							... 
							
							
							
							llvm-svn: 130528 
							
						 
						
							2011-04-29 18:47:38 +00:00  
				
					
						
							
							
								 
						
							
								e3511e15e0 
								
							 
						 
						
							
							
								
								SimplifyCFG: Add CostRemaining parameter to DominatesMergePoint  
							
							... 
							
							
							
							llvm-svn: 130527 
							
						 
						
							2011-04-29 18:47:31 +00:00  
				
					
						
							
							
								 
						
							
								61f6602acd 
								
							 
						 
						
							
							
								
								SimplifyCFG: Add Trunc, ZExt and SExt to the list of cheap instructions for phi node folding  
							
							... 
							
							
							
							llvm-svn: 130526 
							
						 
						
							2011-04-29 18:47:25 +00:00  
				
					
						
							
							
								 
						
							
								72aa1a8a68 
								
							 
						 
						
							
							
								
								Remove DbgDeclare only if all uses are converted.  
							
							... 
							
							
							
							llvm-svn: 130431 
							
						 
						
							2011-04-28 20:32:02 +00:00  
				
					
						
							
							
								 
						
							
								1a180156b6 
								
							 
						 
						
							
							
								
								Remove unused STL header includes.  
							
							... 
							
							
							
							llvm-svn: 130068 
							
						 
						
							2011-04-23 19:53:52 +00:00  
				
					
						
							
							
								 
						
							
								5514afe6b2 
								
							 
						 
						
							
							
								
								PR9214: Convert Metadata API to use ArrayRef.  
							
							... 
							
							
							
							llvm-svn: 129932 
							
						 
						
							2011-04-21 19:59:31 +00:00  
				
					
						
							
							
								 
						
							
								6a85be25a4 
								
							 
						 
						
							
							
								
								Trivial simplification.  
							
							... 
							
							
							
							llvm-svn: 129759 
							
						 
						
							2011-04-19 15:23:29 +00:00  
				
					
						
							
							
								 
						
							
								0ab5e2cded 
								
							 
						 
						
							
							
								
								Fix a ton of comment typos found by codespell.  Patch by  
							
							... 
							
							
							
							Luis Felipe Strano Moraes!
llvm-svn: 129558 
							
						 
						
							2011-04-15 05:18:47 +00:00  
				
					
						
							
							
								 
						
							
								fba5cdfce1 
								
							 
						 
						
							
							
								
								rework FoldBranchToCommonDest to exit earlier when there is a bonus  
							
							... 
							
							
							
							instruction around, reducing work.
Greatly simplify handling of debug instructions.  There is no need to
build up a vector of them and then move them into the one predecessor
if we're processing a block.  Instead just rescan the block and *copy*
them into the pred.  If a block gets merged into multiple preds, this
will retain more debug info.
llvm-svn: 129502 
							
						 
						
							2011-04-14 02:44:53 +00:00  
				
					
						
							
							
								 
						
							
								7d4cdae564 
								
							 
						 
						
							
							
								
								comment cleanup, use moveBefore instead of removeFromParent+insertBefore.  
							
							... 
							
							
							
							llvm-svn: 129319 
							
						 
						
							2011-04-11 23:24:57 +00:00  
				
					
						
							
							
								 
						
							
								7c14a558fe 
								
							 
						 
						
							
							
								
								Don't include Operator.h from InstrTypes.h.  
							
							... 
							
							
							
							llvm-svn: 129271 
							
						 
						
							2011-04-11 09:35:34 +00:00  
				
					
						
							
							
								 
						
							
								bc3d8b212f 
								
							 
						 
						
							
							
								
								Do not let debug info interfer with branch folding.  
							
							... 
							
							
							
							llvm-svn: 129114 
							
						 
						
							2011-04-07 23:11:25 +00:00  
				
					
						
							
							
								 
						
							
								197c35298a 
								
							 
						 
						
							
							
								
								While hoisting common code from if/else, hoist debug info intrinsics if they match.  
							
							... 
							
							
							
							llvm-svn: 129078 
							
						 
						
							2011-04-07 17:27:36 +00:00  
				
					
						
							
							
								 
						
							
								e48ddf863b 
								
							 
						 
						
							
							
								
								Simplify. isIdenticalToWhenDefined() checks opcode.  
							
							... 
							
							
							
							llvm-svn: 129041 
							
						 
						
							2011-04-07 00:30:15 +00:00  
				
					
						
							
							
								 
						
							
								d715ec82b4 
								
							 
						 
						
							
							
								
								While folding branch to a common destination into a predecessor, copy dbg values also.  
							
							... 
							
							
							
							llvm-svn: 129035 
							
						 
						
							2011-04-06 22:37:20 +00:00  
				
					
						
							
							
								 
						
							
								b85c0caf7d 
								
							 
						 
						
							
							
								
								Attempt to fix breakage from r128782 reported by Francois Pichet on  
							
							... 
							
							
							
							llvm-commits.  (Not sure why it only breaks on Windows; maybe it has
something to do with the iterator representation...)
llvm-svn: 128802 
							
						 
						
							2011-04-04 00:37:38 +00:00  
				
					
						
							
							
								 
						
							
								17bf4922c9 
								
							 
						 
						
							
							
								
								PR9446: RecursivelyDeleteTriviallyDeadInstructions can delete the instruction  
							
							... 
							
							
							
							after the given instruction; make sure to handle that case correctly.
(It's difficult to trigger; the included testcase involves a dead 
block, but I don't think that's a requirement.) 
While I'm here, get rid of the unnecessary warning about
SimplifyInstructionsInBlock, since it should work correctly as far as I know.
llvm-svn: 128782 
							
						 
						
							2011-04-02 22:45:17 +00:00  
				
					
						
							
							
								 
						
							
								52131344a2 
								
							 
						 
						
							
							
								
								Remove PHINode::reserveOperandSpace(). Instead, add a parameter to  
							
							... 
							
							
							
							PHINode::Create() giving the (known or expected) number of operands.
llvm-svn: 128537 
							
						 
						
							2011-03-30 11:28:46 +00:00  
				
					
						
							
							
								 
						
							
								e0938d8a87 
								
							 
						 
						
							
							
								
								(Almost) always call reserveOperandSpace() on newly created PHINodes.  
							
							... 
							
							
							
							llvm-svn: 128535 
							
						 
						
							2011-03-30 11:19:20 +00:00  
				
					
						
							
							
								 
						
							
								17bbd7f495 
								
							 
						 
						
							
							
								
								Simplify.  
							
							... 
							
							
							
							llvm-svn: 128030 
							
						 
						
							2011-03-21 22:04:45 +00:00  
				
					
						
							
							
								 
						
							
								2c7ee2700c 
								
							 
						 
						
							
							
								
								If an AllocaInst referred by DbgDeclareInst is used by a LoadInst then the LoadInst should also get a corresponding llvm.dbg.value intrinsic.  
							
							... 
							
							
							
							llvm-svn: 127924 
							
						 
						
							2011-03-18 23:45:43 +00:00  
				
					
						
							
							
								 
						
							
								3ac171d49a 
								
							 
						 
						
							
							
								
								Remove dead code.  
							
							... 
							
							
							
							llvm-svn: 127923 
							
						 
						
							2011-03-18 23:33:58 +00:00  
				
					
						
							
							
								 
						
							
								c1431e6e84 
								
							 
						 
						
							
							
								
								Consider debug info intrinsics pointing to null value as dead instructions.  
							
							... 
							
							
							
							llvm-svn: 127922 
							
						 
						
							2011-03-18 23:28:02 +00:00  
				
					
						
							
							
								 
						
							
								aad34d882d 
								
							 
						 
						
							
							
								
								Try to not lose variable's debug info during instcombine.  
							
							... 
							
							
							
							This is done by lowering dbg.declare intrinsic into dbg.value intrinsic.
Radar 9143931.
llvm-svn: 127834 
							
						 
						
							2011-03-17 22:18:16 +00:00  
				
					
						
							
							
								 
						
							
								8c0b16b0aa 
								
							 
						 
						
							
							
								
								Refactor into a separate utility function.  
							
							... 
							
							
							
							llvm-svn: 127832 
							
						 
						
							2011-03-17 21:58:19 +00:00  
				
					
						
							
							
								 
						
							
								dbb27393cc 
								
							 
						 
						
							
							
								
								Clean up something noticed by Fritz.  
							
							... 
							
							
							
							llvm-svn: 127684 
							
						 
						
							2011-03-15 18:42:33 +00:00  
				
					
						
							
							
								 
						
							
								0b8cdfb6ec 
								
							 
						 
						
							
							
								
								Do not add PHIs with no users when creating LCSSA form. Patch by Andrew Clinton.  
							
							... 
							
							
							
							llvm-svn: 127674 
							
						 
						
							2011-03-15 07:41:25 +00:00  
				
					
						
							
							
								 
						
							
								c4414c6e92 
								
							 
						 
						
							
							
								
								PR9450: Make switch optimization in SimplifyCFG not dependent on the ordering  
							
							... 
							
							
							
							of pointers in an std::map.
llvm-svn: 127650 
							
						 
						
							2011-03-15 02:23:35 +00:00  
				
					
						
							
							
								 
						
							
								aac35b3fbb 
								
							 
						 
						
							
							
								
								PR9420; an instruction before an unreachable is guaranteed not to have any  
							
							... 
							
							
							
							reachable uses, but there still might be uses in dead blocks.  Use the
standard solution of replacing all the uses with undef.  This is
a rare case because it's very sensitive to phase ordering in SimplifyCFG.
llvm-svn: 127299 
							
						 
						
							2011-03-09 00:48:33 +00:00  
				
					
						
							
							
								 
						
							
								e2017b6f2e 
								
							 
						 
						
							
							
								
								DenseMap<uintptr_t,...> doesn't allow all values as keys.  
							
							... 
							
							
							
							Avoid colliding with the sentinels, hopefully unbreaking
llvm-gcc-x86_64-linux-selfhost.
llvm-svn: 126982 
							
						 
						
							2011-03-04 02:48:56 +00:00  
				
					
						
							
							
								 
						
							
								8ae07996c9 
								
							 
						 
						
							
							
								
								Teach SimplifyCFG that (switch (select cond, X, Y)) is better expressed as a branch.  
							
							... 
							
							
							
							Based on a patch by Alistair Lynn.
llvm-svn: 126647 
							
						 
						
							2011-02-28 09:44:07 +00:00  
				
					
						
							
							
								 
						
							
								ceb5daa567 
								
							 
						 
						
							
							
								
								Revert "SimplifyCFG: GEPs with just one non-constant index are also cheap."  
							
							... 
							
							
							
							Yes, there are other types than i8* and GEPs on them can produce an add+multiply.
We don't consider that cheap enough to be speculatively executed.
llvm-svn: 126481 
							
						 
						
							2011-02-25 10:33:33 +00:00  
				
					
						
							
							
								 
						
							
								dfdca1a14d 
								
							 
						 
						
							
							
								
								SimplifyCFG: GEPs with just one non-constant index are also cheap.  
							
							... 
							
							
							
							llvm-svn: 126452 
							
						 
						
							2011-02-24 23:26:09 +00:00  
				
					
						
							
							
								 
						
							
								27361a7124 
								
							 
						 
						
							
							
								
								SimplifyCFG: GEPs with constant indices are cheap enough to be executed unconditionally.  
							
							... 
							
							
							
							llvm-svn: 126445 
							
						 
						
							2011-02-24 22:46:11 +00:00  
				
					
						
							
							
								 
						
							
								cedf928743 
								
							 
						 
						
							
							
								
								Do not use DIFactory. Use DIBuilder.  
							
							... 
							
							
							
							llvm-svn: 126398 
							
						 
						
							2011-02-24 18:49:55 +00:00  
				
					
						
							
							
								 
						
							
								ecbbf0825b 
								
							 
						 
						
							
							
								
								If the phi node was used by an unreachable instruction that ends up using  
							
							... 
							
							
							
							itself without going via a phi node then we could return false here in
spite of making a change.  Also, tweak the comment because this method
can (and always could) return true without deleting the original phi node.
For example, if the phi node was used by a read-only invoke instruction
which is used by another phi node phi2 which is only used by and only uses
the invoke, then phi2 would be deleted but not the invoke instruction and
not the original phi node.
llvm-svn: 126129 
							
						 
						
							2011-02-21 17:32:05 +00:00  
				
					
						
							
							
								 
						
							
								6dcd49bc2b 
								
							 
						 
						
							
							
								
								Simplify RecursivelyDeleteDeadPHINode.  The only functionality change  
							
							... 
							
							
							
							should be that if the phi is used by a side-effect free instruction with
no uses then the phi and the instruction now get zapped (checked by the
unittest).
llvm-svn: 126124 
							
						 
						
							2011-02-21 16:27:36 +00:00  
				
					
						
							
							
								 
						
							
								183c24c51b 
								
							 
						 
						
							
							
								
								Make RecursivelyDeleteDeadPHINode delete a phi node that has no users and add a  
							
							... 
							
							
							
							test for that. With this change, test/CodeGen/X86/codegen-dce.ll no longer finds
any instructions to DCE, so delete the test.
Also renamed J and JP to I and IP in RecursivelyDeleteDeadPHINode.
llvm-svn: 126088 
							
						 
						
							2011-02-20 18:05:56 +00:00  
				
					
						
							
							
								 
						
							
								c8a1569950 
								
							 
						 
						
							
							
								
								Teach RecursivelyDeleteDeadPHINodes to handle multiple self-references. Patch  
							
							... 
							
							
							
							by Andrew Clinton!
llvm-svn: 126077 
							
						 
						
							2011-02-20 08:38:20 +00:00  
				
					
						
							
							
								 
						
							
								4a14fbc50c 
								
							 
						 
						
							
							
								
								Don't unroll loops whose header block's address is taken.  
							
							... 
							
							
							
							This is part of a futile attempt to not "break" bizzaro
code like this:
 l1:
  printf("l1: %p\n", &&l1);
  ++x;
  if( x < 3 ) goto l1;
Previously we'd fold &&l1 to 1, which is fine per our semantics
but not helpful to the user.
llvm-svn: 125827 
							
						 
						
							2011-02-18 04:25:21 +00:00  
				
					
						
							
							
								 
						
							
								d8e66038f4 
								
							 
						 
						
							
							
								
								Rename 'loopsimplify' to 'loop-simplify'.  
							
							... 
							
							
							
							llvm-svn: 125317 
							
						 
						
							2011-02-10 23:38:10 +00:00  
				
					
						
							
							
								 
						
							
								8d6a8c130b 
								
							 
						 
						
							
							
								
								SimplifyCFG: Track the number of used icmps when turning a icmp chain into a switch. If we used only one icmp, don't turn it into a switch.  
							
							... 
							
							
							
							Also prevent the switch-to-icmp transform from creating identity adds, noticed by Marius Wachtler.
llvm-svn: 125056 
							
						 
						
							2011-02-07 22:37:28 +00:00  
				
					
						
							
							
								 
						
							
								62aa46b852 
								
							 
						 
						
							
							
								
								SimplifyCFG: Also transform switches that represent a range comparison but are not sorted into sub+icmp.  
							
							... 
							
							
							
							This transforms another 1000 switches in gcc.c.
llvm-svn: 124826 
							
						 
						
							2011-02-03 22:51:41 +00:00  
				
					
						
							
							
								 
						
							
								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