Commit Graph

54830 Commits

Author SHA1 Message Date
Jakob Stoklund Olesen 8392456f1b Don't hang on to pointers or references after vector::push_back.
The MO reference to a MachineOperand can be invalidated by
MachineInstr::addOperand. Don't even use it for debugging.

llvm-svn: 90381
2009-12-03 01:49:56 +00:00
Chris Lattner 65812b58f2 add a failing testcase.
llvm-svn: 90380
2009-12-03 01:46:18 +00:00
Devang Patel 236526dd18 Emit method definition DIE at module level (even for methods with inlined functino body at soure level) so that the debugger can invoke it. This fixes many test failures in gdb test suite.
llvm-svn: 90375
2009-12-03 01:25:38 +00:00
Bill Wendling 693969eb35 Further improvements: refactoring code that does the same thing into one
function, converting "dyn_cast" to "cast", asserting the correct things, and
other general cleanups.

llvm-svn: 90371
2009-12-03 01:15:46 +00:00
Chris Lattner 765ac33a1a yay for case insensitive file systems (?)
llvm-svn: 90370
2009-12-03 01:10:05 +00:00
Chris Lattner 77c36d68f3 fix PR5673 by being more careful about pointers to functions.
llvm-svn: 90369
2009-12-03 01:05:45 +00:00
Chris Lattner 73570673de remove some dead std::ostream using code.
llvm-svn: 90366
2009-12-03 00:55:04 +00:00
Chris Lattner a48f44d9ee improve portability to avoid conflicting with std::next in c++'0x.
Patch by Howard Hinnant!

llvm-svn: 90365
2009-12-03 00:50:42 +00:00
Bill Wendling 1ed59c63e3 This initial code is meant to convert TargetData to use an AbstractTypesUser so
that it doesn't have dangling pointers when abstract types are resolved. This
modifies it somewhat to address comments: making the "StructLayoutMap" an
anonymous structure, calling "removeAbstractTypeUser" when appropriate, and
adding asserts where helpful.

llvm-svn: 90362
2009-12-03 00:17:12 +00:00
Douglas Gregor a3b825edd1 Fix CMake makefiles
llvm-svn: 90354
2009-12-02 22:19:31 +00:00
Evan Cheng 20e9d030c9 Skeleton for MachineInstr level SSA updater.
llvm-svn: 90353
2009-12-02 22:02:52 +00:00
Bill Wendling 76bf386af0 Remove unnecessary check.
llvm-svn: 90352
2009-12-02 22:02:20 +00:00
Jim Grosbach 51663f7165 Add MaxStackAlignment.cpp to CMake
llvm-svn: 90337
2009-12-02 19:31:07 +00:00
Jim Grosbach 2c3a6c6589 Factor the stack alignment calculations out into a target independent pass.
No functionality change.

llvm-svn: 90336
2009-12-02 19:30:24 +00:00
Bob Wilson fffbc0c5d9 Don't count PHI instructions toward the limit for tail duplicating a block.
llvm-svn: 90326
2009-12-02 17:15:24 +00:00
Jim Grosbach d831ef4945 Move EliminateDuplicatePHINodes() from SimplifyCFG.cpp to Local.cpp
llvm-svn: 90324
2009-12-02 17:06:45 +00:00
Andreas Neustifter 3d207290fe Cheap, mostly strict, stable sorting.
This is necessary for tests so the results are comparable.

llvm-svn: 90320
2009-12-02 15:57:15 +00:00
Benjamin Kramer eee88bc5d2 Silence compiler warnings.
llvm-svn: 90319
2009-12-02 15:33:44 +00:00
Devang Patel 8c33959df2 Clarify that DIEString does not keep a copy of the string.
llvm-svn: 90318
2009-12-02 15:25:16 +00:00
Owen Anderson b9878ee6b6 Cleanup/remove some parts of the lifetime region handling code in memdep and GVN,
per Chris' comments.  Adjust testcases to match.

llvm-svn: 90304
2009-12-02 07:35:19 +00:00
Chris Lattner c468025ac9 factor some code better.
llvm-svn: 90299
2009-12-02 06:44:58 +00:00
Chris Lattner 2764b4dc55 formatting cleanups.
llvm-svn: 90298
2009-12-02 06:35:55 +00:00
Chris Lattner eea42c7b51 tidy up, remove dependence on order of evaluation of function args from EmitMemCpy.
llvm-svn: 90297
2009-12-02 06:05:42 +00:00
Chris Lattner 4ca1981e82 merge sext-2 into sext.ll
llvm-svn: 90293
2009-12-02 05:34:35 +00:00
Chris Lattner 0a12a8f9fe rename test
llvm-svn: 90292
2009-12-02 05:32:33 +00:00
Chris Lattner fe206d2a13 filecheckize
llvm-svn: 90291
2009-12-02 05:32:16 +00:00
Mon P Wang bb3eac9e7a Fixed an assertion failure for tracking sext of a vector of integers
llvm-svn: 90290
2009-12-02 04:59:58 +00:00
Devang Patel a5749bda2c Add utility routine to create subprogram definition entry from subprogram declaration entry.
llvm-svn: 90282
2009-12-01 23:09:02 +00:00
Devang Patel a605b9124a Reuse existing subprogram DIE.
llvm-svn: 90281
2009-12-01 23:07:59 +00:00
Chris Lattner 0e3b78a6c2 return more useful error messages by using strerror to format errno
instead of returning an ambiguous reason.

llvm-svn: 90275
2009-12-01 22:51:41 +00:00
Eric Christopher 8aa46bc6fd Update per Bill's comments. Work in progress.
llvm-svn: 90271
2009-12-01 22:28:41 +00:00
Evan Cheng 732351f732 Fix PR5391: support early clobber physical register def tied with a use (ewwww)
- A valno should be set HasRedefByEC if there is an early clobber def in the middle of its live ranges. It should not be set if the def of the valno is defined by an early clobber.
- If a physical register def is tied to an use and it's an early clobber, it just means the HasRedefByEC is set since it's still one continuous live range.
- Add a couple of missing checks for HasRedefByEC in the coalescer. In general, it should not coalesce a vr with a physical register if the physical register has a early clobber def somewhere. This is overly conservative but that's the price for using such a nasty inline asm "feature".

llvm-svn: 90269
2009-12-01 22:25:00 +00:00
Jim Grosbach 8a8ba87ac8 test case for IV-Users simplification loop improvement
llvm-svn: 90260
2009-12-01 21:53:51 +00:00
Chris Lattner e914c0eaa0 rename some variables.
llvm-svn: 90258
2009-12-01 21:16:01 +00:00
Chris Lattner 506b858c45 tidy
llvm-svn: 90257
2009-12-01 21:15:15 +00:00
Dan Gohman b2ae02979f Add edge source labels to SelectionDAG graphs, now that the graph printing
framework omits differentiated edge sources in the case where the labels
are empty strings.

llvm-svn: 90254
2009-12-01 19:20:00 +00:00
Dan Gohman 8def6e3daf Minor cleanups.
llvm-svn: 90253
2009-12-01 19:16:15 +00:00
Dan Gohman 939c828604 Trim an unnecessary #include.
llvm-svn: 90252
2009-12-01 19:13:27 +00:00
Daniel Dunbar 04433fe3e1 Don't default warnings to ON on MSVC, the spew is enough to triple the build time. :/
llvm-svn: 90251
2009-12-01 19:11:36 +00:00
Devang Patel 0a2c0bcb14 Clear function specific containers while processing end of a function, even if DW_TAG_subprogram for current function is not found.
llvm-svn: 90247
2009-12-01 18:13:48 +00:00
Jim Grosbach 36d4dec28a Thumb1 exception handling setjmp
llvm-svn: 90246
2009-12-01 18:10:36 +00:00
Johnny Chen 86fc920742 For VLDM/VSTM (Advanced SIMD), set encoding bits Inst{11-8} to 0b1011.
llvm-svn: 90243
2009-12-01 17:37:06 +00:00
Jakob Stoklund Olesen defc47088a Move PHIElimination::isLiveOut method to LiveVariables.
We want LiveVariables clients to use methods rather than accessing the
getVarInfo data structure directly. That way it will be possible to change the
LiveVariables representation.

llvm-svn: 90240
2009-12-01 17:13:31 +00:00
Gabor Greif 7ee0efd289 typo
llvm-svn: 90236
2009-12-01 15:53:33 +00:00
Gabor Greif 6b822ce675 demonstrate usage of Cases() mapping several strings to the same value; remove trailing spaces
llvm-svn: 90230
2009-12-01 12:53:56 +00:00
Mikhail Glushenkov 35c5591286 Add relocation model options.
llvm-svn: 90222
2009-12-01 09:47:11 +00:00
Mikhail Glushenkov b5f718f063 Typo.
llvm-svn: 90221
2009-12-01 09:19:09 +00:00
Tobias Grosser 8b8a5b22cb Fix copy paste bug
llvm-svn: 90220
2009-12-01 08:43:33 +00:00
Chris Lattner 9c2053b242 fix 255.vortex again, third time's the charm.
llvm-svn: 90217
2009-12-01 07:33:32 +00:00
Chris Lattner 367b5eafb7 minimize this a bit more.
llvm-svn: 90216
2009-12-01 07:30:01 +00:00
Mikhail Glushenkov ed163ed103 Forward -save-temps to llvm-gcc.
llvm-svn: 90214
2009-12-01 06:51:30 +00:00
Chris Lattner fd75b90d81 merge 2009-11-29-ReverseMap.ll into crash.ll
llvm-svn: 90212
2009-12-01 06:22:10 +00:00
Chris Lattner 3c9aca9079 fix PR5640 by tracking whether a block is the header of a loop more
precisely, which prevents us from infinitely peeling the loop.

llvm-svn: 90211
2009-12-01 06:04:43 +00:00
Mikhail Glushenkov 3a438a9336 Support -[weak_]framework and -F in llvmc.
llvm-svn: 90210
2009-12-01 05:59:55 +00:00
Eric Christopher 4b25bac791 Remove the gcc builtins from the intrinsics, we'll lower them
explicitly so we can check arguments.

llvm-svn: 90199
2009-12-01 03:18:26 +00:00
Jakob Stoklund Olesen 26667abbd3 Use CFG connectedness as a secondary sort key when deciding the order of copy coalescing.
This means that well connected blocks are copy coalesced before the less connected blocks. Connected blocks are more difficult to
coalesce because intervals are more complicated, so handling them first gives a greater chance of success.

llvm-svn: 90194
2009-12-01 03:03:00 +00:00
Eric Christopher d6206a8b00 Add a soft link so that in an apple style build we can find libLTO.dylib.
llvm-svn: 90189
2009-12-01 02:26:01 +00:00
Oscar Fuentes 5c600b5435 Add two CMake flags LLVM_ENABLE_PEDANTIC and LLVM_ENABLE_WERROR,
PEDANTIC defaults to ON and WERROR default to off.

Also add MSVC warnings. To disable warnings add the flags
LLVM_ENABLE_WARNINGS (default on).

Patch by Tobias Grosser!

llvm-svn: 90188
2009-12-01 02:21:51 +00:00
Chris Lattner 4ba8e5d14f fix PR5649 by making fib use the JIT instead of the interpreter, patch by Perry Lorier!
llvm-svn: 90186
2009-12-01 01:56:27 +00:00
Dan Gohman 03f90ab0a9 Add a comment about A[i+(j+1)].
llvm-svn: 90185
2009-12-01 01:38:10 +00:00
Bill Wendling 05252355b8 Remove some validation errors.
llvm-svn: 90184
2009-12-01 00:59:58 +00:00
Bill Wendling 991b84e5a7 Some formatting and spelling fixes.
llvm-svn: 90182
2009-12-01 00:53:11 +00:00
Dan Gohman 461b937053 Devang pointed out that this code should use DIScope instead of
DICompileUnit. This code now prints debug filenames successfully.

llvm-svn: 90181
2009-12-01 00:45:56 +00:00
Evan Cheng 1d31fc9123 Fix PR5614: parts of a physical register def may be killed the rest.
llvm-svn: 90180
2009-12-01 00:44:45 +00:00
Devang Patel 3daa96b079 Test case for r90175.
llvm-svn: 90176
2009-12-01 00:13:06 +00:00
Johnny Chen ee536b0ea4 For VMOV (immediate), make some of the encoding bits (cmode and op) unspecified.
For VMOVv*i[16,32], op bit is don't care, and some cmode bits vary depending on
the immediate values.

Ref: Table A7-15 Modified immediate values for Advanced SIMD instructions.
llvm-svn: 90173
2009-12-01 00:02:02 +00:00
Devang Patel ae466efe2e If pointer type has a name then do not ignore the name.
llvm-svn: 90172
2009-11-30 23:56:56 +00:00
Oscar Fuentes cc71783b32 * CMakeLists.txt: Adds warnings flags for g++. Fixes PR 5647.
llvm-svn: 90170
2009-11-30 23:50:14 +00:00
Oscar Fuentes d2d1be4d22 * cmake/modules/LLVMLibDeps.cmake: Updated library dependencies.
llvm-svn: 90169
2009-11-30 23:48:51 +00:00
Dan Gohman 3ee8bc9b35 Minor whitespace fixes.
llvm-svn: 90166
2009-11-30 23:33:53 +00:00
Dan Gohman 6f51309021 Fix a minor inconsistency.
llvm-svn: 90165
2009-11-30 23:33:37 +00:00
Dan Gohman ec30044cf7 Fix typos in comments.
llvm-svn: 90164
2009-11-30 23:30:43 +00:00
Jakob Stoklund Olesen 020d8d4c63 New virtual registers created for spill intervals should inherit allocation hints from the original register.
This helps us avoid silly copies when rematting values that are copied to a physical register:

leaq	_.str44(%rip), %rcx
movq	%rcx, %rsi
call	_strcmp

becomes:

leaq	_.str44(%rip), %rsi
call	_strcmp

The coalescer will not touch the movq because that would tie down the physical register.

llvm-svn: 90163
2009-11-30 22:55:54 +00:00
Bill Wendling 120037fec7 Debug info is disabled on PPC Darwin.
llvm-svn: 90160
2009-11-30 22:23:29 +00:00
Bob Wilson 598f8ff9e5 Reprioritize tests for tail duplication to be aggressive about indirect
branches even when optimizing for code size.  Unless we find evidence to the
contrary in the future, the special treatment for indirect branches does not
have a significant effect on code size, and performance still matters with -Os.

llvm-svn: 90147
2009-11-30 18:56:45 +00:00
Bob Wilson 505ddaa4dc Remove isProfitableToDuplicateIndirectBranch target hook. It is profitable
for all the processors where I have tried it, and even when it might not help
performance, the cost is quite low.  The opportunities for duplicating
indirect branches are limited by other factors so code size does not change
much due to tail duplicating indirect branches aggressively.

llvm-svn: 90144
2009-11-30 18:35:03 +00:00
Bob Wilson c168a52627 Fix some more ARM unified syntax warnings.
llvm-svn: 90141
2009-11-30 17:47:19 +00:00
Benjamin Kramer 7da76a20c0 Fix odd declaration.
llvm-svn: 90138
2009-11-30 15:52:29 +00:00
Tobias Grosser 9caf3801ca Fix last DOTGraphTraits problems in CompilationGraph.
llvm-svn: 90136
2009-11-30 13:34:51 +00:00
Tobias Grosser 0729c6e281 Remove forgotten ShortNames in Trie and CompilationGraph
llvm-svn: 90135
2009-11-30 13:14:13 +00:00
Tobias Grosser dd7f2e797f Remove ShortNames from getNodeLabel in DOTGraphTraits
llvm-svn: 90134
2009-11-30 12:38:47 +00:00
Tobias Grosser 90d334032a Instantiate DefaultDOTGraphTraits
llvm-svn: 90133
2009-11-30 12:38:13 +00:00
Tobias Grosser 8d6f6b74b1 Do not point edge heads to source labels
If no destination label is available, just point to the node itself
instead of pointing to some source label. Source and destination labels are
not related in any way.

llvm-svn: 90132
2009-11-30 12:37:39 +00:00
Tobias Grosser f444599ef0 Only print edgeSourceLabels if they are not empty
Graphviz can layout the graphs better if a node does not contain source
ports. Therefore only print the ports if the source ports are useful,
that means are not labeled with the empty string "".
This patch also simplifies graphs without any edgeSourceLabels e.g. the
dominance trees.

llvm-svn: 90131
2009-11-30 12:24:40 +00:00
Tobias Grosser f7495f497a Small PostDominatorTree improvements
* Do not SEGFAULT if tree entryNode() is NULL
 * Print function names in dotty printer

llvm-svn: 90130
2009-11-30 12:06:37 +00:00
Tobias Grosser 5f0988ceb0 Remove ":" after BB name in -view-cfg-only
llvm-svn: 90129
2009-11-30 11:55:24 +00:00
Eric Christopher 7348432ade First pass at llvm.objectsize documentation.
llvm-svn: 90116
2009-11-30 08:03:53 +00:00
Nick Lewycky 2d32947099 Revert r90107, fixing test/Transforms/GVN/2009-11-29-ReverseMap.ll and the
llvm-gcc build.

llvm-svn: 90113
2009-11-30 07:05:51 +00:00
Nick Lewycky 8a29dd4c7f Add a testcase for the current llvm-gcc build failure.
llvm-svn: 90112
2009-11-30 07:02:18 +00:00
Nick Lewycky 1c2720320b Remove the 'simple jit' tutorial as it wasn't really being maintained and its
material is covered by the Kaleidoscope tutorial.

llvm-svn: 90111
2009-11-30 04:23:17 +00:00
Mon P Wang 031cb00246 Add test case for r90108
llvm-svn: 90109
2009-11-30 02:42:27 +00:00
Mon P Wang 32f8bb9ed4 Added support to allow clients to custom widen. For X86, custom widen vectors for
divide/remainder since these operations can trap by unroll them and adding undefs
for the resulting vector.

llvm-svn: 90108
2009-11-30 02:42:02 +00:00
Chris Lattner 4d252d20e8 reapply r90093 with an addition of keeping the forward
and reverse nonlocal memdep maps in synch, this should
fix 255.vortex.

llvm-svn: 90107
2009-11-30 02:26:29 +00:00
Nick Lewycky fef0c67d01 Fix this test on 64-bit systems which seem to use i64 for gep indices sometimes
while 32-bit gcc uses i32.

llvm-svn: 90106
2009-11-30 02:23:57 +00:00
Nick Lewycky 95ef6c9560 Commit r90099 made LLVM simplify one of these constant expressions a little
more. Update the syntax we're checking for and filecheckize it too.

This will fix the selfhost buildbots but will 'break' the others (sigh) because
they're still linked against older LLVM which is emitting less optimized IR.

llvm-svn: 90104
2009-11-30 00:38:56 +00:00
Nick Lewycky e35e6f097d Teach ConstantFolding to do a better job when folding gep(bitcast).
This permits the devirtualization of llvm.org/PR3100#c9 when compiled by clang.

llvm-svn: 90099
2009-11-29 21:40:55 +00:00
Benjamin Kramer 3efc050ac4 Revert r90089 for now, it's breaking selfhost.
llvm-svn: 90097
2009-11-29 21:17:48 +00:00
Chris Lattner 0311ade94c revert this patch for now, it causes failures of:
LLVM::Transforms/GVN/2009-02-17-LoadPRECrash.ll
    LLVM::Transforms/GVN/2009-06-17-InvalidPRE.ll

llvm-svn: 90096
2009-11-29 21:14:59 +00:00
Chris Lattner 52e7715b0b Fix a really nasty caching bug I introduced in memdep. An entry
was being added to the Result vector, but not being put in the
cache.  This means that if the cache was reused wholesale for a
later query that it would be missing this entry and we'd do an
incorrect load elimination.

Unfortunately, it's not really possible to write a useful 
testcase for this, but this unbreaks 255.vortex.

llvm-svn: 90093
2009-11-29 21:09:36 +00:00
Benjamin Kramer bfa993ab20 Fix two FIXMEs.
llvm-svn: 90089
2009-11-29 20:29:30 +00:00
Nick Lewycky 0a1f25b927 Detabify.
llvm-svn: 90085
2009-11-29 18:10:39 +00:00
Benjamin Kramer 8cb52c266f Remove dead returns.
llvm-svn: 90083
2009-11-29 17:42:58 +00:00
Kovarththanan Rajaratnam 4b9f0b6720 This patch ensures that Path::GetMainExecutable is able to handle the
case where realpath() fails. When this occurs we segfault trying to
create a std::string from a NULL pointer.

Fixes PR5635.

llvm-svn: 90082
2009-11-29 17:19:48 +00:00
Daniel Dunbar 53b95c4080 Fix FileCheck crash when fuzzy scanning starting at the end of the file.
llvm-svn: 90065
2009-11-29 08:30:24 +00:00
Chris Lattner 1cc4cca193 add testcases for the foo_with_overflow op xforms added recently and
fix bugs exposed by the tests.  Testcases from Alastair Lynn!

llvm-svn: 90056
2009-11-29 02:57:29 +00:00
Chris Lattner 6a05f2dc8e mark all the 'foo with overflow' intrinsics as readnone.
llvm-svn: 90055
2009-11-29 02:44:33 +00:00
Chris Lattner 58ccf88c36 update and consolidate the load pre notes.
llvm-svn: 90050
2009-11-29 02:19:52 +00:00
Chris Lattner 0d39613f65 add PR#
llvm-svn: 90049
2009-11-29 01:28:58 +00:00
Chris Lattner 73d45454be Add a testcase for:
void test(int N, double* G) {
  long j;
  for (j = 1; j < N - 1; j++)
      G[j] = G[j] + G[j+1] + G[j-1];
}

which we now compile to one load in the loop:

LBB1_2:                                                     ## %bb
	movsd	16(%rsi,%rax,8), %xmm2
	incq	%rdx
	addsd	%xmm2, %xmm1
	addsd	%xmm1, %xmm0
	movapd	%xmm2, %xmm1
	movsd	%xmm0, 8(%rsi,%rax,8)
	incq	%rax
	cmpq	%rcx, %rax
	jne	LBB1_2

instead of:

LBB1_2:                                                     ## %bb
	movsd	8(%rsi,%rax,8), %xmm0
	addsd	16(%rsi,%rax,8), %xmm0
	addsd	(%rsi,%rax,8), %xmm0
	movsd	%xmm0, 8(%rsi,%rax,8)
	incq	%rax
	cmpq	%rcx, %rax
	jne	LBB1_2

llvm-svn: 90048
2009-11-29 01:15:43 +00:00
Chris Lattner a73adac52e add a testcase for
void test9(int N, double* G) {
  long j;
  for (j = 1; j < N - 1; j++)
      G[j+1] = G[j] + G[j+1];
}

llvm-svn: 90047
2009-11-29 01:04:40 +00:00
Chris Lattner cd261c9c26 Implement PR5634.
llvm-svn: 90046
2009-11-29 00:51:17 +00:00
Nick Lewycky 218a3393f4 Teach memdep to look for memory use intrinsics during dependency queries. Fixes
PR5574.

llvm-svn: 90045
2009-11-28 21:27:49 +00:00
Chris Lattner 32140312ca reenable load address insertion in load pre. This allows us to
handle cases like this:
void test(int N, double* G) {
  long j;
  for (j = 1; j < N - 1; j++)
      G[j+1] = G[j] + G[j+1];
}

where G[1] isn't live into the loop.

llvm-svn: 90041
2009-11-28 16:08:18 +00:00
Chris Lattner 44da5bd837 Enhance InsertPHITranslatedPointer to be able to return a list of newly
inserted instructions.  No functionality change until someone starts using it.

llvm-svn: 90039
2009-11-28 15:39:14 +00:00
Chris Lattner c7bc66dfc6 implement a FIXME: limit the depth that DecomposeGEPExpression goes the same
way that getUnderlyingObject does it. 

This fixes the 'DecomposeGEPExpression and getUnderlyingObject disagree!' 
assertion on sqlite3.

llvm-svn: 90038
2009-11-28 15:12:41 +00:00
Chris Lattner d5bd369a0f enable code to handle un-phi-translatable cases more aggressively:
if we don't have an address expression available in a predecessor,
then model this as the value being clobbered at the end of the pred
block instead of being modeled as a complete phi translation failure.
This is important for PRE of loads because we want to see that the
load is available in all but this predecessor, and complete phi
translation failure results in not getting any information about
predecessors.

This doesn't do anything until I renable code insertion since PRE
now sees that it is available in all but one predecessors, but can't
insert the addressing in the predecessor that is missing it to 
eliminate the redundancy.

llvm-svn: 90037
2009-11-28 14:54:10 +00:00
Chris Lattner cf0b198827 disable value insertion for now, I need to figure out how
to inform GVN about the newly inserted values.  This fixes 
PR5631.

llvm-svn: 90022
2009-11-27 22:50:07 +00:00
Chris Lattner 2be52e72ae Rework InsertPHITranslatedPointer to handle the recursive case, this
fixes PR5630 and sets the stage for the next phase of goodness (testcase
pending).

llvm-svn: 90019
2009-11-27 22:05:15 +00:00
Chris Lattner 4ee17e1482 recursively phi translate bitcast operands too, for consistency.
llvm-svn: 90016
2009-11-27 20:25:30 +00:00
Nick Lewycky 6e0525141f Oops! Fix bug introduced in my recent cleanup change. Thanks to Tobias Grosser
for pointing this out.

llvm-svn: 90015
2009-11-27 19:57:53 +00:00
Chris Lattner d141f885a1 I accidentally implemented this :)
llvm-svn: 90014
2009-11-27 19:56:00 +00:00
Chris Lattner 2f0354ecf0 add support for recursive phi translation and phi
translation of add with immediate.  This allows us
to optimize this function:

void test(int N, double* G) {
  long j;
  G[1] = 1;
    for (j = 1; j < N - 1; j++)
        G[j+1] = G[j] + G[j+1];
}

to only do one load every iteration of the loop.

llvm-svn: 90013
2009-11-27 19:11:31 +00:00
Chris Lattner e66f84e012 add two simple test cases we now optimize (to one load in the loop each) and one we don't (corresponding to the fixme I added yesterday).
llvm-svn: 90012
2009-11-27 18:08:30 +00:00
Chris Lattner 3d9823b9cf factor some logic out of instcombine into a new SimplifyAddInst method.
llvm-svn: 90011
2009-11-27 17:42:22 +00:00
Chris Lattner 83a4a9868f add a deadargelim note.
llvm-svn: 90009
2009-11-27 17:12:30 +00:00
Chris Lattner ca9e0e83b3 This testcase is actually only partially redundant, and requires
the FIXME I added yesterday to be implemented.

llvm-svn: 90008
2009-11-27 16:53:57 +00:00
Chris Lattner 2226db66ab fix PR5436 by making the 'simple' case of SRoA not promote out of range
array indexes.  The "complex" case of SRoA still handles them, and correctly.

This fixes a weirdness where we'd correctly avoid transforming A[0][42] if
the 42 was too large, but we'd only do it if it was one gep, not two separate
ones.

llvm-svn: 90007
2009-11-27 16:37:41 +00:00
Chris Lattner 92ba18e9e4 filecheckize
llvm-svn: 90006
2009-11-27 16:31:59 +00:00
Duncan Sands b56334b4f2 While this test is testing a problem in the generic part of codegen,
the problem only shows for msp430 and pic16 which is why it specifies
them using -march.  But it is wrong to put such tests in CodeGen/Generic,
since not everyone builds these targets.  Put a copy of the test in each
of the target test directories.

llvm-svn: 90005
2009-11-27 16:04:14 +00:00
Duncan Sands 31c0e0ee35 Vector types are no longer required to have a power-of-two length.
llvm-svn: 90004
2009-11-27 13:38:03 +00:00
Duncan Sands ee7425cc56 These code generator limitations have been removed.
llvm-svn: 90003
2009-11-27 12:33:22 +00:00
Chris Lattner 6d294de548 add comment.
llvm-svn: 90002
2009-11-27 08:40:14 +00:00
Chris Lattner ac323297e0 reduce nesting, no functionality change.
llvm-svn: 90001
2009-11-27 08:37:22 +00:00
Chris Lattner 8e62d0a93d limit the recursion depth of GetLinearExpression. This
fixes a crash analyzing consumer-lame, which had an "%X = add %X, 1"
in unreachable code.

llvm-svn: 90000
2009-11-27 08:32:52 +00:00
Chris Lattner 25be93dfed teach GVN's load PRE to insert computations of the address in predecessors
where it is not available.  It's unclear how to get this inserted 
computation into GVN's scalar availability sets, Owen, help? :)

llvm-svn: 89997
2009-11-27 08:25:10 +00:00
Chris Lattner 41a5bba4e0 add some tests for memdep phi translation + PRE.
llvm-svn: 89996
2009-11-27 06:42:42 +00:00
Chris Lattner fa76d23c1d this test is failing, and is expected to.
llvm-svn: 89995
2009-11-27 06:36:28 +00:00
Chris Lattner 4f1552bde7 filecheckize
llvm-svn: 89994
2009-11-27 06:33:09 +00:00
Chris Lattner 66426c70e6 rename test.
llvm-svn: 89993
2009-11-27 06:31:55 +00:00
Chris Lattner a9a76ccf56 Fix phi translation in load PRE to agree with the phi
translation done by memdep, and reenable gep translation 
again.

llvm-svn: 89992
2009-11-27 06:31:14 +00:00
Chris Lattner b018bda665 redisable this, my bootstrap worked because it wasn't an optimized build, whoops.
llvm-svn: 89991
2009-11-27 05:53:01 +00:00
Chris Lattner fb8a718fc3 try again.
llvm-svn: 89990
2009-11-27 05:19:56 +00:00
Chris Lattner 14444f5c1a this is causing buildbot failures, disable for now.
llvm-svn: 89985
2009-11-27 01:52:22 +00:00
Chris Lattner cc6d29286c this (and probably several others) are now done.
llvm-svn: 89982
2009-11-27 00:35:04 +00:00
Chris Lattner 5030c6ab21 teach phi translation of GEPs to simplify geps like 'gep x, 0'.
This allows us to compile the example from PR5313 into:

LBB1_2:                                                     ## %bb
	incl	%ecx
	movb	%al, (%rsi)
	movslq	%ecx, %rax
	movb	(%rdi,%rax), %al
	testb	%al, %al
	jne	LBB1_2

instead of:

LBB1_2:                                                     ## %bb
	movslq	%eax, %rcx
	incl	%eax
	movb	(%rdi,%rcx), %cl
	movb	%cl, (%rsi)
	movslq	%eax, %rcx
	cmpb	$0, (%rdi,%rcx)
	jne	LBB1_2

llvm-svn: 89981
2009-11-27 00:34:38 +00:00
Chris Lattner 8574aba4ea factor some instcombine simplifications for getelementptr out to a new
SimplifyGEPInst method in InstructionSimplify.h.  No functionality change.

llvm-svn: 89980
2009-11-27 00:29:05 +00:00
Chris Lattner 4c88e814b8 teach memdep to do trivial PHI translation of GEPs. More to
come.

llvm-svn: 89979
2009-11-27 00:07:37 +00:00
Chris Lattner 9bd2136ca3 Teach memdep to phi translate bitcasts. This allows us to compile
the example in GCC PR16799 to:

LBB1_2:                                                     ## %bb1
	movl	%eax, %eax
	subq	%rax, %rdi
	movq	%rdi, (%rcx)
	movl	(%rdi), %eax
	testl	%eax, %eax
	je	LBB1_2

instead of:

LBB1_2:                                                     ## %bb1
	movl	(%rdi), %ecx
	subq	%rcx, %rdi
	movq	%rdi, (%rax)
	cmpl	$0, (%rdi)
	je	LBB1_2

llvm-svn: 89978
2009-11-26 23:41:07 +00:00
Chris Lattner dfaa592de1 convert to filecheck
llvm-svn: 89977
2009-11-26 23:32:59 +00:00
Nick Lewycky a75fe185ba Fix typo spotted by Gabor Greif.
llvm-svn: 89976
2009-11-26 23:19:05 +00:00
Chris Lattner c49f5ac7d8 factor some code out into some helper functions.
llvm-svn: 89975
2009-11-26 23:18:49 +00:00
Nick Lewycky 898e8f756a Clean up file, no functionality change.
llvm-svn: 89974
2009-11-26 22:54:26 +00:00
Chris Lattner 0f77ac2640 Add a hack for PR5601, a crash on obsolete syntax that we plan to
remove in LLVM 3.0

llvm-svn: 89973
2009-11-26 22:48:23 +00:00
Chris Lattner a5bc618a91 fix crash on Transforms/InstCombine/intrinsics.ll introduced by r89970
llvm-svn: 89972
2009-11-26 22:08:06 +00:00
Chris Lattner a73ecf0b00 Fix PR5471 by removing an instcombine xform. Some pieces of the code
generates store to undef and some generates store to null as the idiom
for undefined behavior.  Since simplifycfg zaps both, don't remove the
undefined behavior in instcombine.

llvm-svn: 89971
2009-11-26 22:04:42 +00:00
Chris Lattner 5b83ba215d implement a bunch of xforms for overflow intrinsics, based on a patch
by Alastair Lynn.

llvm-svn: 89970
2009-11-26 21:42:47 +00:00
Bob Wilson 9594db5693 Rename new TailDuplicationPass to avoid name conflict with the old one.
llvm-svn: 89968
2009-11-26 21:38:41 +00:00
Chris Lattner 5fe97e7aca @test9 is a testcase for r89958. Before 89958, we misanalyzed the
first expression as P+4+4*i which we considered to possibly alias
P+4*j.  Now we correctly analyze the former one as P+1+4*i.

@test10 is a sanity test that verfies that we know that P+4+4*i != P+4*i.

llvm-svn: 89960
2009-11-26 19:25:46 +00:00
Chris Lattner 1bf7ff704a Implement PR1143 (at -m64) by making basicaa look through extensions. We
previously already handled it at -m32 because there were no i32->i64 
extensions for addressing.

llvm-svn: 89959
2009-11-26 18:53:33 +00:00
Chris Lattner d7cabea8ca fix two transposed lines duncan caught and add an explanatory comment.
llvm-svn: 89958
2009-11-26 18:35:46 +00:00
Chris Lattner 9aa846956e this todo is resolved.
llvm-svn: 89957
2009-11-26 17:14:10 +00:00
Chris Lattner 29f82a1465 move DecomposeGEPExpression out into ValueTracking.cpp
llvm-svn: 89956
2009-11-26 17:12:50 +00:00
Chris Lattner 631c5b2cb9 teach GetLinearExpression to be a bit more aggressive.
llvm-svn: 89955
2009-11-26 17:00:01 +00:00
Chris Lattner 5c1cfc252c resolve a fixme. I haven't figured out how to write a testcase
to exercise this though.

llvm-svn: 89954
2009-11-26 16:52:32 +00:00
Chris Lattner ba0014a44c update status of this. basicaa is much improved now,
only missing the one form (in this testcase).  Dan, do you
consider this example to be important?

llvm-svn: 89953
2009-11-26 16:42:00 +00:00
Chris Lattner 29bc8a91d3 Teach basicaa that x|c == x+c when the c bits of x are clear. This
allows us to compile the example in readme.txt into:

LBB1_1:                                                     ## %bb
	movl	4(%rdx,%rax), %ecx
	movl	%ecx, %esi
	imull	(%rdx,%rax), %esi
	imull	%esi, %ecx
	movl	%esi, 8(%rdx,%rax)
	imull	%ecx, %esi
	movl	%ecx, 12(%rdx,%rax)
	movl	%esi, 16(%rdx,%rax)
	imull	%ecx, %esi
	movl	%esi, 20(%rdx,%rax)
	addq	$16, %rax
	cmpq	$4000, %rax
	jne	LBB1_1

instead of:

LBB1_1: 
	movl	(%rdx,%rax), %ecx
	imull	4(%rdx,%rax), %ecx
	movl	%ecx, 8(%rdx,%rax)
	imull	4(%rdx,%rax), %ecx
	movl	%ecx, 12(%rdx,%rax)
	imull	8(%rdx,%rax), %ecx
	movl	%ecx, 16(%rdx,%rax)
	imull	12(%rdx,%rax), %ecx
	movl	%ecx, 20(%rdx,%rax)
	addq	$16, %rax
	cmpq	$4000, %rax
	jne	LBB1_1

GCC (4.2) doesn't seem to be able to eliminate the loads in this 
testcase either, it generates:

L2:
	movl	(%rdx), %eax
	imull	4(%rdx), %eax
	movl	%eax, 8(%rdx)
	imull	4(%rdx), %eax
	movl	%eax, 12(%rdx)
	imull	8(%rdx), %eax
	movl	%eax, 16(%rdx)
	imull	12(%rdx), %eax
	movl	%eax, 20(%rdx)
	addl	$4, %ecx
	addq	$16, %rdx
	cmpl	$1002, %ecx
	jne	L2

llvm-svn: 89952
2009-11-26 16:26:43 +00:00
Chris Lattner 12dacdd359 teach basicaa that A[i] != A[i+1].
llvm-svn: 89951
2009-11-26 16:18:10 +00:00
Chris Lattner 453751031a rename test
llvm-svn: 89950
2009-11-26 16:08:41 +00:00
Chris Lattner 7a5b56aca9 Change the other half of aliasGEP (which handles GEP differencing) to use DecomposeGEPExpression. This dramatically simplifies and shrinks the code by eliminating the horrible CheckGEPInstructions method, fixes a miscompilation (@test3) and makes the code more aggressive. In particular, we now handle the @test4 case, which is reduced from the SmallPtrSet constructor. Missing this caused us to emit a variable length memset instead of a fixed size one.
llvm-svn: 89922
2009-11-26 02:17:34 +00:00
Chris Lattner 0d23076adf add a new random feature test
llvm-svn: 89921
2009-11-26 02:16:28 +00:00
Chris Lattner 5341c9679d Generalize DecomposeGEPExpression to exactly handle what Value::getUnderlyingObject does (when TD is around). This allows us to avoid calling DecomposeGEPExpression unless the ultimate alias check we care about passes, speedup up BasicAA a bit.
llvm-svn: 89920
2009-11-26 02:14:59 +00:00
Chris Lattner 8928899413 Implement a new DecomposeGEPExpression method, which decomposes a GEP into a list of scaled offsets. Use this to eliminate some previous ad-hoc code which was subtly broken (it assumed all Constant*'s were non-zero, but strange constant express could be zero).
llvm-svn: 89915
2009-11-26 02:13:03 +00:00
Chris Lattner a99edbedd1 Use GEPOperator more pervasively to simplify code.
llvm-svn: 89914
2009-11-26 02:11:08 +00:00
Chris Lattner 8e09ad6f3c update some notes slightly
llvm-svn: 89913
2009-11-26 01:51:18 +00:00
Chris Lattner 4f0b47d9e7 remove some redundant braces
llvm-svn: 89912
2009-11-26 01:50:12 +00:00
Evan Cheng a4c986cbdd Test for 89905.
llvm-svn: 89906
2009-11-26 00:35:01 +00:00
Evan Cheng 595a16300c When all defs of a vr are implicit_def, delete all of the defs.
llvm-svn: 89905
2009-11-26 00:32:36 +00:00
Bob Wilson 2d4ff12da9 Split tail duplication into a separate pass. This is needed to avoid
running tail duplication when doing branch folding for if-conversion, and
we also want to be able to run tail duplication earlier to fix some
reg alloc problems.  Move the CanFallThrough function from BranchFolding
to MachineBasicBlock so that it can be shared by TailDuplication.

llvm-svn: 89904
2009-11-26 00:32:21 +00:00
Dale Johannesen 979ac9fce4 Test for llvm-gcc checkin 89898.
llvm-svn: 89899
2009-11-25 23:50:09 +00:00
Devang Patel 4da997b936 Update to reflect recent debugging information encoding changes.
llvm-svn: 89896
2009-11-25 23:28:01 +00:00
Viktor Kutuzov 8981b3abe5 Rollback changes r89516: 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: 89893
2009-11-25 22:44:18 +00:00
Evan Cheng 44df27e964 ProcessImplicitDefs should watch out for invalidated iterator and extra implicit operands on copies.
llvm-svn: 89880
2009-11-25 21:13:39 +00:00
Bob Wilson 4419301d81 Tail duplicate indirect branches for PowerPC, too.
With the testcase for pr3120, the "threaded interpreter" runtime decreases
from 1788 to 1413 with this change.

llvm-svn: 89877
2009-11-25 19:57:14 +00:00
Benjamin Kramer 4cd30817d3 Avoid some possibly unsafe uses of StringRef::data().
llvm-svn: 89873
2009-11-25 18:26:09 +00:00
Devang Patel 2d9caf9fe5 Use StringRef (again) in DebugInfo interface.
llvm-svn: 89866
2009-11-25 17:36:49 +00:00
Bob Wilson 120f729eca Based on the testcase for pr3120, running on my MacPro with Xeon processors,
it is definitely profitable to tail duplicate indirect branches for x86.
This is likely to be true to various degrees for all modern x86 processors.

llvm-svn: 89865
2009-11-25 17:27:53 +00:00
Bruno Cardoso Lopes 2db07581b7 Support PIC loading of constant pool entries
llvm-svn: 89863
2009-11-25 12:17:58 +00:00
Edward O'Callaghan 87e82ced60 Adjust comments to new semantics.
llvm-svn: 89862
2009-11-25 12:00:34 +00:00
Daniel Dunbar 900f2ce31c Sketch structure for X86 disassembler.
llvm-svn: 89850
2009-11-25 06:53:08 +00:00
Edward O'Callaghan 746782dde5 API change Path::isSpecialFile to Path::isRegularFile, improve semantics in regards to comments from 89765 post review.
llvm-svn: 89848
2009-11-25 06:32:19 +00:00
Douglas Gregor 7baad7365a Perform explicit instantiations in the proper namespace, since Clang diagnoses this ill-formity.
llvm-svn: 89846
2009-11-25 06:04:18 +00:00
Edward O'Callaghan 2b8fed15e0 Reverting patch in revision 89758, initial attempt at fixing PR5373 has proven to be bogus.
llvm-svn: 89844
2009-11-25 05:38:41 +00:00
Daniel Dunbar e8b8ccefcb Add the rest of the build system logic for optional target disassemblers
llvm-svn: 89841
2009-11-25 04:46:58 +00:00
Daniel Dunbar 3202720933 Regenerate configure
llvm-svn: 89840
2009-11-25 04:37:28 +00:00
Daniel Dunbar f472129722 Add CMake and configure logic to create llvm/Config/Disassemblers.defs.
llvm-svn: 89839
2009-11-25 04:30:13 +00:00
Daniel Dunbar e502433d7f Sketch TableGen disassembler emitter, based on patch by Sean Callanan.
llvm-svn: 89833
2009-11-25 02:13:23 +00:00
Bruno Cardoso Lopes 2c6d498ccc Use endianess dependent offsets for load/store of doubles when
using two swc/lwc instead of sdc/ldc.

llvm-svn: 89826
2009-11-25 01:05:25 +00:00
Dale Johannesen e0eb336588 Fix compiler warnings.
llvm-svn: 89824
2009-11-25 00:58:21 +00:00
Bruno Cardoso Lopes fa2741e0d3 Only include in the callee saved regs the sub registers to avoid
unnecessary save/restore.

llvm-svn: 89823
2009-11-25 00:47:43 +00:00
Bruno Cardoso Lopes dce6f66cf0 Add proper emission of load/store double to stack slots for mips1 targets!
llvm-svn: 89821
2009-11-25 00:36:00 +00:00