Commit Graph

10706 Commits

Author SHA1 Message Date
Viktor Kutuzov 7dcca8f7fc Added two SubtargetFeatures::AddFeatures methods, which accept a comma-separated string or already parsed command line parameters as input, and some code re-factoring to use these new methods.
llvm-svn: 89516
2009-11-21 00:00:02 +00:00
David Goodwin 5305dc0be1 Restructure code to allow renaming of multiple-register groups for anti-dep breaking.
llvm-svn: 89511
2009-11-20 23:33:54 +00:00
Dan Gohman 7a6611793f Target-independent support for TargetFlags on BlockAddress operands,
and support for blockaddresses in x86-32 PIC mode.

llvm-svn: 89506
2009-11-20 23:18:13 +00:00
Sean Callanan c1f532e930 Recommitting PALIGNR shift width fixes.
Thanks to Daniel Dunbar for fixing clang intrinsics:
  http://llvm.org/viewvc/llvm-project?view=rev&revision=89499

llvm-svn: 89500
2009-11-20 22:28:42 +00:00
Sean Callanan 19d92728d0 Reverting PALIGNR fix until I figure out how this
broke the Clang testsuite.

llvm-svn: 89495
2009-11-20 22:09:28 +00:00
Sean Callanan fbed130173 Fixed PALIGNR to take 8-bit rotations in all cases.
Also fixed the corresponding testcase, and the PALIGNR
  intrinsic (tested for correctness with llvm-gcc).

llvm-svn: 89491
2009-11-20 21:40:28 +00:00
Dan Gohman fbffe63528 Make Loop::getLoopLatch() work on loops which don't have preheaders, as
it may be used in contexts where preheader insertion may have failed due
to an indirectbr.

Make LoopSimplify's LoopSimplify::SeparateNestedLoop properly fail in
the case that it would require splitting an indirectbr edge.

These fix PR5502.

llvm-svn: 89484
2009-11-20 20:51:18 +00:00
David Goodwin 80a03cc0b1 Remove some old experimental code that is no longer needed. Remove additional, speculative scheduling pass as its cost did not translate into significant performance improvement. Minor tweaks.
llvm-svn: 89471
2009-11-20 19:32:48 +00:00
Dan Gohman 20c8ab655e Fix fast-isel to avoid selecting the return instruction if a
tail call has been encountered.

llvm-svn: 89444
2009-11-20 02:51:26 +00:00
Jakob Stoklund Olesen 2bbeaa8774 Add MachineBasicBlock::getName, and use it in place of getBasicBlock()->getName.
Fix debug code that assumes getBasicBlock never returns NULL.

llvm-svn: 89428
2009-11-20 01:17:03 +00:00
Dan Gohman 94e617627d Extend CaptureTracking to indicate when a value is never stored, even
if it is not ultimately captured. Teach BasicAliasAnalysis that a 
local object address which does not escape and is never stored does
not alias with a value resulting from a load.

llvm-svn: 89398
2009-11-19 21:57:48 +00:00
Benjamin Kramer 1dfe1bead6 cstdlib is not automatically included with StringRef anymore.
llvm-svn: 89359
2009-11-19 16:08:04 +00:00
Benjamin Kramer 879f8c1382 Remove the now obsolete algorithm include from StringRef.h.
llvm-svn: 89354
2009-11-19 15:48:14 +00:00
Torok Edwin 5400cd9b8c Workaround PR5482, because all the gcc versions that I had were miscompiling StringRef:
4.2.4, 4.3.4, 4.4.2.
The workaround is to use a local min/max implementation that takes an integer
param, and not a reference to integer param (like std::min does).

llvm-svn: 89352
2009-11-19 15:39:50 +00:00
Edward O'Callaghan ba993b8add Add PS3 Triple class, Credit to John Thompson.
llvm-svn: 89339
2009-11-19 11:59:00 +00:00
Jim Grosbach cc69a1ba9a Make EliminateDuplicatePHINodes() available as a utility function
llvm-svn: 89297
2009-11-19 02:02:10 +00:00
Daniel Dunbar cf11886f1e Twine: Stores kinds as uchar instead of bitfield to be friendlier to the
optimizer.

llvm-svn: 89278
2009-11-19 00:04:43 +00:00
Jeffrey Yasskin c85e9c563a Remove spurious @verbatim. Patch by Timo Juhani Lindfors!
llvm-svn: 89252
2009-11-18 22:04:44 +00:00
Jakob Stoklund Olesen 9cbffd2155 Allow the machine verifier to be run outside the PassManager.
Verify LiveVariables information when present.

llvm-svn: 89241
2009-11-18 20:36:57 +00:00
Jakob Stoklund Olesen 520039fcb6 Remove the -early-coalescing option
llvm-svn: 89240
2009-11-18 20:36:47 +00:00
Viktor Kutuzov c3e2b6bcf5 Added getDefaultSubtargetFeatures method to SubtargetFeatures class which returns a correct feature string for given triple.
llvm-svn: 89236
2009-11-18 20:20:05 +00:00
Bob Wilson 290e9a47a9 Add a target hook to allow changing the tail duplication limit based on the
contents of the block to be duplicated.  Use this for ARM Cortex A8/9 to
be more aggressive tail duplicating indirect branches, since it makes it
much more likely that they will be predicted in the branch target buffer.
Testcase coming soon.

llvm-svn: 89187
2009-11-18 03:34:27 +00:00
Bill Wendling dfd8daaf61 The llvm-gcc front-end and the pass manager use two separate TargetData objects.
This is probably not confined to *just* these two things.

Anyway, the llvm-gcc front-end may look up the structure layout information for
an abstract type. That information will be stored into a table with the FE's
TD. Instruction combine can come along and also ask for information on that
abstract type, but for a separate TD (the one associated with the pass manager).

After the type is refined, the old structure layout information in the pass
manager's TD file is out of date. If a new type is allocated in the same space
as the old-unrefined type, then the structure type information in the pass
manager's TD file will be wrong, but won't know it.

Fix this by making the TD's structure type information an abstract type user.

llvm-svn: 89176
2009-11-18 01:03:56 +00:00
Dan Gohman 6a976bbcb7 Simplify ComputeMultiple so that it doesn't depend on TargetData.
llvm-svn: 89175
2009-11-18 00:58:27 +00:00
Devang Patel ee07075010 Remove dead code.
llvm-svn: 89156
2009-11-17 22:39:08 +00:00
Eric Christopher 700d08e18d Add ability to set code model within the execution engine builders
and creation interfaces.

llvm-svn: 89151
2009-11-17 21:58:16 +00:00
Evan Cheng 57be2f2c40 Add a WriteAsOperand for MachineBasicBlock so MachineLoopInfo dump looks sane.
llvm-svn: 89130
2009-11-17 19:19:59 +00:00
Viktor Kutuzov dafdd883bc Added getArchNameForAssembler method to the Triple class for which returns OS and Vendor independent target assembler arch.
llvm-svn: 89122
2009-11-17 18:48:27 +00:00
Nuno Lopes 6f6668cac2 add Case() with 5 args
llvm-svn: 89099
2009-11-17 15:35:39 +00:00
Duncan Sands 7a04e7df6d 1. Allow SCCIterator to work with GraphT types that are constant.
2.  Allow SCCIterator to work with inverse graphs.
3.  Fix an incorrect comment in GraphTraits.h (the type in the comment 
was given as GraphType* when it is actually const GraphType &).
Patch by Patrick Alexander Simmons.

llvm-svn: 89091
2009-11-17 10:54:25 +00:00
Duncan Sands 8b9336bd98 Following a suggestion of Daniel Dunbar, stop people passing the name
as the isSigned bool to CreateIntCast by having this resolve to a call
to a private method, rather than by using a gcc attribute.

llvm-svn: 89067
2009-11-17 08:34:52 +00:00
Lang Hames 48770eb61f Fixed call to wrong constructor.
llvm-svn: 89059
2009-11-17 07:19:50 +00:00
Jeffrey Yasskin 7c57c41d5f In GlobalVariable::setInitializer, assert that the initializer has the
right type.

llvm-svn: 89014
2009-11-17 00:43:13 +00:00
Eric Christopher dc679f88c8 Fix unused variables warnings.
llvm-svn: 88977
2009-11-16 22:34:32 +00:00
Dan Gohman f76945ff14 Revert 88957. This file uses CodeGenOpt, which is defined in TargetMachine.h.
llvm-svn: 88959
2009-11-16 20:45:50 +00:00
Dan Gohman 0bcda0d5bd Remove an unnecessary #include.
llvm-svn: 88957
2009-11-16 20:41:12 +00:00
Dan Gohman 93f529d514 Sink a #include <map> to where it's actually needed.
llvm-svn: 88956
2009-11-16 20:40:47 +00:00
Dan Gohman 4617f3e893 Make PseudoSourceValue's classof recognize
FixedStackPseudoSourceValueVal, to respect this isa relationship.

llvm-svn: 88954
2009-11-16 20:40:06 +00:00
Rafael Espindola 65e9be6dc2 Add configure options for specifying where to look for libstdc++.
llvm-svn: 88943
2009-11-16 19:46:55 +00:00
Douglas Gregor 16917aa19d Make ERROR_IF_USED macro work with GCC <= 4.2, Apple GCCs
llvm-svn: 88916
2009-11-16 16:56:48 +00:00
Duncan Sands 551861e7d9 Make sure that if anyone passes a name by accident for the isSigned
parameter of CreateIntCast then they get an error from the compiler
(or from the linker with a non-gcc compiler).  Another possibility
is to flip the order of the DestTy and isSigned parameters, since you
should then get a compiler warning if you try to use a char* for a
Type*.

llvm-svn: 88913
2009-11-16 15:28:17 +00:00
Chris Lattner ee4cf81d9a disable copying, enforce some invariants.
llvm-svn: 88870
2009-11-15 20:03:53 +00:00
Chris Lattner fb7613a5d6 mark getIntrinsicID() 'readonly'. This allows various classof methods
(like DbgDeclareInst's) to shrink substantially.  It sucks that we have
to pull Compiler.h into such a public header, but at least Compiler.h
doesn't pull anything else in.

llvm-svn: 88863
2009-11-15 19:56:28 +00:00
Chris Lattner f456ae74c8 add attributes for readnone/readonly functions.
llvm-svn: 88862
2009-11-15 19:54:31 +00:00
Chris Lattner 8938c85eb5 add a version of array_pod_sort that takes a custom comparator function.
llvm-svn: 88861
2009-11-15 19:52:43 +00:00
Edward O'Callaghan e3f3ca70e6 Add PSP OS Target to Triple, Credit to Bruno Cardoso Lopes.
llvm-svn: 88849
2009-11-15 10:18:17 +00:00
Jim Grosbach 9c8609ea1c Add function to replace a destination MBB in a single jump table
llvm-svn: 88804
2009-11-14 20:09:13 +00:00
Benjamin Kramer 69865cc1db Remove dead variable found by clang++.
llvm-svn: 88803
2009-11-14 19:51:20 +00:00
Benjamin Kramer 8c19a8f17b Implement DISABLE_INLINE for MSVC. This required changing the position in all
forward declaration and patching tblgen to emit it right. Patch by Amine Khaldi!

llvm-svn: 88798
2009-11-14 16:37:18 +00:00
Benjamin Kramer 56ffa48473 Make NORETURN working with MSVC. MSVC only accepts NORETURN in front of the
decl so move it there. GCC accepts it both in front and after decls.

llvm-svn: 88791
2009-11-14 14:14:58 +00:00
Daniel Dunbar 241d01b590 Add llvm::sys::getHostCPUName, for detecting the LLVM name for the host CPU.
- This is an initial step towards -march=native support in Clang, and towards
   eliminating host dependencies in the targets. See PR5389.

 - Patch by Roman Divacky!

llvm-svn: 88768
2009-11-14 10:09:12 +00:00
Evan Cheng 16797a1f55 Added getSubRegIndex(A,B) that returns subreg index of A to B. Use it to replace broken code in VirtRegRewriter.
llvm-svn: 88753
2009-11-14 03:42:17 +00:00
Evan Cheng 6ad7da96fe - Change TargetInstrInfo::reMaterialize to pass in TargetRegisterInfo.
- If destination is a physical register and it has a subreg index, use the
  sub-register instead.
This fixes PR5423.

llvm-svn: 88745
2009-11-14 02:55:43 +00:00
Dan Gohman 81132465d3 Add an option for running GVN with redundant load processing disabled.
llvm-svn: 88742
2009-11-14 02:27:51 +00:00
Lang Hames 6b7233afc6 Added an API to the SlotIndexes pass to allow new instructions to be inserted into the numbering.
PreAllocSplitting is now using this API to insert code.

llvm-svn: 88725
2009-11-14 00:02:51 +00:00
Dan Gohman 6e99014947 Move the FixedStackPseudoSourceValueVal enum value before InstructionVal
so that isa<Instructon> doesn't return true for FixedStackPseudoSourceValue
values. This fixes a variety of problems, including crashes with -debug
and -print-machineinstrs. Also, add a comment to warn about this.

llvm-svn: 88711
2009-11-13 22:24:13 +00:00
Jakob Stoklund Olesen 27440e71fc Add MachineFunction::verify() to call the machine code verifier directly.
llvm-svn: 88706
2009-11-13 21:56:09 +00:00
Dan Gohman 7474546e4d Use .data() instead of .c_str() when nul-termination is not needed.
llvm-svn: 88703
2009-11-13 21:55:31 +00:00
Devang Patel 452c1646c6 Do not use value handle to wrap MDNode in DIDescriptor.
llvm-svn: 88700
2009-11-13 21:45:04 +00:00
David Goodwin b9fe5d5d02 Allow target to specify regclass for which antideps will only be broken along the critical path.
llvm-svn: 88682
2009-11-13 19:52:48 +00:00
David Greene a32c214b23 Remove duplicate APIs and state WRT spill objects.
llvm-svn: 87106
2009-11-13 14:42:06 +00:00
Devang Patel 76a06074eb Revert r87059 for now. It is failing clang tests.
llvm-svn: 87070
2009-11-13 02:27:33 +00:00
Rafael Espindola 7c6854995d Switch to smallvector. Also fix issue with using unsigend for MaxSplit.
llvm-svn: 87068
2009-11-13 02:18:25 +00:00
Dale Johannesen 5f4eecf961 Adjust isConstantSplat to allow for big-endian targets.
PPC is such a target; make it work.

llvm-svn: 87060
2009-11-13 01:45:18 +00:00
Victor Hernandez 41e7648e09 Remove unnecessary llvm.dbg.declare bitcast
llvm-svn: 87059
2009-11-13 01:44:55 +00:00
Rafael Espindola d554e44092 Add a new split method to StringRef that puts the substrings in a vector.
llvm-svn: 87058
2009-11-13 01:24:40 +00:00
David Greene 2f4c37425b Fix a bootstrap failure.
Provide special isLoadFromStackSlotPostFE and isStoreToStackSlotPostFE
interfaces to explicitly request checking for post-frame ptr elimination
operands.  This uses a heuristic so it isn't reliable for correctness.

llvm-svn: 87047
2009-11-13 00:29:53 +00:00
David Greene 033d65581d Do some cleanups suggested by Chris.
llvm-svn: 87034
2009-11-12 21:49:55 +00:00
Daniel Dunbar 5fb4e7553c StringRef(const char*) should not be used to turn null pointers into empty
strings.

llvm-svn: 87031
2009-11-12 21:26:11 +00:00
Daniel Dunbar c71bf467d5 Remove my Value.h build fix.
llvm-svn: 87029
2009-11-12 21:07:02 +00:00
David Greene f3ecd97cd8 Fix a build error by providing a missing enum value.
llvm-svn: 87028
2009-11-12 21:04:19 +00:00
David Greene be851acfb0 Make the MachineFunction argument of getFrameRegister const.
This also fixes a build error.

llvm-svn: 87027
2009-11-12 21:00:03 +00:00
David Greene 70fdd57dc1 Add hasLoadFromStackSlot and hasStoreToStackSlot to return whether a
machine instruction loads or stores from/to a stack slot.  Unlike
isLoadFromStackSlot and isStoreFromStackSlot, the instruction may be
something other than a pure load/store (e.g. it may be an arithmetic
operation with a memory operand).  This helps AsmPrinter determine when
to print a spill/reload comment.

This is only a hint since we may not be able to figure this out in all
cases.  As such, it should not be relied upon for correctness.

Implement for X86.  Return false by default for other architectures.

llvm-svn: 87026
2009-11-12 20:55:29 +00:00
Daniel Dunbar 22b75873b9 Attempt to unbreak LLVM build, David G. please check.
llvm-svn: 87025
2009-11-12 20:53:56 +00:00
David Greene 1fbe054450 Add a bool flag to StackObjects telling whether they reference spill
slots.  The AsmPrinter will use this information to determine whether to
print a spill/reload comment.

Remove default argument values.  It's too easy to pass a wrong argument
value when multiple arguments have default values.  Make everything
explicit to trap bugs early.

Update all targets to adhere to the new interfaces..

llvm-svn: 87022
2009-11-12 20:49:22 +00:00
Benjamin Kramer 68e4945c03 Add compare_lower and equals_lower methods to StringRef. Switch all users of
StringsEqualNoCase (from StringExtras.h) to it.

llvm-svn: 87020
2009-11-12 20:36:59 +00:00
David Greene 81eb42d8ca Make FixedStackPseudoSourceValue a first-class PseudoSourceValue by
making it visible to clients and adding LLVM-style cast capability.
This will be used by AsmPrinter to determine when to emit spill comments
for an instruction.

llvm-svn: 87019
2009-11-12 20:25:07 +00:00
David Greene 815863f157 Add AsmPrinter comment flags to machine instructions so that AsmPrinter
can emit extra information in comments.

llvm-svn: 87018
2009-11-12 20:21:09 +00:00
David Greene 33935767b9 Add comment flags so AsmPrinter can output additional information when
emitting comments.  These flags carry semantic information not otherwise
easily derivable from the IR text.

llvm-svn: 87016
2009-11-12 20:13:34 +00:00
Devang Patel 2904aa9f6e "Attach debug info with llvm instructions" mode was enabled a month ago. Now make it permanent and remove old way of inserting intrinsics to encode debug info for line number and scopes.
llvm-svn: 87014
2009-11-12 19:02:56 +00:00
Dan Gohman 29271e7585 Mark DBG_LABEL, EH_LABEL, and GC_LABEL as not-duplicable, since
they really are not duplicable.

llvm-svn: 87009
2009-11-12 18:36:19 +00:00
Benjamin Kramer 3628bdab14 Silence a warning on targets with unsigned chars.
llvm-svn: 87002
2009-11-12 17:59:45 +00:00
Nuno Lopes 60d5b1cfdb implement shl, ashr, and lshr methods. shl is not fully implemented as it is quite tricky.
llvm-svn: 86986
2009-11-12 14:53:53 +00:00
Evan Cheng 85a9f430e9 - Teach LSR to avoid changing cmp iv stride if it will create an immediate that
cannot be folded into target cmp instruction.
- Avoid a phase ordering issue where early cmp optimization would prevent the
  later count-to-zero optimization.
- Add missing checks which could cause LSR to reuse stride that does not have
  users.
- Fix a bug in count-to-zero optimization code which failed to find the pre-inc
  iv's phi node.
- Remove, tighten, loosen some incorrect checks disable valid transformations.
- Quite a bit of code clean up.

llvm-svn: 86969
2009-11-12 07:35:05 +00:00
Evan Cheng 15b80e4a9f isLegalICmpImmediate should take a signed integer; code clean up.
llvm-svn: 86964
2009-11-12 07:13:11 +00:00
Oscar Fuentes 700205c49f CMake: Hopefully unbreak the build by mimicking the changes on the
other build system about the new C_INCLUDE_DIRS configure option.

llvm-svn: 86960
2009-11-12 06:48:09 +00:00
Rafael Espindola d95960be25 Add the --with-c-include-dirs to llvm's configure.
The clang patch is next.

llvm-svn: 86955
2009-11-12 05:46:09 +00:00
Oscar Fuentes d533e1d46b CMake: Pass -lm to check_symbol_exists for detecting several math
functions like floorf, ceilf, ... Add test for detecting nearbyintf.

This change was prompted by test/Transforms/SimplifyLibCalls/floor.ll

llvm-svn: 86954
2009-11-12 05:36:09 +00:00
Chris Lattner 565ee2f1bd Add a new getPredicateOnEdge method which returns more rich information for
constant constraints.  Improve the LVI lattice to include inequality 
constraints.

llvm-svn: 86950
2009-11-12 04:36:58 +00:00
Jim Grosbach 801b33b17c Move the utility function UpdateTerminator() from CodePlacementOpt() into
MachineBasicBlock so other passes can utilize it.

llvm-svn: 86947
2009-11-12 03:55:33 +00:00
Nick Lewycky 9f3e73b0f6 Add CreateNUWAdd and CreateNUWSub to complement the existing CreateNSWAdd and
CreateNSWSub functions.

llvm-svn: 86930
2009-11-12 02:08:11 +00:00
Chris Lattner d5e25436a1 expose edge information and switch j-t to use it.
llvm-svn: 86920
2009-11-12 01:29:10 +00:00
Devang Patel 862ef782de Do not use StringRef in DebugInfo interface.
This allows StringRef to skip controversial if(str) check in constructor.
Buildbots, wait for corresponding clang and llvm-gcc FE check-ins!

llvm-svn: 86914
2009-11-12 00:50:58 +00:00
Jakob Stoklund Olesen 4f7fd3baeb Fix liveness calculation when splitting critical edges during PHI elimination.
- Edges are split before any phis are eliminated, so the code is SSA.

- Create a proper IR BasicBlock for the split edges.

- LiveVariables::addNewBlock now has same syntax as
  MachineDominatorTree::addNewBlock. Algorithm calculates predecessor live-out
  set rather than successor live-in set.

This feature still causes some miscompilations.

llvm-svn: 86867
2009-11-11 19:31:31 +00:00
Devang Patel 717b246b19 Add SetDebugLocation() variant to
add debug info location to an instruction.

llvm-svn: 86859
2009-11-11 19:06:06 +00:00
Evan Cheng 3d3c24a82c Add TargetLowering::isLegalICmpImmediate. It tells LSR what immediate can be folded into target icmp instructions.
llvm-svn: 86858
2009-11-11 19:05:52 +00:00
Dan Gohman acc57b2446 Fix a copy+pasto in a comment.
llvm-svn: 86852
2009-11-11 18:14:02 +00:00
Duncan Sands ba61fed5d3 Don't trivially delete unused calls to llvm.invariant.start. This allows
llvm.invariant.start to be used without necessarily being paired with a call
to llvm.invariant.end.  If you run the entire optimization pipeline then such
calls are in fact deleted (adce does it), but that's actually a good thing since
we probably do want them to be zapped late in the game.  There should really be
an integration test that checks that the llvm.invariant.start call lasts long
enough that all passes that do interesting things with it get to do their stuff
before it is deleted.  But since no passes do anything interesting with it yet
this will have to wait for later.

llvm-svn: 86840
2009-11-11 15:34:13 +00:00
Chris Lattner 852f2653c4 remove the now dead condprop pass, PR3906.
llvm-svn: 86810
2009-11-11 05:56:35 +00:00
Daniel Dunbar 74bb710227 Add StringRef::split(StringRef), to complement StringRef::split(char).
llvm-svn: 86803
2009-11-11 05:19:11 +00:00
Chris Lattner fde1f8d0d8 stub out some LazyValueInfo interfaces, and have JumpThreading
start using them in a trivial way when -enable-jump-threading-lvi
is passed.  enable-jump-threading-lvi will be my playground for 
awhile.

llvm-svn: 86789
2009-11-11 02:08:33 +00:00
Daniel Dunbar 9169a37daf Add Triple::str() which returns the contents of the Triple as a string, as a more readable alternative to getTriple().
llvm-svn: 86773
2009-11-11 00:43:14 +00:00
Daniel Dunbar 9806e4ab20 Add From arguments to StringRef search functions, and tweak doxyments.
Also, add unittests for find_first_of and find_first_not_of.

llvm-svn: 86770
2009-11-11 00:28:53 +00:00
Chris Lattner 741c94c719 Stub out a new lazy value info pass, which will eventually
vend value constraint information to the optimizer.

llvm-svn: 86767
2009-11-11 00:22:30 +00:00
Chris Lattner c4e03b7ac7 remove redundant foward declaration. This function is already in
Analysis/Passes.h

llvm-svn: 86765
2009-11-11 00:21:21 +00:00
Chris Lattner 3835610902 jump threading does everything that condprop does any more. This passes
bootstrap on darwin i386.

llvm-svn: 86758
2009-11-10 23:54:10 +00:00
Devang Patel f6eeaebd76 Implement support to debug inlined functions.
llvm-svn: 86748
2009-11-10 23:06:00 +00:00
Chris Lattner a5056f5b2b in -dot-cfg and -dot-cfg-only, when rendering switch instructions,
put the switch value in the successor boxes like we put T/F for branches.

llvm-svn: 86747
2009-11-10 22:56:15 +00:00
Chris Lattner 852d6d64ff move some generally useful functions out of jump threading
into libanalysis and transformutils.

llvm-svn: 86735
2009-11-10 22:26:15 +00:00
Devang Patel 42c1d17dd1 Process InlinedAt location info.
Update InsertDeclare to return newly inserted llvm.dbg.declare intrinsic.

llvm-svn: 86727
2009-11-10 22:05:35 +00:00
Jakob Stoklund Olesen 4453dc976b Teach PHIElimination to split critical edges when -split-phi-edges is enabled.
Critical edges leading to a PHI node are split when the PHI source variable is
live out from the predecessor block. This help the coalescer eliminate more
PHI joins.

llvm-svn: 86725
2009-11-10 22:01:05 +00:00
Victor Hernandez fcc77b1c02 Update computeArraySize() to use ComputeMultiple() to determine the array size associated with a malloc; also extend PerformHeapAllocSRoA() to check if the optimized malloc's arg had its highest bit set, so that it is safe for ComputeMultiple() to look through sext instructions while determining the optimized malloc's array size
llvm-svn: 86676
2009-11-10 08:32:25 +00:00
Victor Hernandez 4744488e8d Add ComputeMultiple() analysis function that recursively determines if a Value V is a multiple of unsigned Base
llvm-svn: 86675
2009-11-10 08:28:35 +00:00
Chris Lattner cbd18fc93d refactor TryToSimplifyUncondBranchFromEmptyBlock out of SimplifyCFG.
llvm-svn: 86666
2009-11-10 05:59:26 +00:00
Chris Lattner fb7f87d5a3 add a new SimplifyInstruction API, which is like ConstantFoldInstruction,
except that the result may not be a constant.  Switch jump threading to 
use it so that it gets things like (X & 0) -> 0, which occur when phi preds
are deleted and the remaining phi pred was a zero.

llvm-svn: 86637
2009-11-10 01:08:51 +00:00
Jeffrey Yasskin b40d3f76a0 Fix DenseMap iterator constness.
This patch forbids implicit conversion of DenseMap::const_iterator to
DenseMap::iterator which was possible because DenseMapIterator inherited
(publicly) from DenseMapConstIterator. Conversion the other way around is now
allowed as one may expect.

The template DenseMapConstIterator is removed and the template parameter
IsConst which specifies whether the iterator is constant is added to
DenseMapIterator.

Actually IsConst parameter is not necessary since the constness can be
determined from KeyT but this is not relevant to the fix and can be addressed
later.

Patch by Victor Zverovich!

llvm-svn: 86636
2009-11-10 01:02:17 +00:00
Chris Lattner a71e9d61be factor simplification logic for AND and OR out to InstSimplify from instcombine.
llvm-svn: 86635
2009-11-10 00:55:12 +00:00
David Goodwin 0d412c2528 Fixed to address code review. No functional changes.
llvm-svn: 86634
2009-11-10 00:48:55 +00:00
Daniel Dunbar 124fc5e252 Fix MemoryBuffer::getSTDIN to *not* return null if stdin is empty, this is a lame API.
Also, Stringrefify some more MemoryBuffer functions, and add two performance FIXMEs.

llvm-svn: 86630
2009-11-10 00:43:58 +00:00
David Goodwin cf89db135e Allow targets to specify register classes whose member registers should not be renamed to break anti-dependencies.
llvm-svn: 86628
2009-11-10 00:15:47 +00:00
Chris Lattner c1f19071f8 rename SimplifyCompare -> SimplifyCmpInst and split it into
Simplify[IF]Cmp pieces.  Add some predicates to CmpInst to 
determine whether a predicate is fp or int.

llvm-svn: 86624
2009-11-09 23:28:39 +00:00
Chris Lattner cdfb80de16 fix ConstantFoldCompareInstOperands to take the LHS/RHS as
individual operands instead of taking a temporary array

llvm-svn: 86619
2009-11-09 23:06:58 +00:00
Daniel Dunbar 3f94a132dd Add StringSwitch::Cases overloads, for matching multiple strings to a single
value.

llvm-svn: 86618
2009-11-09 23:05:44 +00:00
Chris Lattner 084a1b5581 stub out a new libanalysis "instruction simplify" interface that
takes decimated instructions and applies identities to them.  This
is pretty minimal at this point, but I plan to pull some instcombine
logic out into these and similar routines.

llvm-svn: 86613
2009-11-09 22:57:59 +00:00
Jeffrey Yasskin 8483f12ac5 Remove dlsym stubs, with Nate Begeman's permission.
llvm-svn: 86606
2009-11-09 22:34:19 +00:00
Dan Gohman 2745d19287 Print "..." instead of all the uninteresting register clobbers on call
instructions. This makes CodeGen dumps significantly less noisy.

Example before:
  BL <ga:@bar>, %R0<imp-def>, %R1<imp-def,dead>, %R2<imp-def,dead>, %R3<imp-def,dead>, %R12<imp-def,dead>, %LR<imp-def,dead>, %D0<imp-def,dead>, %D1<imp-def,dead>, %D2<imp-def,dead>, %D3<imp-def,dead>, %D4<imp-def,dead>, %D5<imp-def,dead>, %D6<imp-def,dead>, %D7<imp-def,dead>, %D16<imp-def,dead>, %D17<imp-def,dead>, %D18<imp-def,dead>, %D19<imp-def,dead>, %D20<imp-def,dead>, %D21<imp-def,dead>, %D22<imp-def,dead>, %D23<imp-def,dead>, %D24<imp-def,dead>, %D25<imp-def,dead>, %D26<imp-def,dead>, %D27<imp-def,dead>, %D28<imp-def,dead>, %D29<imp-def,dead>, %D30<imp-def,dead>, %D31<imp-def,dead>, %CPSR<imp-def,dead>, %FPSCR<imp-def,dead>

Same example after:
  BL <ga:@bar>, %R0<imp-def>, %R1<imp-def,dead>, %LR<imp-def,dead>, %CPSR<imp-def,dead>, ...

llvm-svn: 86583
2009-11-09 19:38:45 +00:00
Dan Gohman 85b5bf833e Fix an 80-column violation.
llvm-svn: 86567
2009-11-09 18:20:38 +00:00
Dan Gohman 6f67f8902a Constify MachineFunctionAnalysis' TargetMachine reference.
llvm-svn: 86564
2009-11-09 18:18:49 +00:00
Dan Gohman 968ecd9888 Fix a comment.
llvm-svn: 86558
2009-11-09 17:06:51 +00:00
Dan Gohman 1c311a8cd7 Suppress implicit copy ctor and copy assignment for MachineFunction.
llvm-svn: 86557
2009-11-09 17:06:23 +00:00
Nuno Lopes 640eb70bee add zextOrTrunc and sextOrTrunc methods, that are similar to the ones in APInt
llvm-svn: 86549
2009-11-09 15:36:28 +00:00
Oscar Fuentes de8f431edf CMake: Detect gv, circo, twopi, neato, fdo, dot and dotty.
Patch by Arnaud Allard de Grandmaison!

llvm-svn: 86547
2009-11-09 15:26:40 +00:00
Chris Lattner 077166e3fa fix some bogus asserts, PR5049
llvm-svn: 86514
2009-11-09 04:47:27 +00:00
Lang Hames 09eeeaf08b Moved some ManagedStatics out of the SlotIndexes header.
llvm-svn: 86446
2009-11-08 08:49:59 +00:00
Daniel Dunbar cdfb315f16 Fix class -> struct tag.
llvm-svn: 86416
2009-11-07 23:21:30 +00:00
Chris Lattner 6fafd70c1e all targets should be required to declare legal integer types. My plan to
make it optional doesn't work out.  If you don't want to specify this, don't
specify a TD string at all.

llvm-svn: 86394
2009-11-07 18:53:00 +00:00
Anton Korobeynikov f93bb39b03 Add 8 bit libcalls and make use of them for msp430
llvm-svn: 86384
2009-11-07 17:14:39 +00:00
Chris Lattner a381effe72 add the ability for TargetData to return information about legal integer
datatypes on a given CPU.  This is intended to allow instcombine and other
transformations to avoid converting big sequences of operations to an
inconvenient width, and will help clean up after SRoA.  See also "Adding 
legal integer sizes to TargetData" on Feb 1, 2009 on llvmdev, and PR3451.

Comments welcome.

llvm-svn: 86370
2009-11-07 09:35:34 +00:00
Chris Lattner 91f9582fe1 more cleanup.
llvm-svn: 86369
2009-11-07 09:23:04 +00:00
Chris Lattner f819398067 rewrite TargetData to use StringRef/raw_ostream instead of thrashing std::strings.
llvm-svn: 86366
2009-11-07 09:13:23 +00:00
Jeffrey Yasskin db5f24ce77 Make the need-stub variables accurate and consistent. In the case of
MachineRelocations, "stub" always refers to a far-call stub or a
load-a-faraway-global stub, so this patch adds "Far" to the term. (Other stubs
are used for lazy compilation and dlsym address replacement.) The variable was
also inconsistent between the positive and negative sense, and the positive
sense ("NeedStub") was more demanding than is accurate (since a nearby-enough
function can be called directly even if the platform often requires a stub).
Since the negative sense causes double-negatives, I switched to
"MayNeedFarStub" globally.

llvm-svn: 86363
2009-11-07 08:51:52 +00:00
Mikhail Glushenkov 0fa9474836 llvmc: Add a '-time' option.
llvm-svn: 86348
2009-11-07 06:33:58 +00:00
Mikhail Glushenkov b53593d320 80-col violation.
llvm-svn: 86346
2009-11-07 06:33:01 +00:00
Lang Hames bc247dce4d Update some globals to use ManagedStatic.
llvm-svn: 86342
2009-11-07 05:50:28 +00:00
Evan Cheng 16e1c31da2 Missed this.
llvm-svn: 86331
2009-11-07 04:07:30 +00:00
Kenneth Uildriks 07119737aa Add code to check at SelectionDAGISel::LowerArguments time to see if return values can be lowered to registers. Coming soon, code to perform sret-demotion if return values cannot be lowered to registers
llvm-svn: 86324
2009-11-07 02:11:54 +00:00
Jakob Stoklund Olesen 4141d8ee92 Fix inverted conflict test in -early-coalesce.
A non-identity copy cannot be coalesced when the phi join destination register
is live at the copy site.

Also verify the condition that the PHI join source register is only used in
the PHI join. Otherwise the coalescing is invalid.

llvm-svn: 86322
2009-11-07 01:58:40 +00:00
Victor Hernandez f3db915294 Re-commit r86077 now that r86290 fixes the 179.art and 175.vpr ARM regressions.
Here is the original commit message:

This commit updates malloc optimizations to operate on malloc calls that have constant int size arguments.

Update CreateMalloc so that its callers specify the size to allocate:
MallocInst-autoupgrade users use non-TargetData-computed allocation sizes.
Optimization uses use TargetData to compute the allocation size.

Now that malloc calls can have constant sizes, update isArrayMallocHelper() to use TargetData to determine the size of the malloced type and the size of malloced arrays.
Extend getMallocType() to support malloc calls that have non-bitcast uses.

Update OptimizeGlobalAddressOfMalloc() to optimize malloc calls that have non-bitcast uses.  The bitcast use of a malloc call has to be treated specially here because the uses of the bitcast need to be replaced and the bitcast needs to be erased (just like the malloc call) for OptimizeGlobalAddressOfMalloc() to work correctly.

Update PerformHeapAllocSRoA() to optimize malloc calls that have non-bitcast uses.  The bitcast use of the malloc is not handled specially here because ReplaceUsesOfMallocWithGlobal replaces through the bitcast use.

Update OptimizeOnceStoredGlobal() to not care about the malloc calls' bitcast use.

Update all globalopt malloc tests to not rely on autoupgraded-MallocInsts, but instead use explicit malloc calls with correct allocation sizes.

llvm-svn: 86311
2009-11-07 00:16:28 +00:00
Daniel Dunbar ad36e8aceb Pass StringRef by value.
llvm-svn: 86251
2009-11-06 10:58:06 +00:00
Chris Lattner 8c12bb8cd7 remove some more Context arguments.
llvm-svn: 86235
2009-11-06 05:59:53 +00:00
Chris Lattner 46b5c642b9 remove a bunch of extraneous LLVMContext arguments
from various APIs, addressing PR5325.

llvm-svn: 86231
2009-11-06 04:27:31 +00:00
Victor Hernandez b9f5899779 Revert r86077 because it caused crashes in 179.art and 175.vpr on ARM
llvm-svn: 86213
2009-11-06 01:33:24 +00:00
Douglas Gregor 140db51755 Add a bunch of missing "template" keywords to disambiguate dependent template names. GCC eats this ill-formed code, Clang does not. I already filed PR5404 to improve recovery in this case
llvm-svn: 86204
2009-11-06 00:12:53 +00:00
Eric Christopher 80f04dc67d Fix PR5315, original patch by Nicolas Capens!
llvm-svn: 86203
2009-11-06 00:11:57 +00:00
Dan Gohman 6791639910 Make printImplicitDef and printKill non-virtual, since they don't
need to be overridden.

llvm-svn: 86198
2009-11-06 00:04:05 +00:00
Douglas Gregor 5632657208 Make a few more LLVM headers parsable as standalone headers.
Fix some problems with the hidden copy constructors for
ImmutableMap/ImmutableSet found by Clang++.

llvm-svn: 86186
2009-11-05 23:01:30 +00:00
Dan Gohman b632705017 InstrTypes.h includes Instruction.h, so it's not necessary to include both.
llvm-svn: 86162
2009-11-05 19:42:20 +00:00
Dan Gohman e3a1706e33 Factor out the predicate code for loopsimplify form exit blocks into
a separate helper function.

llvm-svn: 86159
2009-11-05 19:21:41 +00:00
Oscar Fuentes 17feb2a9ee CMake: Detect dotty.
Patch by Arnaud Allard de Grandmaison!

llvm-svn: 86153
2009-11-05 19:03:26 +00:00
Douglas Gregor e076030f0c Move llvm:🆑:opt's conversion function into the base classes that
actually need that conversion function. Silences a Clang++ warning.

llvm-svn: 86148
2009-11-05 18:30:50 +00:00
Chris Lattner a117dd23e9 Declare classes with matched tags, pointed out by a clang++ warning.
llvm-svn: 86144
2009-11-05 17:51:44 +00:00
Douglas Gregor 73818d685e Make two more LLVM headers standalone
llvm-svn: 86131
2009-11-05 13:39:23 +00:00
Douglas Gregor 9ad44629c3 Make a few headers standalone. Plus, add a missing "template" keyword
that Clang diagnoses but GCC does not.

llvm-svn: 86130
2009-11-05 13:30:28 +00:00
Mon P Wang 1a58236c2b Reintroduce support for overloading target intrinsics
llvm-svn: 86114
2009-11-05 03:19:08 +00:00
Lang Hames 274be49480 Tidied some ugliness in the SlotIndex default constructor.
llvm-svn: 86097
2009-11-05 01:18:31 +00:00
Lang Hames a31fd78ff8 Removed an assert which was causing significant slowdowns in debug builds.
This assert was very conservative to begin with (the error condition is well
covered by tests elsewhere in the code) so we won't miss much by removing it.

llvm-svn: 86088
2009-11-05 00:52:28 +00:00
Victor Hernandez 492ed30a32 Update CreateMalloc so that its callers specify the size to allocate:
MallocInst-autoupgrade users use non-TargetData-computed allocation sizes.
Optimization uses use TargetData to compute the allocation size.

Now that malloc calls can have constant sizes, update isArrayMallocHelper() to use TargetData to determine the size of the malloced type and the size of malloced arrays.
Extend getMallocType() to support malloc calls that have non-bitcast uses.

Update OptimizeGlobalAddressOfMalloc() to optimize malloc calls that have non-bitcast uses.  The bitcast use of a malloc call has to be treated specially here because the uses of the bitcast need to be replaced and the bitcast needs to be erased (just like the malloc call) for OptimizeGlobalAddressOfMalloc() to work correctly.

Update PerformHeapAllocSRoA() to optimize malloc calls that have non-bitcast uses.  The bitcast use of the malloc is not handled specially here because ReplaceUsesOfMallocWithGlobal replaces through the bitcast use.

Update OptimizeOnceStoredGlobal() to not care about the malloc calls' bitcast use.

Update all globalopt malloc tests to not rely on autoupgraded-MallocInsts, but instead use explicit malloc calls with correct allocation sizes.

llvm-svn: 86077
2009-11-05 00:03:03 +00:00
Lang Hames 289b8a2bd9 Handle empty/tombstone keys for LiveIndex more cleanly. Check for index sanity when constructing index list entries.
llvm-svn: 86049
2009-11-04 21:24:15 +00:00
Jakob Stoklund Olesen c7cfc94bcc Print out an informative comment for KILL instructions.
The KILL pseudo-instruction may survive to the asm printer pass, just like the IMPLICIT_DEF. Print the KILL as a comment instead of just leaving a blank line in the output.

With -asm-verbose=0, a blank line is printed, like IMPLICIT?DEF.

llvm-svn: 86041
2009-11-04 19:24:37 +00:00
Chris Lattner 0fc4311f0e make IRBuilder zap "X|0" and "X&-1" when building IR, this happens
during bitfield codegen and slows down -O0 compile times by making
useless IR.  rdar://7362516

llvm-svn: 86006
2009-11-04 05:00:12 +00:00
Evan Cheng 2969877eea Silence implicit conversion warnings.
llvm-svn: 86000
2009-11-04 03:08:57 +00:00
Lang Hames 88fa1e6c01 Another spurious friend declaration removed.
llvm-svn: 85997
2009-11-04 01:52:40 +00:00
Lang Hames cd72c7b2b6 Removed an unnecessary friend declaration and some crufty comments from IndexListEntry.
llvm-svn: 85995
2009-11-04 01:34:22 +00:00
Lang Hames 05fb9637f6 The Indexes Patch.
This introduces a new pass, SlotIndexes, which is responsible for numbering
instructions for register allocation (and other clients). SlotIndexes numbering
is designed to match the existing scheme, so this patch should not cause any
changes in the generated code.

For consistency, and to avoid naming confusion, LiveIndex has been renamed
SlotIndex.

The processImplicitDefs method of the LiveIntervals analysis has been moved
into its own pass so that it can be run prior to SlotIndexes. This was
necessary to match the existing numbering scheme.

llvm-svn: 85979
2009-11-03 23:52:08 +00:00
David Goodwin 8501dbbe10 Do a scheduling pass ignoring anti-dependencies to identify candidate registers that should be renamed.
llvm-svn: 85939
2009-11-03 20:57:50 +00:00
Chris Lattner d697debebf turn IPSCCP back on by default, try #3 or 4? Woo.
llvm-svn: 85929
2009-11-03 19:35:13 +00:00
Kenneth Uildriks 26393d8792 Added a comment to a function that had none
llvm-svn: 85899
2009-11-03 15:25:20 +00:00
Duncan Sands 2e59fc5c5a Run the functionattrs pass after the inliner, and not before.
This makes both logical sense (see below) and increases the
number of functions marked readnone/readonly by about 1-2%
in practice.  The number of functions marked nocapture goes
up by about 5-10%.  The reason it makes sense is shown by
the following example: if you run -functionattrs -inline on
it, then no attributes are assigned.  But if you instead run
-inline -functionattrs then @f is marked readnone because the
simplifications produced by the inliner eliminate the store.

@x = external global i32

define void @w(i1 %b) {
        br i1 %b, label %write, label %return
write:
        store i32 1, i32 *@x
        br label %return
return:
        ret void
}

define void @f() {
        call void @w(i1 0)
        ret void
}

llvm-svn: 85893
2009-11-03 09:40:08 +00:00
Daniel Dunbar 7e4a9e18c4 Speculatively redisable IPSCCP, I think its still breaking things.
llvm-svn: 85884
2009-11-03 07:49:22 +00:00
Chris Lattner fb14181b18 turn IPSCCP back on now that the iterator invalidation bug is fixed.
llvm-svn: 85858
2009-11-03 03:42:51 +00:00
Nate Begeman 26bb8a730d Add a couple more target nodes
llvm-svn: 85857
2009-11-03 03:30:51 +00:00
Chris Lattner a15cc59dcb revert r8579[56], which are causing unhappiness in buildbot land.
llvm-svn: 85818
2009-11-02 19:31:10 +00:00
Chris Lattner 879e05ab1f now that ip sccp *really* subsumes ipcp, remove ipcp again.
llvm-svn: 85796
2009-11-02 07:34:29 +00:00
Evan Cheng ea68c7c9a8 Add PseudoSourceValue::mayAlias. It returns true if the object can ever alias any LLVM IR value.
llvm-svn: 85762
2009-11-01 23:50:04 +00:00
Chris Lattner ef94654363 fix two strange things in the default passmgr:
1. we'd run simplifycfg at the very start, even though
the per function passes have already cleaned this up.

2. In the main per-function pipeline that is interlaced with inlining 
   etc, we would do instcombine, jump threading, simplifycfg *before*
   doing SROA.  SROA is much more likely to expose opportunities for
   these passes than they are for SROA, so move SRoA up earlier.

also add some comments.

llvm-svn: 85742
2009-11-01 20:41:59 +00:00
Chris Lattner 2805f116f6 IPSCCP apparently is not a superset of IPCP, this is bad,
but I'll investigate it separately.  This unbreaks 
test/FrontendC/weak_constant.c

llvm-svn: 85735
2009-11-01 19:29:12 +00:00
Duncan Sands f5e4342f45 Improve the other instance of the comment.
llvm-svn: 85733
2009-11-01 19:16:21 +00:00
Chris Lattner 649f4e9e8f only run GlobalDCE at -O3 and run it late instead of early.
GlobalOpt already deletes trivially dead functions/globals,
so GlobalDCE only adds values for cycles of dead things.

llvm-svn: 85731
2009-11-01 19:09:12 +00:00
Chris Lattner 2fa61f8427 We currently only run ipsccp at LTO time, which is silly. It subsumes
ipconstprop and doesn't take much time.  Just run it in its place.

This adds a testcase for it, which I plan to expand to cover other
"integration" cases, where we expect the optimizer to be able to
eliminate various things.  Due to phase order issues we've regressed
in a number of areas and integration tests are the only way I see to
prevent this.

llvm-svn: 85729
2009-11-01 18:57:49 +00:00
Chris Lattner 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
Chris Lattner 253bc77513 the verifier shouldn't modify the IR.
llvm-svn: 85722
2009-11-01 18:11:50 +00:00
Douglas Gregor 291f6145b8 Reverting 85714, 85715, 85716, which are breaking the build
llvm-svn: 85717
2009-11-01 16:42:53 +00:00
Dan Gohman 2b12b95d5d Add a function to Passes.h to allow clients to create instances
of the ScalarEvolution pass without needing to #include ScalarEvolution.h.

llvm-svn: 85716
2009-11-01 15:28:36 +00:00
Dan Gohman b49c889d53 Don't #include Pass.h from CallGraph.h.
llvm-svn: 85715
2009-11-01 15:23:35 +00:00
Dan Gohman 576ac96367 Remove the #include of Pass.h from PassManager.h. This breaks a significant
#include dependency, as frontends commonly pull in PassManager.h.

llvm-svn: 85714
2009-11-01 15:20:19 +00:00
Chris Lattner 274717419c fix an issue where the verifier would reject a function whose entry
block had its address taken even if the blockaddress was dead.

llvm-svn: 85706
2009-11-01 04:08:01 +00:00
Chris Lattner aa99c94e2a Revert 85678/85680. The decision is to stay with the current form of
indirectbr, thus we don't need "blockaddr(@func, null)".  Eliminate it
for simplicity.

llvm-svn: 85699
2009-11-01 01:27:45 +00:00
Chris Lattner ba364b0a9a update the comment above llvm::SplitCriticalEdge, and make
it abort on IndirectBrInst as describe in the comment.

llvm-svn: 85688
2009-10-31 21:51:10 +00:00
Chris Lattner b2c0e243c5 Make blockaddress(@func, null) be valid, and make 'deleting a basic
block with a blockaddress still referring to it' replace the invalid 
blockaddress with a new blockaddress(@func, null) instead of a 
inttoptr(1).

This changes the bitcode encoding format, and still needs codegen 
support (this should produce a non-zero value, referring to the entry
block of the function would also be quite reasonable).

llvm-svn: 85678
2009-10-31 20:08:37 +00:00
Dan Gohman 2d02ff8cbb Revert r85667. LoopUnroll currently can't call utility functions which
auto-update the DominatorTree because it doesn't keep the DominatorTree
current while it works.

llvm-svn: 85670
2009-10-31 17:33:01 +00:00
Dan Gohman 041e2dbad1 Merge the enhancements from LoopUnroll's FoldBlockIntoPredecessor into
MergeBlockIntoPredecessor. This makes SimplifyCFG slightly more aggressive,
and makes it unnecessary for LoopUnroll to have its own copy of this code.

llvm-svn: 85667
2009-10-31 16:08:00 +00:00
Dan Gohman 880c92ac1c Rename forgetLoopBackedgeTakenCount to forgetLoop, because it
clears out more information than just the stored backedge taken count.

llvm-svn: 85664
2009-10-31 15:04:55 +00:00
Dan Gohman fb7f0e57b6 Remove CodeGenLICM. It's largely obsoleted by MachineLICM's new ability
to unfold loop-invariant loads.

llvm-svn: 85657
2009-10-31 14:35:41 +00:00
Chris Lattner 74eb5d71a3 make hasAddressTaken() constant time by storing a refcount in BB's subclass data.
llvm-svn: 85625
2009-10-30 22:33:29 +00:00
Dan Gohman 49fa51d936 Fix MachineLICM to use the correct virtual register class when
unfolding loads for hoisting.  getOpcodeAfterMemoryUnfold returns the
opcode of the original operation without the load, not the load
itself, MachineLICM needs to know the operand index in order to get
the correct register class. Extend getOpcodeAfterMemoryUnfold to
return this information.

llvm-svn: 85622
2009-10-30 22:18:41 +00:00
Evan Cheng 5a6b9c40d6 Add option to createGVNPass to disable PRE.
llvm-svn: 85609
2009-10-30 20:12:24 +00:00
Evan Cheng 484dba893c Rather than having llvm-gcc changing the meaning of OptimizeSize, just make sure loop unswitch is conservative when optimization level is < 3.
llvm-svn: 85581
2009-10-30 07:23:49 +00:00
Dan Gohman 6c9388011b Initial target-independent CodeGen support for BlockAddresses.
llvm-svn: 85556
2009-10-30 01:27:03 +00:00
Devang Patel fe480c5e62 Remove dead code.
llvm-svn: 85551
2009-10-30 00:39:25 +00:00
Dan Gohman 126193a9b5 Add a BlockAddress MachineOperand kind.
llvm-svn: 85549
2009-10-30 00:20:08 +00:00
Dan Gohman 8c9b10f4e8 Remove a redundant copy constructor.
llvm-svn: 85547
2009-10-30 00:14:33 +00:00
Dan Gohman 554a75a973 Move some code from being emitted as boilerplate duplicated in every
*ISelDAGToDAG.cpp to being regular code in SelectionDAGISel.cpp.

llvm-svn: 85530
2009-10-29 22:30:23 +00:00
Dan Gohman 453d64c9f5 Rename usesCustomDAGSchedInserter to usesCustomInserter, and update a
bunch of associated comments, because it doesn't have anything to do
with DAGs or scheduling. This is another step in decoupling MachineInstr
emitting from scheduling.

llvm-svn: 85517
2009-10-29 18:10:34 +00:00
Chris Lattner 0c778f70e9 add interpreter support for indirect goto / blockaddress. The interpreter
now correctly runs clang's test/CodeGen/indirect-goto.c.  The JIT will abort
on it until someone feels compelled to implement this.

llvm-svn: 85488
2009-10-29 05:26:09 +00:00
Zhongxing Xu b71fae8098 add newline to make cl.exe happy.
llvm-svn: 85483
2009-10-29 05:07:14 +00:00
Bill Wendling 3505c94923 Don't put in these EH changes.
llvm-svn: 85460
2009-10-29 00:37:35 +00:00
Douglas Gregor a6f3e7edeb A switch-on-string-literal construct that is a nice alternative to
cascading "ifs" of strcmps/memcmps.

llvm-svn: 85459
2009-10-29 00:34:30 +00:00
Bill Wendling a8eceedb82 Reverting r85338 for now. It's causing a bootstrap failure on PPC darwin9.
--- Reverse-merging r85338 into '.':
U    lib/CodeGen/SimpleRegisterCoalescing.cpp
U    lib/CodeGen/SimpleRegisterCoalescing.h

llvm-svn: 85454
2009-10-29 00:22:16 +00:00
Dan Gohman 3903320a48 Add a hasAddressTaken for BasicBlock.
llvm-svn: 85449
2009-10-29 00:09:08 +00:00
Chris Lattner 48d9995d2b add IRBuilder support for IndirectBr
llvm-svn: 85445
2009-10-28 23:25:00 +00:00
Bob Wilson 97b9312663 Revert r85346 change to control tail merging by CodeGenOpt::Level.
I'm going to redo this using the OptimizeForSize function attribute.

llvm-svn: 85426
2009-10-28 20:46:46 +00:00
Victor Hernandez 0d025421cd Extend getMallocArraySize() to determine the array size if the malloc argument is:
ArraySize * ElementSize
ElementSize * ArraySize
ArraySize << log2(ElementSize)
ElementSize << log2(ArraySize)

Refactor isArrayMallocHelper and delete isSafeToGetMallocArraySize, so that there is only 1 copy of the malloc array determining logic.
Update users of getMallocArraySize() to not bother calling isArrayMalloc() as well.

llvm-svn: 85421
2009-10-28 20:18:55 +00:00
David Goodwin e30ed53c05 Make AntiDepReg.h internal.
llvm-svn: 85412
2009-10-28 18:29:54 +00:00
Chris Lattner fbaac77c70 add a new 'SetCurrentDebugType' API (requested by Andrew Haley for JIT
stuff) to programmatically control the current debug flavor.  While 
I'm at it, doxygenate Debug.h and clean it up.

llvm-svn: 85395
2009-10-28 15:32:19 +00:00
Nick Lewycky 175308c43e Add ABCD, a generalized implementation of the Elimination of Array Bounds
Checks on Demand algorithm which looks at arbitrary branches instead of loop
iterations. This is GSoC work by Andre Tavares with only editorial changes
applied!

llvm-svn: 85382
2009-10-28 07:03:15 +00:00
Chris Lattner f540d74b58 bitcode writer support for blockaddress.
llvm-svn: 85376
2009-10-28 05:24:40 +00:00
Chris Lattner a91a563530 Previously, all operands to Constant were themselves constant.
In the new world order, BlockAddress can have a BasicBlock operand.
This doesn't permute much, because if you have a ConstantExpr (or
anything more specific than Constant) we still know the operand has
to be a Constant.

llvm-svn: 85375
2009-10-28 05:14:34 +00:00
Chris Lattner 1c4b03c2d7 basic blocks can now have non-instruction users.
llvm-svn: 85365
2009-10-28 03:36:44 +00:00
Evan Cheng 83896a59e1 Add a second ValueType argument to isFPImmLegal.
llvm-svn: 85361
2009-10-28 01:43:28 +00:00
Evan Cheng deab9dee12 Remove getIEEEFloatParts and getIEEEDoubleParts. They are not needed.
llvm-svn: 85358
2009-10-28 01:08:17 +00:00
Chris Lattner d04cb6d0fa rename indbr -> indirectbr to appease the residents of #llvm.
llvm-svn: 85351
2009-10-28 00:19:10 +00:00
Chris Lattner 31b132c0b7 IR support for the new BlockAddress constant kind. This is
untested and there is no way to use it, next up: doing battle
with asmparser.

llvm-svn: 85349
2009-10-28 00:01:44 +00:00
Bob Wilson 9693f9d465 Record CodeGen optimization level in the BranchFolding pass so that we can
use it to control tail merging when there is a tradeoff between performance
and code size.  When there is only 1 instruction in the common tail, we have
been merging.  That can be good for code size but is a definite loss for
performance.  Now we will avoid tail merging in that case when the
optimization level is "Aggressive", i.e., "-O3".  Radar 7338114.

Since the IfConversion pass invokes BranchFolding, it too needs to know
the optimization level.  Note that I removed the RegisterPass instantiation
for IfConversion because it required a default constructor.  If someone
wants to keep that for some reason, we can add a default constructor with
a hard-wired optimization level.

llvm-svn: 85346
2009-10-27 23:49:38 +00:00
Jeffrey Yasskin aa8814a877 Revert the API changes from r85295 to make it easier for people to build
against both 2.6 and HEAD.  The default is still changed to eager jitting.

llvm-svn: 85330
2009-10-27 22:39:42 +00:00
Devang Patel 11cf3f4a27 Factor out redundancy from clone() implementations.
llvm-svn: 85327
2009-10-27 22:16:29 +00:00
Evan Cheng 67c902147e Add new APFloat methods that return sign, exp, and mantissa of ieee float and double values.
llvm-svn: 85318
2009-10-27 21:35:42 +00:00
Chris Lattner c5c281ea44 Random updates to passes for indbr, I need blockaddress before I can do much more.
llvm-svn: 85316
2009-10-27 21:27:42 +00:00
Jeffrey Yasskin 4567db45b8 Change the JIT to compile eagerly by default as agreed in
http://llvm.org/PR5184, and beef up the comments to describe what both options
do and the risks of lazy compilation in the presence of threads.

llvm-svn: 85295
2009-10-27 20:30:28 +00:00
Victor Hernandez f390e04a47 Rename MallocFreeHelper as MemoryBuiltins
llvm-svn: 85286
2009-10-27 20:05:49 +00:00
Evan Cheng 16993aa30b Do away with addLegalFPImmediate. Add a target hook isFPImmLegal which returns true if the fp immediate can be natively codegened by target.
llvm-svn: 85281
2009-10-27 19:56:55 +00:00
Chris Lattner 3ed871fe62 add enough support for indirect branch for the feature test to pass
(assembler,asmprinter, bc reader+writer) and document it.  Codegen
currently aborts on it.

llvm-svn: 85274
2009-10-27 19:13:16 +00:00
Chris Lattner 26a7ae4fba Type.h doesn't need to #include LLVMContext.h
llvm-svn: 85254
2009-10-27 17:08:31 +00:00
Chris Lattner 4cc68c29e6 trim another #include
llvm-svn: 85250
2009-10-27 16:53:54 +00:00
Chris Lattner 50b41ed060 remove an unneeded #include.
llvm-svn: 85248
2009-10-27 16:49:53 +00:00
Chris Lattner 2fda9a84d1 lang points out that the comment is out of date with the code.
llvm-svn: 85203
2009-10-27 04:58:10 +00:00
Mike Stump a5ae75425d Fix VS build, patch by Marius Wachtler.
llvm-svn: 85198
2009-10-27 02:17:51 +00:00
Eric Christopher 7a50b280c1 Add objectsize intrinsic and hook it up through codegen. Doesn't
do anything than return "I don't know" at the moment.

llvm-svn: 85189
2009-10-27 00:52:25 +00:00
Jeffrey Yasskin bf43f6543d Automatically do the equivalent of freeMachineCodeForFunction(F) when F is
being destroyed. This allows users to run global optimizations like globaldce
even after some functions have been jitted.

This patch also removes the Function* parameter to
JITEventListener::NotifyFreeingMachineCode() since it can cause that to be
called when the Function is partially destroyed. This change will be even more
helpful later when I think we'll want to allow machine code to actually outlive
its Function.

llvm-svn: 85182
2009-10-27 00:03:05 +00:00
Victor Hernandez 762195bd01 Rename MallocHelper as MallocFreeHelper, since it now also identifies calls to free()
llvm-svn: 85181
2009-10-26 23:58:56 +00:00
Owen Anderson 95020dfeda Forgot to commit these.
llvm-svn: 85180
2009-10-26 23:56:52 +00:00