oota-llvm.git
15 years agoReapply 80278
Bruno Cardoso Lopes [Tue, 1 Sep 2009 17:27:58 +0000 (17:27 +0000)]
Reapply 80278

Add MO flags to simplify the printing of relocations.
Remove the support for printing large code model relocs (which
aren't supported anyway).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80691 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agorevert inadvertant change from previous commit
Jim Grosbach [Tue, 1 Sep 2009 17:19:13 +0000 (17:19 +0000)]
revert inadvertant change from previous commit

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80689 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agorandom code cleanups, no functionality change.
Chris Lattner [Tue, 1 Sep 2009 17:09:55 +0000 (17:09 +0000)]
random code cleanups, no functionality change.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80682 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoUpdate CMake files.
Ted Kremenek [Tue, 1 Sep 2009 17:01:02 +0000 (17:01 +0000)]
Update CMake files.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80680 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoSimply LSDA lable emission to use a direct special-case output instead of
Jim Grosbach [Tue, 1 Sep 2009 16:43:35 +0000 (16:43 +0000)]
Simply LSDA lable emission to use a direct special-case output instead of
EmitLabel()

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80677 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoDo not manipulate invalid iterators. This fixes the
Duncan Sands [Tue, 1 Sep 2009 15:13:02 +0000 (15:13 +0000)]
Do not manipulate invalid iterators.  This fixes the
llvm-gcc build when expensive checking is turned on.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80671 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoFurther refactoring of PIC16 Obj file code.
Sanjiv Gupta [Tue, 1 Sep 2009 10:47:31 +0000 (10:47 +0000)]
Further refactoring of PIC16 Obj file code.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80670 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoUpdate CMakeLists.
Benjamin Kramer [Tue, 1 Sep 2009 10:24:10 +0000 (10:24 +0000)]
Update CMakeLists.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80669 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoPreparation for Optimal Edge Profiling:
Andreas Neustifter [Tue, 1 Sep 2009 10:08:39 +0000 (10:08 +0000)]
Preparation for Optimal Edge Profiling:
Add statistics for regular edge profiling, this enables the comparation of the
number of edges inserted by regular and optimal edge profiling.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80668 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoPreparation for Optimal Edge Profiling:
Andreas Neustifter [Tue, 1 Sep 2009 10:06:05 +0000 (10:06 +0000)]
Preparation for Optimal Edge Profiling:
Optimal edge profiling is only possible when blocks with no predecessors get an
virtual edge (BB,0) that counts the execution frequencies of this
function-exiting blocks.
This patch makes the necessary changes before actually enabling optimal edge profiling.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80667 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoPreparation for Optimal Edge Profiling:
Andreas Neustifter [Tue, 1 Sep 2009 08:48:42 +0000 (08:48 +0000)]
Preparation for Optimal Edge Profiling:
This adds a pass to verify the current profile against the flow conditions.
This is very helpful when later on trying to perserve the profiling information
during all passes.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80666 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agotestcase for PR3601
Chris Lattner [Tue, 1 Sep 2009 06:33:49 +0000 (06:33 +0000)]
testcase for PR3601

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80664 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoChange CallGraphNode to maintain it's Function as an AssertingVH
Chris Lattner [Tue, 1 Sep 2009 06:31:31 +0000 (06:31 +0000)]
Change CallGraphNode to maintain it's Function as an AssertingVH
for sanity.  This didn't turn up any bugs.

Change CallGraphNode to maintain its "callsite" information in the
call edges list as a WeakVH instead of as an instruction*.  This fixes
a broad class of dangling pointer bugs, and makes CallGraph have a number
of useful invariants again.  This fixes the class of problem indicated
by PR4029 and PR3601.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80663 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoAdd virtual destructor.
Devang Patel [Tue, 1 Sep 2009 05:04:28 +0000 (05:04 +0000)]
Add virtual destructor.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80660 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoAdd test for vld{234}_lane instructions.
Bob Wilson [Tue, 1 Sep 2009 04:27:10 +0000 (04:27 +0000)]
Add test for vld{234}_lane instructions.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80658 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoGenerate code for vld{234}_lane intrinsics.
Bob Wilson [Tue, 1 Sep 2009 04:26:28 +0000 (04:26 +0000)]
Generate code for vld{234}_lane intrinsics.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80656 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoFix pr4843: When an instruction has multiple destination registers that are
Bob Wilson [Tue, 1 Sep 2009 04:18:40 +0000 (04:18 +0000)]
Fix pr4843: When an instruction has multiple destination registers that are
tied to different source registers, the TwoAddressInstructionPass needs to
be smarter.  Change it to check before replacing a source register whether
that source register is tied to a different destination register, and if so,
defer handling it until a subsequent iteration.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80654 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agollvm-mc: Store MCSymbolData value as a pointer (to make MSVC happy).
Daniel Dunbar [Tue, 1 Sep 2009 04:09:03 +0000 (04:09 +0000)]
llvm-mc: Store MCSymbolData value as a pointer (to make MSVC happy).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80652 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoSJLJ is arm/darwin only for now. force the triple for the test
Jim Grosbach [Tue, 1 Sep 2009 02:34:49 +0000 (02:34 +0000)]
SJLJ is arm/darwin only for now. force the triple for the test

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80651 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoFix compiler warnings
Jim Grosbach [Tue, 1 Sep 2009 02:05:03 +0000 (02:05 +0000)]
Fix compiler warnings

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80650 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoClean up LSDA name generation and use for SJLJ exception handling. This
Jim Grosbach [Tue, 1 Sep 2009 01:57:56 +0000 (01:57 +0000)]
Clean up LSDA name generation and use for SJLJ exception handling. This
makes an eggregious hack somewhat more palatable. Bringing the LSDA forward
and making it a GV available for reference would be even better, but is
beyond the scope of what I'm looking to solve at this point.

Objective C++ code could generate function names that broke the previous
scheme. This fixes that.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80649 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoIntroduce DILocation.
Devang Patel [Tue, 1 Sep 2009 01:14:15 +0000 (01:14 +0000)]
Introduce DILocation.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80648 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoAdd getDirectory() and getFilename() interface to DIScope.
Devang Patel [Tue, 1 Sep 2009 00:53:21 +0000 (00:53 +0000)]
Add getDirectory() and getFilename() interface to DIScope.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80647 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoSubprogram is a scope. Derive DISubprogram from DIScope.
Devang Patel [Mon, 31 Aug 2009 22:47:13 +0000 (22:47 +0000)]
Subprogram is a scope. Derive DISubprogram from DIScope.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80637 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoRename DIBlock as DILexicalBlock.
Devang Patel [Mon, 31 Aug 2009 22:00:15 +0000 (22:00 +0000)]
Rename DIBlock as DILexicalBlock.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80633 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoDon't use an iterator which is potentially invalidated.
Dan Gohman [Mon, 31 Aug 2009 21:58:28 +0000 (21:58 +0000)]
Don't use an iterator which is potentially invalidated.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80632 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoUse early exit and reduce indentation.
Bob Wilson [Mon, 31 Aug 2009 21:54:55 +0000 (21:54 +0000)]
Use early exit and reduce indentation.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80631 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoIf the tied registers are already the same, there is no need to change
Bob Wilson [Mon, 31 Aug 2009 21:54:16 +0000 (21:54 +0000)]
If the tied registers are already the same, there is no need to change
them.  Move the code to make that change inside the conditional.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80630 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoAdd triple parsing support for XCore.
Richard Osborne [Mon, 31 Aug 2009 21:51:36 +0000 (21:51 +0000)]
Add triple parsing support for XCore.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80629 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoDerive DICompileUnit from DIScope.
Devang Patel [Mon, 31 Aug 2009 21:34:44 +0000 (21:34 +0000)]
Derive DICompileUnit from DIScope.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80627 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoAdd flag to mark structs for Apple Block "byref" variables; also add code to
Caroline Tice [Mon, 31 Aug 2009 21:19:37 +0000 (21:19 +0000)]
Add flag to mark structs for Apple Block "byref" variables; also add code to
modify the type and location debug information for these variables to match the
programmer's expectations.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80625 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoExtend the ValuesAtScope cache to cover all expressions, not just
Dan Gohman [Mon, 31 Aug 2009 21:15:23 +0000 (21:15 +0000)]
Extend the ValuesAtScope cache to cover all expressions, not just
SCEVUnknowns, as the non-SCEVUnknown cases in the getSCEVAtScope code
can also end up repeatedly climing through the same expression trees,
which can be unusably slow when the trees are very tall.

Also, add a quick check for SCEV pointer equality to the main
SCEV comparison routine, as the full comparison code can be expensive
in the case of large expression trees.

These fix compile-time problems in some pathlogical cases.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80623 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agorestore semantics of operator* (removing a FIXME I had to introduce in r80224)
Gabor Greif [Mon, 31 Aug 2009 20:54:23 +0000 (20:54 +0000)]
restore semantics of operator* (removing a FIXME I had to introduce in r80224)

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80622 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoDon't mark a register live at an undef use.
David Goodwin [Mon, 31 Aug 2009 20:47:02 +0000 (20:47 +0000)]
Don't mark a register live at an undef use.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80621 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoIntroduce DIScope.
Devang Patel [Mon, 31 Aug 2009 20:44:45 +0000 (20:44 +0000)]
Introduce DIScope.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80620 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoOops. Fix inverted logic in assertion check.
Devang Patel [Mon, 31 Aug 2009 20:27:49 +0000 (20:27 +0000)]
Oops. Fix inverted logic in assertion check.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80618 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoRemove .n suffix for some 16-bit opcodes now that Darwin assembler is fixed.
Evan Cheng [Mon, 31 Aug 2009 20:14:07 +0000 (20:14 +0000)]
Remove .n suffix for some 16-bit opcodes now that Darwin assembler is fixed.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80615 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoX86/exp-asm-printer: Lower MachineOperand::MO_JumpTableIndex to MCOperand.
Daniel Dunbar [Mon, 31 Aug 2009 19:14:05 +0000 (19:14 +0000)]
X86/exp-asm-printer: Lower MachineOperand::MO_JumpTableIndex to MCOperand.
 - Down to 7 failures on 403.gcc.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80605 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoStop printing old asm printing code inline with -experimental-asm-printer (this allow...
Daniel Dunbar [Mon, 31 Aug 2009 19:13:56 +0000 (19:13 +0000)]
Stop printing old asm printing code inline with -experimental-asm-printer (this allows diffing and assembling the .s)

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80604 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoAvoid unnecessary +0 in experimental-asm-printer.
Daniel Dunbar [Mon, 31 Aug 2009 19:13:47 +0000 (19:13 +0000)]
Avoid unnecessary +0 in experimental-asm-printer.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80603 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoSimplify isDerivedType() and other predicate interface.
Devang Patel [Mon, 31 Aug 2009 18:49:10 +0000 (18:49 +0000)]
Simplify isDerivedType() and other predicate interface.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80602 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoOutput a hex value, because all of the others are hex.
Bill Wendling [Mon, 31 Aug 2009 18:26:48 +0000 (18:26 +0000)]
Output a hex value, because all of the others are hex.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80601 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoFix some misspellings of XTARGET.
Dale Johannesen [Mon, 31 Aug 2009 18:05:23 +0000 (18:05 +0000)]
Fix some misspellings of XTARGET.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80598 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoMark test as passing on all x86, which it should,
Dale Johannesen [Mon, 31 Aug 2009 17:49:20 +0000 (17:49 +0000)]
Mark test as passing on all x86, which it should,
although I don't think anyone cares about this
feature except Darwin.  PR 4825.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80596 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agocleanups pointed out by duncan
Chris Lattner [Mon, 31 Aug 2009 17:08:30 +0000 (17:08 +0000)]
cleanups pointed out by duncan

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80595 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoRevert commit 80428. It completely broke exception
Duncan Sands [Mon, 31 Aug 2009 16:45:16 +0000 (16:45 +0000)]
Revert commit 80428.  It completely broke exception
handling on x86-32 linux.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80592 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoFree the constants that have no uses in ~LLVMContext.
Torok Edwin [Mon, 31 Aug 2009 16:14:59 +0000 (16:14 +0000)]
Free the constants that have no uses in ~LLVMContext.
This fixes leaks from LLVMContext in multithreaded apps.
Since constants are only deleted if they have no uses, it is safe to not delete
a Module on shutdown, as many single-threaded tools do.
Multithreaded apps should however delete the Module before destroying the
Context to ensure that there are no leaks (assuming they use a different context
for each thread).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80590 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoFix ExplicitSymbols leak.
Torok Edwin [Mon, 31 Aug 2009 16:12:29 +0000 (16:12 +0000)]
Fix ExplicitSymbols leak.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80589 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoNormalize makefile comments and sort cmake file lists.
Benjamin Kramer [Mon, 31 Aug 2009 13:05:24 +0000 (13:05 +0000)]
Normalize makefile comments and sort cmake file lists.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80584 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agollvm-mc: Pass values to MCStreamer as MCExprs, not MCValues.
Daniel Dunbar [Mon, 31 Aug 2009 08:09:28 +0000 (08:09 +0000)]
llvm-mc: Pass values to MCStreamer as MCExprs, not MCValues.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80578 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agollvm-mc: Simplify EmitAssignment ('.set' is identical to '=').
Daniel Dunbar [Mon, 31 Aug 2009 08:09:09 +0000 (08:09 +0000)]
llvm-mc: Simplify EmitAssignment ('.set' is identical to '=').

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80577 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agollvm-mc: Remove MCAsmParser::Parse[Paren]RelocatableExpression.
Daniel Dunbar [Mon, 31 Aug 2009 08:08:50 +0000 (08:08 +0000)]
llvm-mc: Remove MCAsmParser::Parse[Paren]RelocatableExpression.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80576 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agollvm-mc: Switch MCInst to storing an MCExpr* instead of an MCValue.
Daniel Dunbar [Mon, 31 Aug 2009 08:08:38 +0000 (08:08 +0000)]
llvm-mc: Switch MCInst to storing an MCExpr* instead of an MCValue.

Also, use MCInst::print instead of custom code in MCAsmPrinter.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80575 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agollvm-mc: Add MCAsmParser::Parse[Paren]Expression forms which return an MCExpr.
Daniel Dunbar [Mon, 31 Aug 2009 08:08:17 +0000 (08:08 +0000)]
llvm-mc: Add MCAsmParser::Parse[Paren]Expression forms which return an MCExpr.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80574 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agollvm-mc: Make MCSymbolData symbol member const.
Daniel Dunbar [Mon, 31 Aug 2009 08:08:06 +0000 (08:08 +0000)]
llvm-mc: Make MCSymbolData symbol member const.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80573 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agollvm-mc: Add MCContext to MCAssembler.
Daniel Dunbar [Mon, 31 Aug 2009 08:07:55 +0000 (08:07 +0000)]
llvm-mc: Add MCContext to MCAssembler.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80572 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agollvm-mc: Add MCAsmParser::getContext.
Daniel Dunbar [Mon, 31 Aug 2009 08:07:44 +0000 (08:07 +0000)]
llvm-mc: Add MCAsmParser::getContext.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80571 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agollvm-mc: Add MCExpr::{dump,print}.
Daniel Dunbar [Mon, 31 Aug 2009 08:07:33 +0000 (08:07 +0000)]
llvm-mc: Add MCExpr::{dump,print}.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80570 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agollvm-mc: Switch MCExpr construction to using static member functions, and taking...
Daniel Dunbar [Mon, 31 Aug 2009 08:07:22 +0000 (08:07 +0000)]
llvm-mc: Switch MCExpr construction to using static member functions, and taking the MCContext (which now owns all MCExprs).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80569 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agollvm-mc: Add some doxyment markers.
Daniel Dunbar [Mon, 31 Aug 2009 08:07:08 +0000 (08:07 +0000)]
llvm-mc: Add some doxyment markers.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80568 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agollvm-mc: Move AsmExpr into MC lib (as MCExpr).
Daniel Dunbar [Mon, 31 Aug 2009 08:06:59 +0000 (08:06 +0000)]
llvm-mc: Move AsmExpr into MC lib (as MCExpr).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80567 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoStep #1 to giving Callgraph some sane invariants. The problems with callgraph
Chris Lattner [Mon, 31 Aug 2009 07:23:46 +0000 (07:23 +0000)]
Step #1 to giving Callgraph some sane invariants.  The problems with callgraph
stem from the fact that we have two types of passes that need to update it:

1. callgraphscc and module passes that are explicitly aware of it
2. Functionpasses (and loop passes etc) that are interlaced with CGSCC passes
   by the CGSCC Passmgr.

In the case of #1, we can reasonably expect the passes to update the call
graph just like any analysis.  However, functionpasses are not and generally
should not be CG aware.  This has caused us no end of problems, so this takes
a new approach.  Logically, the CGSCC Pass manager can rescan every function
after it runs a function pass over it to see if the functionpass made any
updates to the IR that affect the callgraph.  This allows it to catch new calls
introduced by the functionpass.

In practice, doing this would be slow.  This implementation keeps track of
whether or not the current scc is dirtied by a function pass, and, if so,
delays updating the callgraph until it is actually needed again.  This was
we avoid extraneous rescans, but we still have good invariants when the
callgraph is needed.

Step #2 of the "give Callgraph some sane invariants" is to change CallGraphNode
to use a CallBackVH for the callsite entry of the CallGraphNode.  This way
we can immediately remove entries from the callgraph when a FunctionPass is
active instead of having dangling pointers.  The current pass tries to tolerate
these dangling pointers, but it is just an evil hack.

This is related to PR3601/4835/4029.  This also reverts r80541, a hack working
around the sad lack of invariants.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80566 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agofix some cases where instcombine would change hte IR but not return true
Chris Lattner [Mon, 31 Aug 2009 06:57:37 +0000 (06:57 +0000)]
fix some cases where instcombine would change hte IR but not return true
from runOnFunction

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80562 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agocleanups, factor some code out to a helper function
Chris Lattner [Mon, 31 Aug 2009 06:01:21 +0000 (06:01 +0000)]
cleanups, factor some code out to a helper function

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80542 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agofix a crash building SPASS by tolerating a callsite that doesn't exist
Chris Lattner [Mon, 31 Aug 2009 05:46:59 +0000 (05:46 +0000)]
fix a crash building SPASS by tolerating a callsite that doesn't exist
in the callgraph, see the big comment at the top of the testcase.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80541 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agocomment and simplify some code.
Chris Lattner [Mon, 31 Aug 2009 05:34:32 +0000 (05:34 +0000)]
comment and simplify some code.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80540 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoadd -debug output
Chris Lattner [Mon, 31 Aug 2009 05:22:48 +0000 (05:22 +0000)]
add -debug output

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80539 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoimprove -debug output, so that -debug is more likely to print when
Chris Lattner [Mon, 31 Aug 2009 05:17:58 +0000 (05:17 +0000)]
improve -debug output, so that -debug is more likely to print when
instcombine is changing stuff.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80538 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agofix a bug I introduced with my 'instcombine builder' refactoring
Chris Lattner [Mon, 31 Aug 2009 04:36:22 +0000 (04:36 +0000)]
fix a bug I introduced with my 'instcombine builder' refactoring
changes: SimplifyDemandedBits can't use the builder yet because it
has the wrong insertion point.  This fixes a crash building
MultiSource/Benchmarks/PAQ8p

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80537 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agosimplify some code by making the SCCNodes set contain Function*'s
Chris Lattner [Mon, 31 Aug 2009 04:09:04 +0000 (04:09 +0000)]
simplify some code by making the SCCNodes set contain Function*'s
instead of CallGraphNode*'s.  This also papers over a callgraph
problem where a pass (in this case, MemCpyOpt) introduces a new
function into the module (llvm.memset.i64) but doesn't add it to
the call graph (nor should it, since it is a function pass).

While it might be a good idea for MemCpyOpt to not synthesize
functions in a runOnFunction(), there is no need for FunctionAttrs
to be boneheaded, so fix it there.  This fixes an assertion building
176.gcc.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80535 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoonly print the override triple if it exists!
Chris Lattner [Mon, 31 Aug 2009 03:22:35 +0000 (03:22 +0000)]
only print the override triple if it exists!

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80534 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoFix PR4834, a tricky case where the inliner would resolve an
Chris Lattner [Mon, 31 Aug 2009 03:15:49 +0000 (03:15 +0000)]
Fix PR4834, a tricky case where the inliner would resolve an
indirect function pointer, inline it, then go to delete the body.
The problem is that the callgraph had other references to the function,
though the inliner had no way to know it, so we got a dangling pointer
and an invalid iterator out of the deal.

The fix to this is pretty simple: stop the inliner from deleting the
function by knowing that there are references to it.  Do this by making
CallGraphNodes contain a refcount.  This requires moving deletion of
available_externally functions to the module-level cleanup sweep where
it belongs.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80533 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agouse an accessor instead of poking internals of a node.
Chris Lattner [Mon, 31 Aug 2009 02:24:20 +0000 (02:24 +0000)]
use an accessor instead of poking internals of a node.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80532 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoCMake: updated library dependencies.
Oscar Fuentes [Mon, 31 Aug 2009 01:58:50 +0000 (01:58 +0000)]
CMake: updated library dependencies.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80531 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoPR4747
Jim Grosbach [Mon, 31 Aug 2009 01:35:03 +0000 (01:35 +0000)]
PR4747

Shared landing pads run into trouble with SJLJ, as the dispatch table is
mapped to call sites, and merging the pads will throw that off. There needs
to be a one-to-one mapping of landing pad exception table entries to invoke
call points.

Detecting the shared pad during lowering of SJLJ info insn't sufficient, as
the dispatch function may still need separate destinations to properly
handle phi-nodes.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80530 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoupdate unit test for previous change.
Chris Lattner [Mon, 31 Aug 2009 00:28:46 +0000 (00:28 +0000)]
update unit test for previous change.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80528 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoFix some nasty callgraph dangling pointer problems in
Chris Lattner [Mon, 31 Aug 2009 00:19:58 +0000 (00:19 +0000)]
Fix some nasty callgraph dangling pointer problems in
argpromotion and structretpromote.  Basically, when replacing
a function, they used the 'changeFunction' api which changes
the entry in the function map (and steals/reuses the callgraph
node).

This has some interesting effects: first, the problem is that it doesn't
update the "callee" edges in any callees of the function in the call graph.
Second, this covers for a major problem in all the CGSCC pass stuff, which
is that it is completely broken when functions are deleted if they *don't*
reuse a CGN.  (there is a cute little fixme about this though :).

This patch changes the protocol that CGSCC passes must obey: now the CGSCC
pass manager copies the SCC and preincrements its iterator to avoid passes
invalidating it.  This allows CGSCC passes to mutate the current SCC.  However
multiple passes may be run on that SCC, so if passes do this, they are now
required to *update* the SCC to be current when they return.

Other less interesting parts of this patch are that it makes passes update
the CG more directly, eliminates changeFunction, and requires clients of
replaceCallSite to specify the new callee CGN if they are changing it.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80527 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoFix header comment for bindings/ocaml/llvm/Makefile.
Erick Tryzelaar [Sun, 30 Aug 2009 23:41:20 +0000 (23:41 +0000)]
Fix header comment for bindings/ocaml/llvm/Makefile.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80526 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoMake sure we specify no arguments for context functions.
Erick Tryzelaar [Sun, 30 Aug 2009 23:38:06 +0000 (23:38 +0000)]
Make sure we specify no arguments for context functions.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80525 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoadd a dump() method on callgraph.
Chris Lattner [Sun, 30 Aug 2009 22:24:32 +0000 (22:24 +0000)]
add a dump() method on callgraph.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80524 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agorename test
Chris Lattner [Sun, 30 Aug 2009 22:14:17 +0000 (22:14 +0000)]
rename test

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80523 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agomerge all sinking tests into one and convert them to filecheck.
Chris Lattner [Sun, 30 Aug 2009 22:13:26 +0000 (22:13 +0000)]
merge all sinking tests into one and convert them to filecheck.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80522 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoconvert scalar_promote to filecheck style and merge 2003-12-13-VolatilePromote.ll...
Chris Lattner [Sun, 30 Aug 2009 22:08:19 +0000 (22:08 +0000)]
convert scalar_promote to filecheck style and merge 2003-12-13-VolatilePromote.ll into it.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80521 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoeliminate some uses of prcontext. Any help here would be appreciated :)
Chris Lattner [Sun, 30 Aug 2009 21:45:23 +0000 (21:45 +0000)]
eliminate some uses of prcontext.  Any help here would be appreciated :)

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80520 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agorename test so that name reflects what it is testing for.
Chris Lattner [Sun, 30 Aug 2009 21:36:39 +0000 (21:36 +0000)]
rename test so that name reflects what it is testing for.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80519 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoconvert to filecheck format.
Chris Lattner [Sun, 30 Aug 2009 21:36:06 +0000 (21:36 +0000)]
convert to filecheck format.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80518 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agosuck a bunch more gep tests into getelementptr.ll and filecheckize them all.
Chris Lattner [Sun, 30 Aug 2009 21:31:34 +0000 (21:31 +0000)]
suck a bunch more gep tests into getelementptr.ll and filecheckize them all.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80517 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoTweak comment.
Daniel Dunbar [Sun, 30 Aug 2009 21:14:05 +0000 (21:14 +0000)]
Tweak comment.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80516 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoFix some possible-use-of-uninitialized warnings.
Daniel Dunbar [Sun, 30 Aug 2009 21:13:58 +0000 (21:13 +0000)]
Fix some possible-use-of-uninitialized warnings.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80515 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoconsolodate various GEP tests into getelementptr.ll using filecheck.
Chris Lattner [Sun, 30 Aug 2009 21:02:36 +0000 (21:02 +0000)]
consolodate various GEP tests into getelementptr.ll using filecheck.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80514 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoanother huge testcase, this time from 'gs' in llvm-test.
Chris Lattner [Sun, 30 Aug 2009 21:02:02 +0000 (21:02 +0000)]
another huge testcase, this time from 'gs' in llvm-test.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80513 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoremove another poorly-reduced testcase which came from ldecod in llvm-test.
Chris Lattner [Sun, 30 Aug 2009 21:01:14 +0000 (21:01 +0000)]
remove another poorly-reduced testcase which came from ldecod in llvm-test.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80512 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agothis testcase is 500 lines long and is distilled from bzip2, just
Chris Lattner [Sun, 30 Aug 2009 21:00:11 +0000 (21:00 +0000)]
this testcase is 500 lines long and is distilled from bzip2, just
remove it.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80511 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoconvert to filecheck
Chris Lattner [Sun, 30 Aug 2009 20:48:15 +0000 (20:48 +0000)]
convert to filecheck

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80510 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoFix PR4748: don't fold gep(bitcast(x)) into bitcast(gep) when x
Chris Lattner [Sun, 30 Aug 2009 20:38:21 +0000 (20:38 +0000)]
Fix PR4748:  don't fold gep(bitcast(x)) into bitcast(gep) when x
is itself a bitcast.  Since we have gep(bitcast(bitcast(y))) in this
case, just wait for the two bitcasts to get zapped.  This prevents
instcombine from confusing some aliasing stuff, and allows it to
directly eliminate the load in the testcase.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80508 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agomisc cleanup
Chris Lattner [Sun, 30 Aug 2009 20:36:46 +0000 (20:36 +0000)]
misc cleanup

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80507 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoadd getPointerAddressSpace() to GEP instruction, use the method
Chris Lattner [Sun, 30 Aug 2009 20:06:40 +0000 (20:06 +0000)]
add getPointerAddressSpace() to GEP instruction, use the method
in a few scalar xforms to simplify things.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80506 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoeliminate InsertCastBefore, use the builder instead.
Chris Lattner [Sun, 30 Aug 2009 20:01:10 +0000 (20:01 +0000)]
eliminate InsertCastBefore, use the builder instead.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80505 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoeliminate InsertBitCastBefore, just use the builder instead.
Chris Lattner [Sun, 30 Aug 2009 19:47:22 +0000 (19:47 +0000)]
eliminate InsertBitCastBefore, just use the builder instead.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80504 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoadd a "getPointerAddressSpace" helper method to LoadInst and StoreInst.
Chris Lattner [Sun, 30 Aug 2009 19:45:21 +0000 (19:45 +0000)]
add a "getPointerAddressSpace" helper method to LoadInst and StoreInst.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80503 91177308-0d34-0410-b5e6-96231b3b80d8