cdfe20b97f 
								
							 
						 
						
							
							
								
								Move TargetData to DataLayout.  
							
							... 
							
							
							
							llvm-svn: 165402 
							
						 
						
							2012-10-08 16:38:25 +00:00  
				
					
						
							
							
								 
						
							
								30c4282f88 
								
							 
						 
						
							
							
								
								Update function names to conform to guidelines.  
							
							... 
							
							
							
							No functional change.
llvm-svn: 163279 
							
						 
						
							2012-09-06 00:59:08 +00:00  
				
					
						
							
							
								 
						
							
								465834c85f 
								
							 
						 
						
							
							
								
								Clean whitespaces.  
							
							... 
							
							
							
							llvm-svn: 160668 
							
						 
						
							2012-07-24 10:51:42 +00:00  
				
					
						
							
							
								 
						
							
								482fb19fd5 
								
							 
						 
						
							
							
								
								fix PR13339 (remove the predecessor from the unwind BB when removing an invoke)  
							
							... 
							
							
							
							llvm-svn: 160325 
							
						 
						
							2012-07-16 22:49:40 +00:00  
				
					
						
							
							
								 
						
							
								d0bcfe4d9d 
								
							 
						 
						
							
							
								
								fix the regression I introduced in r159385 (it's necessary to update PHI nodes in unwind BB  
							
							... 
							
							
							
							llvm-svn: 159534 
							
						 
						
							2012-07-02 16:14:47 +00:00  
				
					
						
							
							
								 
						
							
								b97a4e8bc2 
								
							 
						 
						
							
							
								
								make simplifyCFG erase invokes to readonly/readnone functions  
							
							... 
							
							
							
							llvm-svn: 159385 
							
						 
						
							2012-06-28 22:32:27 +00:00  
				
					
						
							
							
								 
						
							
								07594cba7c 
								
							 
						 
						
							
							
								
								improve optimization of invoke instructions:  
							
							... 
							
							
							
							- simplifycfg:  invoke undef/null -> unreachable
 - instcombine:  invoke new  -> invoke expect(0, 0)  (an arbitrary NOOP intrinsic;  only done if the allocated memory is unused, of course)
 - verifier:  allow invoke of intrinsics  (to make the previous step work)
llvm-svn: 159146 
							
						 
						
							2012-06-25 17:11:47 +00:00  
				
					
						
							
							
								 
						
							
								5bd375a6cc 
								
							 
						 
						
							
							
								
								Convert CallInst and InvokeInst APIs to use ArrayRef.  
							
							... 
							
							
							
							llvm-svn: 135265 
							
						 
						
							2011-07-15 08:37:34 +00:00  
				
					
						
							
							
								 
						
							
								5127c5d9b2 
								
							 
						 
						
							
							
								
								Preserve line number information while converting Invoke into a Call.  
							
							... 
							
							
							
							llvm-svn: 132505 
							
						 
						
							2011-06-02 22:46:58 +00:00  
				
					
						
							
							
								 
						
							
								ad964559ef 
								
							 
						 
						
							
							
								
								Add a parameter to ConstantFoldTerminator() that callers can use to ask it to also clean up the condition of any conditional terminator it folds to be unconditional, if that turns the condition into dead code. This just means it calls RecursivelyDeleteTriviallyDeadInstructions() in strategic spots. It defaults to the old behavior.  
							
							... 
							
							
							
							I also changed -simplifycfg, -jump-threading and -codegenprepare to use this to produce slightly better code without any extra cleanup passes (AFAICT this was the only place in -simplifycfg where now-dead conditions of replaced terminators weren't being cleaned up). The only other user of this function is -sccp, but I didn't read that thoroughly enough to figure out whether it might be holding pointers to instructions that could be deleted by this.
llvm-svn: 131855 
							
						 
						
							2011-05-22 16:24:18 +00:00  
				
					
						
							
							
								 
						
							
								12bf0ab4b5 
								
							 
						 
						
							
							
								
								Simplify cfg inserts a call to trap when unreachable code is detected. Assign DebugLoc to this new trap instruction.  
							
							... 
							
							
							
							llvm-svn: 130315 
							
						 
						
							2011-04-27 17:59:27 +00:00  
				
					
						
							
							
								 
						
							
								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  
				
					
						
							
							
								 
						
							
								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  
				
					
						
							
							
								 
						
							
								df7a4f2515 
								
							 
						 
						
							
							
								
								Now with fewer extraneous semicolons!  
							
							... 
							
							
							
							llvm-svn: 115996 
							
						 
						
							2010-10-07 22:25:06 +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  
				
					
						
							
							
								 
						
							
								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  
				
					
						
							
							
								 
						
							
								a57b97e7e7 
								
							 
						 
						
							
							
								
								Fix batch of converting RegisterPass<> to INTIALIZE_PASS().  
							
							... 
							
							
							
							llvm-svn: 109045 
							
						 
						
							2010-07-21 22:09:45 +00:00  
				
					
						
							
							
								 
						
							
								b82de426de 
								
							 
						 
						
							
							
								
								SimplifyCFG: don't turn volatile stores to null/undef into unreachable. Fixes PR7369.  
							
							... 
							
							
							
							llvm-svn: 105914 
							
						 
						
							2010-06-13 14:35:54 +00:00  
				
					
						
							
							
								 
						
							
								84d4618659 
								
							 
						 
						
							
							
								
								make simplifycfg insert an llvm.trap before the 'unreachable' it introduces  
							
							... 
							
							
							
							when it detects undefined behavior.  llvm.trap generally codegens into some
thing really small (e.g. a 2 byte ud2 instruction on x86) and debugging this
sort of thing is "nontrivial".  For example, we now compile:
void foo() { *(int*)0 = 42; }
into:
_foo:
	pushl	%ebp
	movl	%esp, %ebp
	ud2
Some may even claim that this is a security hole, though that seems dubious
to me.  This addresses rdar://7958343 - Optimizing away null dereference 
potentially allows arbitrary code execution
llvm-svn: 103356 
							
						 
						
							2010-05-08 22:15:59 +00:00  
				
					
						
							
							
								 
						
							
								a2fbc0ae1b 
								
							 
						 
						
							
							
								
								Finally land the InvokeInst operand reordering.  
							
							... 
							
							
							
							I have audited all getOperandNo calls now, fixing
hidden assumptions. CallSite related uglyness will
be eliminated successively.
Note this patch has a long and griveous history,
for all the back-and-forths have a look at
CallSite.h's log.
llvm-svn: 99399 
							
						 
						
							2010-03-24 13:21:49 +00:00  
				
					
						
							
							
								 
						
							
								e1517a084f 
								
							 
						 
						
							
							
								
								backing out r99170 because it still fails on clang-x86_64-darwin10-fnt  
							
							... 
							
							
							
							llvm-svn: 99171 
							
						 
						
							2010-03-22 09:11:00 +00:00  
				
					
						
							
							
								 
						
							
								7a743e15e3 
								
							 
						 
						
							
							
								
								Now that hopefully all direct accesses to InvokeInst operands are fixed  
							
							... 
							
							
							
							we can reapply the InvokeInst operand reordering patch. (see r98957).
llvm-svn: 99170 
							
						 
						
							2010-03-22 08:28:00 +00:00  
				
					
						
							
							
								 
						
							
								6c56ed847e 
								
							 
						 
						
							
							
								
								back out r98957, it broke  http://smooshlab.apple.com:8010/builders/clang-x86_64-darwin10-fnt/builds/703  in the nightly test suite  
							
							... 
							
							
							
							llvm-svn: 98958 
							
						 
						
							2010-03-19 13:50:02 +00:00  
				
					
						
							
							
								 
						
							
								8335f9c0bf 
								
							 
						 
						
							
							
								
								Recommit r80858 again (which has been backed out in r80871).  
							
							... 
							
							
							
							This time I did a self-hosted bootstrap on Linux x86-64,
with no problems. Let's see how darwin 64-bit self-hosting
goes. At the first sign of failure I'll back this out.
Maybe the valgrind bots give me a hint of what may be wrong
(it at all).
llvm-svn: 98957 
							
						 
						
							2010-03-19 11:55:53 +00:00  
				
					
						
							
							
								 
						
							
								d3f41e8939 
								
							 
						 
						
							
							
								
								In "empty" bb, the return instruction may not be first instruction, if dbg value intrinsics are present in this bb. Use terminator to find return instructions.  
							
							... 
							
							
							
							llvm-svn: 98565 
							
						 
						
							2010-03-15 19:05:46 +00:00  
				
					
						
							
							
								 
						
							
								55e69d179b 
								
							 
						 
						
							
							
								
								Skip over debug info when trying to merge two return BBs.  
							
							... 
							
							
							
							llvm-svn: 98491 
							
						 
						
							2010-03-14 10:40:55 +00:00  
				
					
						
							
							
								 
						
							
								916f48a054 
								
							 
						 
						
							
							
								
								Teach SimplifyCFG about magic pointer constants.  
							
							... 
							
							
							
							Weird code sometimes uses pointer constants other than null. This patch
teaches SimplifyCFG to build switch instructions in those cases.
Code like this:
void f(const char *x) {
  if (!x)
    puts("null");
  else if ((uintptr_t)x == 1)
    puts("one");
  else if (x == (char*)2 || x == (char*)3)
    puts("two");
  else if ((intptr_t)x == 4)
    puts("four");
  else
    puts(x);
}
Now becomes a switch:
define void @f(i8* %x) nounwind ssp {
entry:
  %magicptr23 = ptrtoint i8* %x to i64            ; <i64> [#uses=1]
  switch i64 %magicptr23, label %if.else16 [
    i64 0, label %if.then
    i64 1, label %if.then2
    i64 2, label %if.then9
    i64 3, label %if.then9
    i64 4, label %if.then14
  ]
Note that LLVM's own DenseMap uses magic pointers.
llvm-svn: 95439 
							
						 
						
							2010-02-05 22:03:18 +00:00  
				
					
						
							
							
								 
						
							
								28943873e6 
								
							 
						 
						
							
							
								
								Use do+while instead of while for loops which obviously have a  
							
							... 
							
							
							
							non-zero trip count. Use SmallVector's pop_back_val().
llvm-svn: 92734 
							
						 
						
							2010-01-05 16:27:25 +00:00  
				
					
						
							
							
								 
						
							
								f21a220bcd 
								
							 
						 
						
							
							
								
								Implement PR5795 by merging duplicated return blocks.  This could go further  
							
							... 
							
							
							
							by merging all returns in a function into a single one, but simplifycfg 
currently likes to duplicate the return (an unfortunate choice!)
llvm-svn: 91890 
							
						 
						
							2009-12-22 06:07:30 +00:00  
				
					
						
							
							
								 
						
							
								621fe5614e 
								
							 
						 
						
							
							
								
								Remove LLVMContext and its include.  
							
							... 
							
							
							
							llvm-svn: 89644 
							
						 
						
							2009-11-23 03:34:29 +00:00  
				
					
						
							
							
								 
						
							
								37536b90e1 
								
							 
						 
						
							
							
								
								remove a bunch of locking from LLVMContextImpl.  Since only one thread  
							
							... 
							
							
							
							can be banging on a context at a time, this isn't needed.  Owen, please
review.
llvm-svn: 85728 
							
						 
						
							2009-11-01 18:42:03 +00:00  
				
					
						
							
							
								 
						
							
								2d60e1ec0c 
								
							 
						 
						
							
							
								
								back out my recent commit (r80858), it seems to break self-hosting buildbot's stage 2 configure  
							
							... 
							
							
							
							llvm-svn: 80871 
							
						 
						
							2009-09-03 02:02:59 +00:00  
				
					
						
							
							
								 
						
							
								14dfba6d66 
								
							 
						 
						
							
							
								
								re-commit r66920 (which has been backed out in r66953) I may have more luck this time. I'll back out if needed...  
							
							... 
							
							
							
							llvm-svn: 80858 
							
						 
						
							2009-09-03 00:18:58 +00:00  
				
					
						
							
							
								 
						
							
								2dd09dbdf7 
								
							 
						 
						
							
							
								
								eliminate VISIBILITY_HIDDEN from Transforms/Scalar.  PR4861  
							
							... 
							
							
							
							llvm-svn: 80766 
							
						 
						
							2009-09-02 06:11:42 +00:00  
				
					
						
							
							
								 
						
							
								a3e620caba 
								
							 
						 
						
							
							
								
								add getPointerAddressSpace() to GEP instruction, use the method  
							
							... 
							
							
							
							in a few scalar xforms to simplify things.
llvm-svn: 80506 
							
						 
						
							2009-08-30 20:06:40 +00:00  
				
					
						
							
							
								 
						
							
								55f1c09e31 
								
							 
						 
						
							
							
								
								Push LLVMContexts through the IntegerType APIs.  
							
							... 
							
							
							
							llvm-svn: 78948 
							
						 
						
							2009-08-13 21:58:54 +00:00  
				
					
						
							
							
								 
						
							
								b292b8ce70 
								
							 
						 
						
							
							
								
								Move more code back to 2.5 APIs.  
							
							... 
							
							
							
							llvm-svn: 77635 
							
						 
						
							2009-07-30 23:03:37 +00:00  
				
					
						
							
							
								 
						
							
								47db941fd3 
								
							 
						 
						
							
							
								
								Get rid of the Pass+Context magic.  
							
							... 
							
							
							
							llvm-svn: 76702 
							
						 
						
							2009-07-22 00:24:57 +00:00  
				
					
						
							
							
								 
						
							
								3be62697df 
								
							 
						 
						
							
							
								
								Revert 75571; I'm convinced this isn't the right thing to do.  
							
							... 
							
							
							
							llvm-svn: 75642 
							
						 
						
							2009-07-14 17:48:25 +00:00  
				
					
						
							
							
								 
						
							
								85ae7480d9 
								
							 
						 
						
							
							
								
								Don't delete asm's just because their inputs are undefined;  
							
							... 
							
							
							
							xor R, R is a common and valid idiom for zeroing a register, for example.
llvm-svn: 75571 
							
						 
						
							2009-07-14 00:45:38 +00:00  
				
					
						
							
							
								 
						
							
								38264b1554 
								
							 
						 
						
							
							
								
								"LLVMContext* " --> "LLVMContext *"  
							
							... 
							
							
							
							llvm-svn: 74878 
							
						 
						
							2009-07-06 23:00:19 +00:00  
				
					
						
							
							
								 
						
							
								340288c621 
								
							 
						 
						
							
							
								
								Even more passes being LLVMContext'd.  
							
							... 
							
							
							
							llvm-svn: 74781 
							
						 
						
							2009-07-03 19:42:02 +00:00  
				
					
						
							
							
								 
						
							
								3dd5c5d28a 
								
							 
						 
						
							
							
								
								second half of fix for PR4366: don't zap store to null of  
							
							... 
							
							
							
							non-default addrspaces.
llvm-svn: 73253 
							
						 
						
							2009-06-12 21:01:07 +00:00  
				
					
						
							
							
								 
						
							
								4bb96e9a50 
								
							 
						 
						
							
							
								
								Revert r66920. It was causing failures in the self-hosting buildbot (in release  
							
							... 
							
							
							
							mode).
Running /Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvmCore/test/BugPoint/dg.exp ...
FAIL: /Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvmCore/test/BugPoint/crash-narrowfunctiontest.ll
Failed with signal(SIGBUS) at line 1
while running: bugpoint /Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvmCore/test/BugPoint/crash-narrowfunctiontest.ll -bugpoint-crashcalls -silence-passes > /dev/null
0   bugpoint          0x0035dd25 llvm::sys::SetInterruptFunction(void (*)()) + 85
1   bugpoint          0x0035e382 llvm::sys::RemoveFileOnSignal(llvm::sys::Path const&, std::string*) + 706
2   libSystem.B.dylib 0x92f112bb _sigtramp + 43
3   libSystem.B.dylib 0xffffffff _sigtramp + 1829694831
4   bugpoint          0x00021d1c main + 92
5   bugpoint          0x00002106 start + 54
6   bugpoint          0x00000004 start + 18446744073709543220
Stack dump:
0.    Program arguments: bugpoint /Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvmCore/test/BugPoint/crash-narrowfunctiontest.ll -bugpoint-crashcalls -silence-passes 
FAIL: /Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvmCore/test/BugPoint/misopt-basictest.ll
Failed with signal(SIGBUS) at line 1
while running: bugpoint /Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvmCore/test/BugPoint/misopt-basictest.ll -dce -bugpoint-deletecalls -simplifycfg -silence-passes
0   bugpoint          0x0035dd25 llvm::sys::SetInterruptFunction(void (*)()) + 85
1   bugpoint          0x0035e382 llvm::sys::RemoveFileOnSignal(llvm::sys::Path const&, std::string*) + 706
2   libSystem.B.dylib 0x92f112bb _sigtramp + 43
3   libSystem.B.dylib 0xffffffff _sigtramp + 1829694831
4   bugpoint          0x00021d1c main + 92
5   bugpoint          0x00002106 start + 54
6   bugpoint          0x00000006 start + 18446744073709543222
Stack dump:
0.    Program arguments: bugpoint /Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvmCore/test/BugPoint/misopt-basictest.ll -dce -bugpoint-deletecalls -simplifycfg -silence-passes 
FAIL: /Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvmCore/test/BugPoint/remove_arguments_test.ll
Failed with signal(SIGBUS) at line 1
while running: bugpoint /Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvmCore/test/BugPoint/remove_arguments_test.ll  -bugpoint-crashcalls -silence-passes
0   bugpoint          0x0035dd25 llvm::sys::SetInterruptFunction(void (*)()) + 85
1   bugpoint          0x0035e382 llvm::sys::RemoveFileOnSignal(llvm::sys::Path const&, std::string*) + 706
2   libSystem.B.dylib 0x92f112bb _sigtramp + 43
3   libSystem.B.dylib 0xffffffff _sigtramp + 1829694831
4   bugpoint          0x00021d1c main + 92
5   bugpoint          0x00002106 start + 54
Stack dump:
0.    Program arguments: bugpoint /Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvmCore/test/BugPoint/remove_arguments_test.ll -bugpoint-crashcalls -silence-passes 
--- Reverse-merging (from foreign repository) r66920 into '.':
U    include/llvm/Support/CallSite.h
U    include/llvm/Instructions.h
U    lib/Analysis/IPA/GlobalsModRef.cpp
U    lib/Analysis/IPA/Andersens.cpp
U    lib/Bitcode/Writer/BitcodeWriter.cpp
U    lib/VMCore/Instructions.cpp
U    lib/VMCore/Verifier.cpp
U    lib/VMCore/AsmWriter.cpp
U    lib/Transforms/Utils/LowerInvoke.cpp
U    lib/Transforms/Scalar/SimplifyCFGPass.cpp
U    lib/Transforms/IPO/PruneEH.cpp
U    lib/Transforms/IPO/DeadArgumentElimination.cpp
llvm-svn: 66953 
							
						 
						
							2009-03-13 21:15:59 +00:00  
				
					
						
							
							
								 
						
							
								258232fb80 
								
							 
						 
						
							
							
								
								Second installment of "BasicBlock operands to the back"  
							
							... 
							
							
							
							changes.
For InvokeInst now all arguments begin at op_begin().
The Callee, Cont and Fail are now faster to get by
access relative to op_end().
This patch introduces some temporary uglyness in CallSite.
Next I'll bring CallInst up to a similar scheme and then
the uglyness will magically vanish.
This patch also exposes all the reliance of the libraries
on InvokeInst's operand ordering. I am thinking of taking
care of that too.
llvm-svn: 66920 
							
						 
						
							2009-03-13 18:27:29 +00:00  
				
					
						
							
							
								 
						
							
								4c758ea3e0 
								
							 
						 
						
							
							
								
								Large mechanical patch.  
							
							... 
							
							
							
							s/ParamAttr/Attribute/g
s/PAList/AttrList/g
s/FnAttributeWithIndex/AttributeWithIndex/g
s/FnAttr/Attribute/g
This sets the stage 
- to implement function notes as function attributes and 
- to distinguish between function attributes and return value attributes.
This requires corresponding changes in llvm-gcc and clang.
llvm-svn: 56622 
							
						 
						
							2008-09-25 21:00:45 +00:00  
				
					
						
							
							
								 
						
							
								ba3fa6c6e1 
								
							 
						 
						
							
							
								
								s/ParameterAttributes/Attributes/g  
							
							... 
							
							
							
							llvm-svn: 56513 
							
						 
						
							2008-09-23 23:03:40 +00:00  
				
					
						
							
							
								 
						
							
								3d56051f70 
								
							 
						 
						
							
							
								
								s/RemoveUnreachableBlocks/RemoveUnreachableBlocksFromFn/g  
							
							... 
							
							
							
							llvm-svn: 55965 
							
						 
						
							2008-09-08 22:14:17 +00:00  
				
					
						
							
							
								 
						
							
								a79db30d28 
								
							 
						 
						
							
							
								
								Tidy up several unbeseeming casts from pointer to intptr_t.  
							
							... 
							
							
							
							llvm-svn: 55779 
							
						 
						
							2008-09-04 17:05:41 +00:00  
				
					
						
							
							
								 
						
							
								e15051d64b 
								
							 
						 
						
							
							
								
								rename SimplifyCFG.cpp -> SimplifyCFGPass.cpp  
							
							... 
							
							
							
							llvm-svn: 51130 
							
						 
						
							2008-05-14 20:38:44 +00:00