oota-llvm.git
13 years agoRevert r123207: "Turn on memdep's verifyRemoved() in an attempt to smoke out the...
Jakob Stoklund Olesen [Tue, 11 Jan 2011 04:05:39 +0000 (04:05 +0000)]
Revert r123207: "Turn on memdep's verifyRemoved() in an attempt to smoke out the cause of our gcc bootstrap miscompare."

It didn't.

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

13 years agoSupport/Path: Deprecate PathV1::isDirectory and replace all uses with PathV2::is_dire...
Michael J. Spencer [Tue, 11 Jan 2011 01:21:55 +0000 (01:21 +0000)]
Support/Path: Deprecate PathV1::isDirectory and replace all uses with PathV2::is_directory.

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

13 years agoTurn on memdep's verifyRemoved() in an attempt to smoke out the cause of our gcc...
Jakob Stoklund Olesen [Tue, 11 Jan 2011 01:18:03 +0000 (01:18 +0000)]
Turn on memdep's verifyRemoved() in an attempt to smoke out the cause of our gcc bootstrap miscompare.

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

13 years agoTeach constant folding to perform conversions from constant floating
Chandler Carruth [Tue, 11 Jan 2011 01:07:24 +0000 (01:07 +0000)]
Teach constant folding to perform conversions from constant floating
point values to their integer representation through the SSE intrinsic
calls. This is the last part of a README.txt entry for which I have real
world examples.

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

13 years agoFileCheck-ize a test, and move a no-longer calling test case to another
Chandler Carruth [Tue, 11 Jan 2011 01:07:20 +0000 (01:07 +0000)]
FileCheck-ize a test, and move a no-longer calling test case to another
file and make it actually test something...

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

13 years agoFix a random missed optimization by making InstCombine more aggressive when determini...
Owen Anderson [Tue, 11 Jan 2011 00:36:45 +0000 (00:36 +0000)]
Fix a random missed optimization by making InstCombine more aggressive when determining which bits are demanded by
a comparison against a constant.

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

13 years agoMove ExpandAtomic into the integer expansion routines - it's only used there.
Eric Christopher [Tue, 11 Jan 2011 00:36:08 +0000 (00:36 +0000)]
Move ExpandAtomic into the integer expansion routines - it's only used there.

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

13 years agoEven if we don't have 7 bytes of stack space we may need to save and
Eric Christopher [Tue, 11 Jan 2011 00:16:04 +0000 (00:16 +0000)]
Even if we don't have 7 bytes of stack space we may need to save and
restore the stack pointer from the frame pointer on thumbv6.

Fixes rdar://8819685

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

13 years agoExpand on the safeness of restoring the sp from the fp a bit more.
Eric Christopher [Mon, 10 Jan 2011 23:10:59 +0000 (23:10 +0000)]
Expand on the safeness of restoring the sp from the fp a bit more.

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

13 years agoFix PR 8916 (qv for analysis), at least the immediate problem.
Dale Johannesen [Mon, 10 Jan 2011 21:53:07 +0000 (21:53 +0000)]
Fix PR 8916 (qv for analysis), at least the immediate problem.

There's an inherent tension in DAGCombine between assuming
that things will be put in canonical form, and the Depth
mechanism that disables transformations when recursion gets
too deep.  It would not surprise me if there's a lot of little
bugs like this one waiting to be discovered.  The mechanism
seems fragile and I'd suggest looking at it from a design viewpoint.

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

13 years ago+0.0 vs -0.0 differences can be handled by looking at the user of the
Chris Lattner [Mon, 10 Jan 2011 21:01:17 +0000 (21:01 +0000)]
+0.0 vs -0.0 differences can be handled by looking at the user of the
operation in some cases.

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

13 years agoMcARM: Flush out hard coded known non-predicated mnemonic list.
Daniel Dunbar [Mon, 10 Jan 2011 21:01:03 +0000 (21:01 +0000)]
McARM: Flush out hard coded known non-predicated mnemonic list.

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

13 years agoMcARM: Mark some T2 ...s instructions as codegen only, they aren't real
Daniel Dunbar [Mon, 10 Jan 2011 15:26:39 +0000 (15:26 +0000)]
McARM: Mark some T2 ...s instructions as codegen only, they aren't real
instructions but are restricted pseudo forms.

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

13 years agoARM/MC: Mark several '...S' instructions as codegen only, they aren't real
Daniel Dunbar [Mon, 10 Jan 2011 15:26:35 +0000 (15:26 +0000)]
ARM/MC: Mark several '...S' instructions as codegen only, they aren't real
instructions but are restricted pseudo forms.

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

13 years agoMC/ARM/AsmParser: Minor nitty fixes.
Daniel Dunbar [Mon, 10 Jan 2011 15:26:21 +0000 (15:26 +0000)]
MC/ARM/AsmParser: Minor nitty fixes.

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

13 years agoMC/AsmMatcher: Fix indirect 80-col viola.
Daniel Dunbar [Mon, 10 Jan 2011 15:26:11 +0000 (15:26 +0000)]
MC/AsmMatcher: Fix indirect 80-col viola.

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

13 years agoFix merge fallout
Anton Korobeynikov [Mon, 10 Jan 2011 12:56:18 +0000 (12:56 +0000)]
Fix merge fallout

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

13 years agoUpdate CMake stuff
Anton Korobeynikov [Mon, 10 Jan 2011 12:39:23 +0000 (12:39 +0000)]
Update CMake stuff

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

13 years agoRename TargetFrameInfo into TargetFrameLowering. Also, put couple of FIXMEs and fixes...
Anton Korobeynikov [Mon, 10 Jan 2011 12:39:04 +0000 (12:39 +0000)]
Rename TargetFrameInfo into TargetFrameLowering. Also, put couple of FIXMEs and fixes here and there.

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

13 years agoMC/ARM/AsmParser: Split out SplitMnemonicAndCC().
Daniel Dunbar [Mon, 10 Jan 2011 12:24:52 +0000 (12:24 +0000)]
MC/ARM/AsmParser: Split out SplitMnemonicAndCC().

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

13 years agoCleanup some of the constant folding code to consistently test intrinsic
Chandler Carruth [Mon, 10 Jan 2011 09:02:58 +0000 (09:02 +0000)]
Cleanup some of the constant folding code to consistently test intrinsic
IDs when available rather than using a mixture of IDs and textual name
comparisons.

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

13 years agofit in 80 cols and use MBB::isSuccessor instead of a hand
Chris Lattner [Mon, 10 Jan 2011 07:51:31 +0000 (07:51 +0000)]
fit in 80 cols and use MBB::isSuccessor instead of a hand
rolled std::find.

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

13 years agoTeach instcombine about the rest of the SSE and SSE2 conversion
Chandler Carruth [Mon, 10 Jan 2011 07:19:37 +0000 (07:19 +0000)]
Teach instcombine about the rest of the SSE and SSE2 conversion
intrinsics element dependencies. Reviewed by Nick.

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

13 years agoSimplify a bunch of isVirtualRegister() and isPhysicalRegister() logic.
Jakob Stoklund Olesen [Mon, 10 Jan 2011 02:58:51 +0000 (02:58 +0000)]
Simplify a bunch of isVirtualRegister() and isPhysicalRegister() logic.

These functions not longer assert when passed 0, but simply return false instead.

No functional change intended.

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

13 years agoFold two related tests into the newly FileCheck-ized test, migrating
Chandler Carruth [Mon, 10 Jan 2011 02:53:58 +0000 (02:53 +0000)]
Fold two related tests into the newly FileCheck-ized test, migrating
them to FileCheck as well.

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

13 years agoClean up and FileCheck-ize a test.
Chandler Carruth [Mon, 10 Jan 2011 02:53:54 +0000 (02:53 +0000)]
Clean up and FileCheck-ize a test.

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

13 years agoFix Whitespace.
Michael J. Spencer [Mon, 10 Jan 2011 02:34:40 +0000 (02:34 +0000)]
Fix Whitespace.

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

13 years agoSupport/Path: Deprecate PathV1::exists and replace all uses with PathV2::fs::exists.
Michael J. Spencer [Mon, 10 Jan 2011 02:34:23 +0000 (02:34 +0000)]
Support/Path: Deprecate PathV1::exists and replace all uses with PathV2::fs::exists.

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

13 years agoanother random stab in the dark trying to fix llvm-gcc-i386-linux-selfhost
Chris Lattner [Mon, 10 Jan 2011 02:34:11 +0000 (02:34 +0000)]
another random stab in the dark trying to fix llvm-gcc-i386-linux-selfhost

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

13 years agofix typo
Chris Lattner [Mon, 10 Jan 2011 02:33:34 +0000 (02:33 +0000)]
fix typo

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

13 years agoanother (more) aggressive attempt to bring llvm-gcc-i386-linux-selfhost
Chris Lattner [Mon, 10 Jan 2011 00:47:34 +0000 (00:47 +0000)]
another (more) aggressive attempt to bring llvm-gcc-i386-linux-selfhost
back to life.

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

13 years agoexpand on a note
Chris Lattner [Mon, 10 Jan 2011 00:33:01 +0000 (00:33 +0000)]
expand on a note

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

13 years agotemporarily disable memset formation from memsets in an effort to restore buildbot...
Chris Lattner [Sun, 9 Jan 2011 23:52:48 +0000 (23:52 +0000)]
temporarily disable memset formation from memsets in an effort to restore buildbot stability.

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

13 years agoadd a testcase I missed in previous commit.
Chris Lattner [Sun, 9 Jan 2011 23:52:31 +0000 (23:52 +0000)]
add a testcase I missed in previous commit.

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

13 years agotypo
Chris Lattner [Sun, 9 Jan 2011 23:48:41 +0000 (23:48 +0000)]
typo

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

13 years agoxref a PR #
Chris Lattner [Sun, 9 Jan 2011 23:42:22 +0000 (23:42 +0000)]
xref a PR #

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

13 years agoRemove TargetRegisterInfo::NoRegister.
Jakob Stoklund Olesen [Sun, 9 Jan 2011 23:20:48 +0000 (23:20 +0000)]
Remove TargetRegisterInfo::NoRegister.

Fix the TargetRegisterInfo::NoRegister places where someone preferred
typing 'TargetRegisterInfo::NoRegister' instead of typing '0'.

Note that TableGen is already emitting xx::NoRegister in xxGenRegisterNames.inc.

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

13 years agoadd a fixme: ir isn't expressive enough.
Chris Lattner [Sun, 9 Jan 2011 23:02:10 +0000 (23:02 +0000)]
add a fixme: ir isn't expressive enough.

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

13 years agoStep #4 in improving trip count analysis: HowFarToZero can analyze
Chris Lattner [Sun, 9 Jan 2011 22:58:47 +0000 (22:58 +0000)]
Step #4 in improving trip count analysis: HowFarToZero can analyze
NUW AddRec's much more aggressively.  We now get a trip count
for @test2 in nsw.ll

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

13 years agoChange virtual register numbering to make more space for physical registers.
Jakob Stoklund Olesen [Sun, 9 Jan 2011 22:42:48 +0000 (22:42 +0000)]
Change virtual register numbering to make more space for physical registers.

The numbering plan is now:

0           NoRegister.
[1;2^30)    Physical registers.
[2^30;2^31) Stack slots.
[2^31;2^32) Virtual registers. (With -1u and -2u used by DenseMapInfo.)

Each segment is filled from the left, so any mistaken interpretation should
quickly cause crashes.

FirstVirtualRegister has been removed. TargetRegisterInfo provides predicates
conversion functions that should be used instead of interpreting register
numbers manually.

It is now legal to pass NoRegister to isPhysicalRegister() and
isVirtualRegister(). The result is false in both cases.

It is quite rare to represent stack slots in this way, so isPhysicalRegister()
and isVirtualRegister() require that isStackSlot() be checked first if it can
possibly return true. This allows a very fast implementation of the common
predicates.

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

13 years agorearrange some code, no functionality change.
Chris Lattner [Sun, 9 Jan 2011 22:39:48 +0000 (22:39 +0000)]
rearrange some code, no functionality change.

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

13 years agoAdd a note about the inability to model FP -> int conversions which
Chandler Carruth [Sun, 9 Jan 2011 22:36:18 +0000 (22:36 +0000)]
Add a note about the inability to model FP -> int conversions which
perform rounding other than truncation in the IR. Common C code for this
turns into really an LLVM intrinsic call that blocks a lot of further
optimizations.

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

13 years agoStep #3 to improving trip count analysis: If we fold
Chris Lattner [Sun, 9 Jan 2011 22:31:26 +0000 (22:31 +0000)]
Step #3 to improving trip count analysis: If we fold
a + {b,+,stride} into {a+b,+,stride}  (because a is LIV),
then the resultant AddRec is NUW/NSW if the client says it
is.

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

13 years agoStep #2 to improve trip count analysis for loops like this:
Chris Lattner [Sun, 9 Jan 2011 22:26:35 +0000 (22:26 +0000)]
Step #2 to improve trip count analysis for loops like this:

void f(int* begin, int* end) { std::fill(begin, end, 0); }

which turns into a != exit expression where one pointer is
strided and (thanks to step #1) known to not overflow, and
the other is loop invariant.

The observation here is that, though the IV is strided by
4 in this case, that the IV *has* to become equal to the
end value.  It cannot "miss" the end value by stepping over
it, because if it did, the strided IV expression would
eventually wrap around.

Handle this by turning A != B into "A-B != 0" where the A-B
part is known to be NUW.

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

13 years agoRemove MachineRegisterInfo::getLastVirtReg(), it was giving wrong results
Jakob Stoklund Olesen [Sun, 9 Jan 2011 21:58:20 +0000 (21:58 +0000)]
Remove MachineRegisterInfo::getLastVirtReg(), it was giving wrong results
when no virtual registers have been allocated.

It was only used to resize IndexedMaps, so provide an IndexedMap::resize()
method such that

 Map.grow(MRI.getLastVirtReg());

can be replaced with the simpler

 Map.resize(MRI.getNumVirtRegs());

This works correctly when no virtuals are allocated, and it bypasses the to/from
index conversions.

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

13 years agosort this.
Chris Lattner [Sun, 9 Jan 2011 21:31:39 +0000 (21:31 +0000)]
sort this.

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

13 years agoTeach TargetRegisterInfo how to cram stack slot indexes in with the virtual and
Jakob Stoklund Olesen [Sun, 9 Jan 2011 21:17:37 +0000 (21:17 +0000)]
Teach TargetRegisterInfo how to cram stack slot indexes in with the virtual and
physical register numbers.

This makes the hack used in LiveInterval official, and lets LiveInterval be
oblivious of stack slots.

The isPhysicalRegister() and isVirtualRegister() predicates don't know about
this, so when a variable may contain a stack slot, isStackSlot() should always
be tested first.

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

13 years agoAdd a note about a missed FP optimization.
Chandler Carruth [Sun, 9 Jan 2011 21:00:19 +0000 (21:00 +0000)]
Add a note about a missed FP optimization.

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

13 years agoFix comment.
Jakob Stoklund Olesen [Sun, 9 Jan 2011 19:45:45 +0000 (19:45 +0000)]
Fix comment.

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

13 years agofix a few old bugs (found by inspection) where we would zap instructions
Chris Lattner [Sun, 9 Jan 2011 19:26:10 +0000 (19:26 +0000)]
fix a few old bugs (found by inspection) where we would zap instructions
without informing memdep.  This could cause nondeterminstic weirdness
based on where instructions happen to get allocated, and will hopefully
breath some life into some broken testers.

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

13 years agoAdd a forgotten VireReg2IndexFunctor.
Jakob Stoklund Olesen [Sun, 9 Jan 2011 18:58:33 +0000 (18:58 +0000)]
Add a forgotten VireReg2IndexFunctor.

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

13 years agoApply -fPIC to C sources too.
Oscar Fuentes [Sun, 9 Jan 2011 17:38:31 +0000 (17:38 +0000)]
Apply -fPIC to C sources too.

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

13 years agoInstcombine: Fix pattern where the sext did not dominate the icmp using it
Tobias Grosser [Sun, 9 Jan 2011 16:00:11 +0000 (16:00 +0000)]
Instcombine: Fix pattern where the sext did not dominate the icmp using it

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

13 years agoDominatorTree->print() now prints the status of the DFSNumbers correctly
Tobias Grosser [Sun, 9 Jan 2011 16:00:09 +0000 (16:00 +0000)]
DominatorTree->print() now prints the status of the DFSNumbers correctly

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

13 years agoRewrite handling of LLVM_ENABLE_PIC. It was being processed after
Oscar Fuentes [Sun, 9 Jan 2011 14:34:39 +0000 (14:34 +0000)]
Rewrite handling of LLVM_ENABLE_PIC. It was being processed after
config.h was generated, so it had no effect on it.

Thanks to arrowdodger for pointing out this and a tentative patch.

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

13 years agoLoopInstSimplify preserves LoopSimplify.
Cameron Zwarich [Sun, 9 Jan 2011 12:35:16 +0000 (12:35 +0000)]
LoopInstSimplify preserves LoopSimplify.

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

13 years agoAnother missed memset in std::vector initialization.
Chandler Carruth [Sun, 9 Jan 2011 11:29:57 +0000 (11:29 +0000)]
Another missed memset in std::vector initialization.

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

13 years agoEliminate some extra hash table lookups.
Cameron Zwarich [Sun, 9 Jan 2011 10:54:21 +0000 (10:54 +0000)]
Eliminate some extra hash table lookups.

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

13 years agoAdd an informative comment.
Cameron Zwarich [Sun, 9 Jan 2011 10:32:30 +0000 (10:32 +0000)]
Add an informative comment.

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

13 years agoFix a cut-paste-o so that the sample code is correct for my last note.
Chandler Carruth [Sun, 9 Jan 2011 10:10:59 +0000 (10:10 +0000)]
Fix a cut-paste-o so that the sample code is correct for my last note.

Also, switch to a more clear 'sink' function with its declaration to
avoid any confusion about 'g'. Thanks for the suggestion Frits.

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

13 years agoAnother missed optimization of trivial vector code.
Chandler Carruth [Sun, 9 Jan 2011 09:58:36 +0000 (09:58 +0000)]
Another missed optimization of trivial vector code.

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

13 years agoAdd a note about vector's size-constructor producing dead stores.
Chandler Carruth [Sun, 9 Jan 2011 09:58:33 +0000 (09:58 +0000)]
Add a note about vector's size-constructor producing dead stores.

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

13 years agoSimplify LiveDebugVariables by storing MachineOperand copies locations instead
Jakob Stoklund Olesen [Sun, 9 Jan 2011 05:33:21 +0000 (05:33 +0000)]
Simplify LiveDebugVariables by storing MachineOperand copies locations instead
of using a Location class with the same information.

When making a copy of a MachineOperand that was already stored in a
MachineInstr, it is necessary to clear the parent pointer on the copy. Otherwise
the register use-def lists become inconsistent.

Add MachineOperand::clearParent() to do that. An alternative would be a custom
MachineOperand copy constructor that cleared ParentMI. I didn't want to do that
because of the performance impact.

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

13 years agoShrink a BitVector that didn't mean to store bits for all physical registers.
Jakob Stoklund Olesen [Sun, 9 Jan 2011 03:45:44 +0000 (03:45 +0000)]
Shrink a BitVector that didn't mean to store bits for all physical registers.

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

13 years agoReplace TargetRegisterInfo::printReg with a PrintReg class that also works without...
Jakob Stoklund Olesen [Sun, 9 Jan 2011 03:05:53 +0000 (03:05 +0000)]
Replace TargetRegisterInfo::printReg with a PrintReg class that also works without a TRI instance.

Print virtual registers numbered from 0 instead of the arbitrary
FirstVirtualRegister. The first virtual register is printed as %vreg0.
TRI::NoRegister is printed as %noreg.

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

13 years agoUse IndexedMap for MachineRegisterInfo as well. No functional change.
Jakob Stoklund Olesen [Sun, 9 Jan 2011 03:05:46 +0000 (03:05 +0000)]
Use IndexedMap for MachineRegisterInfo as well. No functional change.

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

13 years agoteach SCEV analysis of PHI nodes that PHI recurences formed
Chris Lattner [Sun, 9 Jan 2011 02:28:48 +0000 (02:28 +0000)]
teach SCEV analysis of PHI nodes that PHI recurences formed
with GEP instructions are always NUW, because PHIs cannot wrap
the end of the address space.

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

13 years agoreduce indentation. Print <nuw> and <nsw> when dumping SCEV AddRec's
Chris Lattner [Sun, 9 Jan 2011 02:16:18 +0000 (02:16 +0000)]
reduce indentation.  Print <nuw> and <nsw> when dumping SCEV AddRec's
that have the bit set.

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

13 years agoAdd a note about a missed memset optimization from std::fill.
Chandler Carruth [Sun, 9 Jan 2011 01:32:55 +0000 (01:32 +0000)]
Add a note about a missed memset optimization from std::fill.

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

13 years agoFix the last virtual register enumerations.
Jakob Stoklund Olesen [Sat, 8 Jan 2011 23:11:11 +0000 (23:11 +0000)]
Fix the last virtual register enumerations.

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

13 years agoFix VirtRegMap to use TRI::index2VirtReg and TRI::virtReg2Index instead of
Jakob Stoklund Olesen [Sat, 8 Jan 2011 23:11:07 +0000 (23:11 +0000)]
Fix VirtRegMap to use TRI::index2VirtReg and TRI::virtReg2Index instead of
depending on TRI::FirstVirtualRegister.

Also use TRI::printReg instead of printing virtual registers directly.

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

13 years agoFix a MachineVerifier loop that probably didn't mean to skip the last two
Jakob Stoklund Olesen [Sat, 8 Jan 2011 23:11:02 +0000 (23:11 +0000)]
Fix a MachineVerifier loop that probably didn't mean to skip the last two
virtual registers.

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

13 years agoDon't document exactly how virtual registers are represented as integers. Code
Jakob Stoklund Olesen [Sat, 8 Jan 2011 23:10:59 +0000 (23:10 +0000)]
Don't document exactly how virtual registers are represented as integers. Code
shouldn't depend directly on that.

Give an example of how to iterate over all virtual registers in a function
without depending on the representation.

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

13 years agoUse an IndexedMap for LiveVariables::VirtRegInfo.
Jakob Stoklund Olesen [Sat, 8 Jan 2011 23:10:57 +0000 (23:10 +0000)]
Use an IndexedMap for LiveVariables::VirtRegInfo.

Provide MRI::getNumVirtRegs() and TRI::index2VirtReg() functions to allow
iteration over virtual registers without depending on the representation of
virtual register numbers.

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

13 years agoDo not talk about TargetRegisterInfo::FirstVirtualRegister.
Jakob Stoklund Olesen [Sat, 8 Jan 2011 23:10:53 +0000 (23:10 +0000)]
Do not talk about TargetRegisterInfo::FirstVirtualRegister.

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

13 years agoUse an IndexedMap for LiveOutRegInfo to hide its dependence on TargetRegisterInfo...
Jakob Stoklund Olesen [Sat, 8 Jan 2011 23:10:50 +0000 (23:10 +0000)]
Use an IndexedMap for LiveOutRegInfo to hide its dependence on TargetRegisterInfo::FirstVirtualRegister.

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

13 years agoFix coding style.
Cameron Zwarich [Sat, 8 Jan 2011 22:36:53 +0000 (22:36 +0000)]
Fix coding style.

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

13 years agofix a latent bug in memcpyoptimizer that my recent patches exposed: it wasn't
Chris Lattner [Sat, 8 Jan 2011 22:19:21 +0000 (22:19 +0000)]
fix a latent bug in memcpyoptimizer that my recent patches exposed: it wasn't
updating memdep when fusing stores together.  This fixes the crash optimizing
the bullet benchmark.

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

13 years agotryMergingIntoMemset can only handle constant length memsets.
Chris Lattner [Sat, 8 Jan 2011 22:11:56 +0000 (22:11 +0000)]
tryMergingIntoMemset can only handle constant length memsets.

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

13 years agoMerge memsets followed by neighboring memsets and other stores into
Chris Lattner [Sat, 8 Jan 2011 21:19:19 +0000 (21:19 +0000)]
Merge memsets followed by neighboring memsets and other stores into
larger memsets.  Among other things, this fixes rdar://8760394 and
allows us to handle "Example 2" from http://blog.regehr.org/archives/320,
compiling it into a single 4096-byte memset:

_mad_synth_mute:                        ## @mad_synth_mute
## BB#0:                                ## %entry
pushq %rax
movl $4096, %esi             ## imm = 0x1000
callq ___bzero
popq %rax
ret

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

13 years agofix an issue in IsPointerOffset that prevented us from recognizing that
Chris Lattner [Sat, 8 Jan 2011 21:07:56 +0000 (21:07 +0000)]
fix an issue in IsPointerOffset that prevented us from recognizing that
P and P+1 are relative to the same base pointer.

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

13 years agoenhance memcpyopt to merge a store and a subsequent
Chris Lattner [Sat, 8 Jan 2011 20:54:51 +0000 (20:54 +0000)]
enhance memcpyopt to merge a store and a subsequent
memset into a single larger memset.

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

13 years agofit in 80 cols
Chris Lattner [Sat, 8 Jan 2011 20:53:41 +0000 (20:53 +0000)]
fit in 80 cols

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

13 years agomerge two tests and filecheckify
Chris Lattner [Sat, 8 Jan 2011 20:27:22 +0000 (20:27 +0000)]
merge two tests and filecheckify

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

13 years agoconstify TargetData references.
Chris Lattner [Sat, 8 Jan 2011 20:24:01 +0000 (20:24 +0000)]
constify TargetData references.
Split memset formation logic out into its own
"tryMergingIntoMemset" helper function.

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

13 years agoWhen loop rotation happens, it is *very* common for the duplicated condbr
Chris Lattner [Sat, 8 Jan 2011 19:59:06 +0000 (19:59 +0000)]
When loop rotation happens, it is *very* common for the duplicated condbr
to be foldable into an uncond branch.  When this happens, we can make a
much simpler CFG for the loop, which is important for nested loop cases
where we want the outer loop to be aggressively optimized.

Handle this case more aggressively.  For example, previously on
phi-duplicate.ll we would get this:

define void @test(i32 %N, double* %G) nounwind ssp {
entry:
  %cmp1 = icmp slt i64 1, 1000
  br i1 %cmp1, label %bb.nph, label %for.end

bb.nph:                                           ; preds = %entry
  br label %for.body

for.body:                                         ; preds = %bb.nph, %for.cond
  %j.02 = phi i64 [ 1, %bb.nph ], [ %inc, %for.cond ]
  %arrayidx = getelementptr inbounds double* %G, i64 %j.02
  %tmp3 = load double* %arrayidx
  %sub = sub i64 %j.02, 1
  %arrayidx6 = getelementptr inbounds double* %G, i64 %sub
  %tmp7 = load double* %arrayidx6
  %add = fadd double %tmp3, %tmp7
  %arrayidx10 = getelementptr inbounds double* %G, i64 %j.02
  store double %add, double* %arrayidx10
  %inc = add nsw i64 %j.02, 1
  br label %for.cond

for.cond:                                         ; preds = %for.body
  %cmp = icmp slt i64 %inc, 1000
  br i1 %cmp, label %for.body, label %for.cond.for.end_crit_edge

for.cond.for.end_crit_edge:                       ; preds = %for.cond
  br label %for.end

for.end:                                          ; preds = %for.cond.for.end_crit_edge, %entry
  ret void
}

Now we get the much nicer:

define void @test(i32 %N, double* %G) nounwind ssp {
entry:
  br label %for.body

for.body:                                         ; preds = %entry, %for.body
  %j.01 = phi i64 [ 1, %entry ], [ %inc, %for.body ]
  %arrayidx = getelementptr inbounds double* %G, i64 %j.01
  %tmp3 = load double* %arrayidx
  %sub = sub i64 %j.01, 1
  %arrayidx6 = getelementptr inbounds double* %G, i64 %sub
  %tmp7 = load double* %arrayidx6
  %add = fadd double %tmp3, %tmp7
  %arrayidx10 = getelementptr inbounds double* %G, i64 %j.01
  store double %add, double* %arrayidx10
  %inc = add nsw i64 %j.01, 1
  %cmp = icmp slt i64 %inc, 1000
  br i1 %cmp, label %for.body, label %for.end

for.end:                                          ; preds = %for.body
  ret void
}

With all of these recent changes, we are now able to compile:

void foo(char *X) {
 for (int i = 0; i != 100; ++i)
   for (int j = 0; j != 100; ++j)
     X[j+i*100] = 0;
}

into a single memset of 10000 bytes.  This series of changes
should also be helpful for other nested loop scenarios as well.

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

13 years agomake domtree verification print something useful on failure.
Chris Lattner [Sat, 8 Jan 2011 19:55:55 +0000 (19:55 +0000)]
make domtree verification print something useful on failure.

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

13 years agosplit ssa updating code out to its own helper function. Don't bother
Chris Lattner [Sat, 8 Jan 2011 19:26:33 +0000 (19:26 +0000)]
split ssa updating code out to its own helper function.  Don't bother
moving the OrigHeader block anymore: we just merge it away anyway so
its code layout doesn't matter.

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

13 years agoImplement a TODO: Enhance loopinfo to merge away the unconditional branch
Chris Lattner [Sat, 8 Jan 2011 19:10:28 +0000 (19:10 +0000)]
Implement a TODO: Enhance loopinfo to merge away the unconditional branch
that it was leaving in loops after rotation (between the original latch
block and the original header.

With this change, it is possible for rotated loops to have just a single
basic block, which is useful.

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

13 years agovarious code cleanups, enhance MergeBlockIntoPredecessor to preserve
Chris Lattner [Sat, 8 Jan 2011 19:08:40 +0000 (19:08 +0000)]
various code cleanups, enhance MergeBlockIntoPredecessor to preserve
loop info.

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

13 years agoinline preserveCanonicalLoopForm now that it is simple.
Chris Lattner [Sat, 8 Jan 2011 18:55:50 +0000 (18:55 +0000)]
inline preserveCanonicalLoopForm now that it is simple.

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

13 years agoThree major changes:
Chris Lattner [Sat, 8 Jan 2011 18:52:51 +0000 (18:52 +0000)]
Three major changes:
1. Rip out LoopRotate's domfrontier updating code.  It isn't
   needed now that LICM doesn't use DF and it is super complex
   and gross.
2. Make DomTree updating code a lot simpler and faster.  The
   old loop over all the blocks was just to find a block??
3. Change the code that inserts the new preheader to just use
   SplitCriticalEdge instead of doing an overcomplex
   reimplementation of it.

No behavior change, except for the name of the inserted preheader.

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

13 years agoreduce nesting.
Chris Lattner [Sat, 8 Jan 2011 18:47:43 +0000 (18:47 +0000)]
reduce nesting.

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

13 years agoOn Windows, replace each occurrence of '\' by '\\' on the replacement string. This...
Francois Pichet [Sat, 8 Jan 2011 18:09:48 +0000 (18:09 +0000)]
On Windows, replace each occurrence of '\' by '\\' on the replacement string. This is necessary to prevent re.sub from replacing escape sequences occurring in path.

For example:

llvm\tools\clang\test
was replaced by
llvm <tab> ools\clang <tab> est

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

13 years agoLoopRotate requires canonical loop form, so it always has preheaders
Chris Lattner [Sat, 8 Jan 2011 18:06:22 +0000 (18:06 +0000)]
LoopRotate requires canonical loop form, so it always has preheaders
and latch blocks.  Reorder entry conditions to make hte pass faster
and more logical.

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

13 years agouse the LI ivar.
Chris Lattner [Sat, 8 Jan 2011 17:49:51 +0000 (17:49 +0000)]
use the LI ivar.

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

13 years agosome cleanups: remove dead arguments and eliminate ivars
Chris Lattner [Sat, 8 Jan 2011 17:48:33 +0000 (17:48 +0000)]
some cleanups: remove dead arguments and eliminate ivars
that are just passed to one function.

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

13 years agofix an issue duncan pointed out, which could cause loop rotate
Chris Lattner [Sat, 8 Jan 2011 17:38:45 +0000 (17:38 +0000)]
fix an issue duncan pointed out, which could cause loop rotate
to violate LCSSA form

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

13 years agoFix coding style issues.
Cameron Zwarich [Sat, 8 Jan 2011 17:07:11 +0000 (17:07 +0000)]
Fix coding style issues.

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

13 years agoMake more passes preserve dominators (or state that they preserve dominators if
Cameron Zwarich [Sat, 8 Jan 2011 17:01:52 +0000 (17:01 +0000)]
Make more passes preserve dominators (or state that they preserve dominators if
they all ready do). This removes two dominator recomputations prior to isel,
which is a 1% improvement in total llc time for 403.gcc.

The only potentially suspect thing is making GCStrategy recompute dominators if
it used a custom lowering strategy.

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