1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-21 03:53:04 +02:00
Commit Graph

10527 Commits

Author SHA1 Message Date
Devang Patel
c024e96ca3 "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
b15f87cc4f 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
bb0bc01e60 Silence a warning on targets with unsigned chars.
llvm-svn: 87002
2009-11-12 17:59:45 +00:00
Nuno Lopes
aa4a883855 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
b0a193db31 - 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
af90768b3c isLegalICmpImmediate should take a signed integer; code clean up.
llvm-svn: 86964
2009-11-12 07:13:11 +00:00
Oscar Fuentes
c15d72f14b 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
81ad8bfcef 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
27c9bbc709 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
6d1ca5d976 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
f373f8c459 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
936ae2d76d 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
b5bb115ece expose edge information and switch j-t to use it.
llvm-svn: 86920
2009-11-12 01:29:10 +00:00
Devang Patel
c70b8eefb7 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
01582996dd 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
304b516363 Add SetDebugLocation() variant to
add debug info location to an instruction.

llvm-svn: 86859
2009-11-11 19:06:06 +00:00
Evan Cheng
a11308742c 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
574137b4c0 Fix a copy+pasto in a comment.
llvm-svn: 86852
2009-11-11 18:14:02 +00:00
Duncan Sands
f0d9823d0b 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
36009e416c remove the now dead condprop pass, PR3906.
llvm-svn: 86810
2009-11-11 05:56:35 +00:00
Daniel Dunbar
da387a1c25 Add StringRef::split(StringRef), to complement StringRef::split(char).
llvm-svn: 86803
2009-11-11 05:19:11 +00:00
Chris Lattner
b45381c3f0 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
aa5d256b19 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
16a5387db2 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
6c04051d2a 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
c60b41d336 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
1f7f78ea94 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
5c983cb2ab Implement support to debug inlined functions.
llvm-svn: 86748
2009-11-10 23:06:00 +00:00
Chris Lattner
958f41d9a4 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
ec4264fbb0 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
e70bec27b0 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
b92c9347ba 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
3c98070f2c 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
89c04dbe2f 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
9428f34d89 refactor TryToSimplifyUncondBranchFromEmptyBlock out of SimplifyCFG.
llvm-svn: 86666
2009-11-10 05:59:26 +00:00
Chris Lattner
a279728372 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
23ac706aab 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
3730cf6fef 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
93a4f29c67 Fixed to address code review. No functional changes.
llvm-svn: 86634
2009-11-10 00:48:55 +00:00
Daniel Dunbar
886e51b5c1 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
538f9c25f8 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
25700676d4 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
131172dc76 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
e458fe6d8e 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
126d78f1c7 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
7ad82ff8cf Remove dlsym stubs, with Nate Begeman's permission.
llvm-svn: 86606
2009-11-09 22:34:19 +00:00
Dan Gohman
c64e578e5a 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
141625abc4 Fix an 80-column violation.
llvm-svn: 86567
2009-11-09 18:20:38 +00:00
Dan Gohman
8ef26198d2 Constify MachineFunctionAnalysis' TargetMachine reference.
llvm-svn: 86564
2009-11-09 18:18:49 +00:00
Dan Gohman
662f54fd6e Fix a comment.
llvm-svn: 86558
2009-11-09 17:06:51 +00:00
Dan Gohman
c194ec89ca Suppress implicit copy ctor and copy assignment for MachineFunction.
llvm-svn: 86557
2009-11-09 17:06:23 +00:00
Nuno Lopes
5b15b50af4 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
b05535f7c5 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
a8847d8409 fix some bogus asserts, PR5049
llvm-svn: 86514
2009-11-09 04:47:27 +00:00
Lang Hames
3126c532b2 Moved some ManagedStatics out of the SlotIndexes header.
llvm-svn: 86446
2009-11-08 08:49:59 +00:00
Daniel Dunbar
14465c444c Fix class -> struct tag.
llvm-svn: 86416
2009-11-07 23:21:30 +00:00
Chris Lattner
31e2c18379 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
0a13189111 Add 8 bit libcalls and make use of them for msp430
llvm-svn: 86384
2009-11-07 17:14:39 +00:00
Chris Lattner
cdefc1c441 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
f99bf8cb76 more cleanup.
llvm-svn: 86369
2009-11-07 09:23:04 +00:00
Chris Lattner
d3f71f2a61 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
502d93267d 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
8280e5d11c llvmc: Add a '-time' option.
llvm-svn: 86348
2009-11-07 06:33:58 +00:00
Mikhail Glushenkov
e6571883fe 80-col violation.
llvm-svn: 86346
2009-11-07 06:33:01 +00:00
Lang Hames
b5bff25ba7 Update some globals to use ManagedStatic.
llvm-svn: 86342
2009-11-07 05:50:28 +00:00
Evan Cheng
f272245a5e Missed this.
llvm-svn: 86331
2009-11-07 04:07:30 +00:00
Kenneth Uildriks
91ceaa85a2 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
df21edc554 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
8736a8fca4 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
4daaf9d3f4 Pass StringRef by value.
llvm-svn: 86251
2009-11-06 10:58:06 +00:00
Chris Lattner
6a31c1141c remove some more Context arguments.
llvm-svn: 86235
2009-11-06 05:59:53 +00:00
Chris Lattner
903ae55e1c 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
a5a12cd62e 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
790089c6e6 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
593cfc9984 Fix PR5315, original patch by Nicolas Capens!
llvm-svn: 86203
2009-11-06 00:11:57 +00:00
Dan Gohman
d05bb8fccb 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
cc2c05cb75 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
8d72615df7 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
6f6862e558 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
a0309933c6 CMake: Detect dotty.
Patch by Arnaud Allard de Grandmaison!

llvm-svn: 86153
2009-11-05 19:03:26 +00:00
Douglas Gregor
2272ca3d44 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
d04294d7b8 Declare classes with matched tags, pointed out by a clang++ warning.
llvm-svn: 86144
2009-11-05 17:51:44 +00:00
Douglas Gregor
eff068fbcb Make two more LLVM headers standalone
llvm-svn: 86131
2009-11-05 13:39:23 +00:00
Douglas Gregor
4f2fc40ae8 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
0669a8df22 Reintroduce support for overloading target intrinsics
llvm-svn: 86114
2009-11-05 03:19:08 +00:00
Lang Hames
aa433cb422 Tidied some ugliness in the SlotIndex default constructor.
llvm-svn: 86097
2009-11-05 01:18:31 +00:00
Lang Hames
f53fc0aa85 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
21ec158c23 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
2b16464904 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
f775e222e0 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
dddec653f1 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
2c4476c9e5 Silence implicit conversion warnings.
llvm-svn: 86000
2009-11-04 03:08:57 +00:00
Lang Hames
c42888e42a Another spurious friend declaration removed.
llvm-svn: 85997
2009-11-04 01:52:40 +00:00
Lang Hames
b63bef3da7 Removed an unnecessary friend declaration and some crufty comments from IndexListEntry.
llvm-svn: 85995
2009-11-04 01:34:22 +00:00
Lang Hames
deed780bc6 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
629a685f05 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
3ea71a58aa turn IPSCCP back on by default, try #3 or 4? Woo.
llvm-svn: 85929
2009-11-03 19:35:13 +00:00
Kenneth Uildriks
d524f94e95 Added a comment to a function that had none
llvm-svn: 85899
2009-11-03 15:25:20 +00:00
Duncan Sands
531ed64b09 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
b5c7546aaf Speculatively redisable IPSCCP, I think its still breaking things.
llvm-svn: 85884
2009-11-03 07:49:22 +00:00
Chris Lattner
b1dfdadabd 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
940753f08a Add a couple more target nodes
llvm-svn: 85857
2009-11-03 03:30:51 +00:00
Chris Lattner
6f515d4ba8 revert r8579[56], which are causing unhappiness in buildbot land.
llvm-svn: 85818
2009-11-02 19:31:10 +00:00
Chris Lattner
8243ac1abf now that ip sccp *really* subsumes ipcp, remove ipcp again.
llvm-svn: 85796
2009-11-02 07:34:29 +00:00
Evan Cheng
80a8ae9a3a 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
dc9cf48396 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
2db49d0a22 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
555af234e6 Improve the other instance of the comment.
llvm-svn: 85733
2009-11-01 19:16:21 +00:00
Chris Lattner
73fa16be5d 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
69549467e3 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
ad2926bbb4 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
55a53e4e79 the verifier shouldn't modify the IR.
llvm-svn: 85722
2009-11-01 18:11:50 +00:00
Douglas Gregor
16c6819959 Reverting 85714, 85715, 85716, which are breaking the build
llvm-svn: 85717
2009-11-01 16:42:53 +00:00
Dan Gohman
58714b62b6 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
9cdf5185a3 Don't #include Pass.h from CallGraph.h.
llvm-svn: 85715
2009-11-01 15:23:35 +00:00
Dan Gohman
1d0b06c139 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
baa216cd33 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
2bbe57b2b8 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
ea1bebaa65 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
cbab35746f 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
61e806613f 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
40cec16be1 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
0079f87732 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
04c536dff6 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
74ed905748 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
ad6c6a3d33 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
8db8f72185 Add option to createGVNPass to disable PRE.
llvm-svn: 85609
2009-10-30 20:12:24 +00:00
Evan Cheng
eb9c268ba0 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
6b7d1390d7 Initial target-independent CodeGen support for BlockAddresses.
llvm-svn: 85556
2009-10-30 01:27:03 +00:00
Devang Patel
134ea45684 Remove dead code.
llvm-svn: 85551
2009-10-30 00:39:25 +00:00
Dan Gohman
adf4f4b7f2 Add a BlockAddress MachineOperand kind.
llvm-svn: 85549
2009-10-30 00:20:08 +00:00
Dan Gohman
acbd7911fb Remove a redundant copy constructor.
llvm-svn: 85547
2009-10-30 00:14:33 +00:00
Dan Gohman
7f5acc4b57 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
3393a4c997 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
9bc4a421e2 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
befbf73b93 add newline to make cl.exe happy.
llvm-svn: 85483
2009-10-29 05:07:14 +00:00
Bill Wendling
58923e365d Don't put in these EH changes.
llvm-svn: 85460
2009-10-29 00:37:35 +00:00
Douglas Gregor
354d1b85b2 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
784d38511f 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
c80f1a4033 Add a hasAddressTaken for BasicBlock.
llvm-svn: 85449
2009-10-29 00:09:08 +00:00
Chris Lattner
64ba3671c9 add IRBuilder support for IndirectBr
llvm-svn: 85445
2009-10-28 23:25:00 +00:00
Bob Wilson
fc1194919b 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
917cf94b22 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
ae4f8e01b0 Make AntiDepReg.h internal.
llvm-svn: 85412
2009-10-28 18:29:54 +00:00
Chris Lattner
a77d439989 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
0376e34268 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
075e225442 bitcode writer support for blockaddress.
llvm-svn: 85376
2009-10-28 05:24:40 +00:00
Chris Lattner
f605b2e8f9 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
3ad05ab257 basic blocks can now have non-instruction users.
llvm-svn: 85365
2009-10-28 03:36:44 +00:00
Evan Cheng
4e3bc5efb7 Add a second ValueType argument to isFPImmLegal.
llvm-svn: 85361
2009-10-28 01:43:28 +00:00