Chris Lattner
23f61a09af
enhance memcpyopt to obey -fno-builtin and friends. This addresses a
...
problem reported on cfe-dev.
llvm-svn: 130661
2011-05-01 18:27:11 +00:00
Chris Lattner
0ab5e2cded
Fix a ton of comment typos found by codespell. Patch by
...
Luis Felipe Strano Moraes!
llvm-svn: 129558
2011-04-15 05:18:47 +00:00
Duncan Sands
75b5d27b84
Spelling fix: consequtive -> consecutive.
...
llvm-svn: 125563
2011-02-15 09:23:02 +00:00
Dan Gohman
19e30d5a7d
Actually check memcpy lengths, instead of just commenting about
...
how they should be checked.
llvm-svn: 123999
2011-01-21 22:07:57 +00:00
Chris Lattner
dd5f60b7a7
revert 123144, reenabling the rest of memset formation.
...
llvm-svn: 123302
2011-01-12 03:25:15 +00:00
Chris Lattner
654098f411
revert r123146 which disabled code that wasn't the root cause
...
of the bootstrap miscompare issue.
llvm-svn: 123299
2011-01-12 01:52:23 +00:00
Chris Lattner
fa7c29d255
revert r123149, reenabling an improvement to memcpyopt that wasn't
...
the source of the bootstrap problem.
llvm-svn: 123298
2011-01-12 01:43:46 +00:00
Chris Lattner
88bc848ab6
another random stab in the dark trying to fix llvm-gcc-i386-linux-selfhost
...
llvm-svn: 123149
2011-01-10 02:34:11 +00:00
Chris Lattner
4662bd4b13
another (more) aggressive attempt to bring llvm-gcc-i386-linux-selfhost
...
back to life.
llvm-svn: 123146
2011-01-10 00:47:34 +00:00
Chris Lattner
1017fa6746
temporarily disable memset formation from memsets in an effort to restore buildbot stability.
...
llvm-svn: 123144
2011-01-09 23:52:48 +00:00
Chris Lattner
caf5c0d037
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.
llvm-svn: 123124
2011-01-09 19:26:10 +00:00
Chris Lattner
7d6433ae76
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.
llvm-svn: 123091
2011-01-08 22:19:21 +00:00
Chris Lattner
ff6ed2ac5f
tryMergingIntoMemset can only handle constant length memsets.
...
llvm-svn: 123090
2011-01-08 22:11:56 +00:00
Chris Lattner
9a1d63ba9f
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
llvm-svn: 123089
2011-01-08 21:19:19 +00:00
Chris Lattner
5120ebf184
fix an issue in IsPointerOffset that prevented us from recognizing that
...
P and P+1 are relative to the same base pointer.
llvm-svn: 123087
2011-01-08 21:07:56 +00:00
Chris Lattner
4dc1fd938f
enhance memcpyopt to merge a store and a subsequent
...
memset into a single larger memset.
llvm-svn: 123086
2011-01-08 20:54:51 +00:00
Chris Lattner
c638147e9f
constify TargetData references.
...
Split memset formation logic out into its own
"tryMergingIntoMemset" helper function.
llvm-svn: 123081
2011-01-08 20:24:01 +00:00
Chris Lattner
6cf8d6cc6e
start using irbuilder to make mem intrinsics in a few passes.
...
llvm-svn: 122572
2010-12-26 22:57:41 +00:00
Chris Lattner
9cb1035f94
move isBytewiseValue out to ValueTracking.h/cpp
...
llvm-svn: 122565
2010-12-26 20:15:01 +00:00
Benjamin Kramer
30342fb1fd
Simplify code.
...
llvm-svn: 122561
2010-12-26 15:23:45 +00:00
Benjamin Kramer
b90b2f0635
Fix a thinko pointed out by Frits van Bommel: looking through global variables in isBytewiseValue is not safe.
...
llvm-svn: 122550
2010-12-24 22:23:59 +00:00
Benjamin Kramer
ea9152e551
MemCpyOpt: Turn memcpys from a constant into a memset if possible.
...
This allows us to compile "int cst[] = {-1, -1, -1};" into
movl $-1, 16(%rsp)
movq $-1, 8(%rsp)
instead of
movl _cst+8(%rip), %eax
movl %eax, 16(%rsp)
movq _cst(%rip), %rax
movq %rax, 8(%rsp)
llvm-svn: 122548
2010-12-24 21:17:12 +00:00
Jeffrey Yasskin
9b43f33620
Change all self assignments X=X to (void)X, so that we can turn on a
...
new gcc warning that complains on self-assignments and
self-initializations.
llvm-svn: 122458
2010-12-23 00:58:24 +00:00
Dan Gohman
e1a17a3473
Make memcpyopt TBAA-aware.
...
llvm-svn: 121944
2010-12-16 02:51:19 +00:00
Chris Lattner
bc4457e317
enhance memcpyopt to zap memcpy's that have the same src/dst.
...
llvm-svn: 121362
2010-12-09 07:45:45 +00:00
Chris Lattner
fd51c52ef6
fix PR8753, eliminating a case where we'd infinitely make a
...
substitution because it doesn't actually change the IR. Patch by
Jakub Staszak!
llvm-svn: 121361
2010-12-09 07:39:50 +00:00
Jay Foad
583abbc4df
PR5207: Change APInt methods trunc(), sext(), zext(), sextOrTrunc() and
...
zextOrTrunc(), and APSInt methods extend(), extOrTrunc() and new method
trunc(), to be const and to return a new value instead of modifying the
object in place.
llvm-svn: 121120
2010-12-07 08:25:19 +00:00
Chris Lattner
1c577b54b0
fix a bozo bug I introduced in r119930, causing a miscompile of
...
20040709-1.c from the gcc testsuite. I was using the size of a
pointer instead of the pointee. This fixes rdar://8713376
llvm-svn: 120519
2010-12-01 01:24:55 +00:00
Chris Lattner
b4df1d5a3e
prune an llvmcontext include and simplify some code.
...
llvm-svn: 120347
2010-11-29 23:35:33 +00:00
Chris Lattner
fc9aead6fd
fix comment
...
llvm-svn: 119948
2010-11-21 19:05:34 +00:00
Chris Lattner
5957229659
rework some DSE paths to use the newly-public "getPointerDependencyFrom"
...
method in MemDep instead of inserting an instruction, doing a query,
then removing it. Neither operation is effectively cached.
llvm-svn: 119930
2010-11-21 08:06:10 +00:00
Chris Lattner
58f9f58716
Implement PR8644: forwarding a memcpy value to a byval,
...
allowing the memcpy to be eliminated.
Unfortunately, the requirements on byval's without explicit
alignment are really weak and impossible to predict in the
mid-level optimizer, so this doesn't kick in much with current
frontends. The fix is to change clang to set alignment on all
byval arguments.
llvm-svn: 119916
2010-11-21 00:28:59 +00:00
Benjamin Kramer
ddd1b7b801
Simplify code. No change in functionality.
...
llvm-svn: 119908
2010-11-20 18:43:35 +00:00
Chris Lattner
1385dff8c0
slightly simplify code and substantially improve comment. Instead of
...
saying "it would be bad", give an example of what is going on.
llvm-svn: 119695
2010-11-18 08:07:09 +00:00
Chris Lattner
731caac7c6
remove a pointless restriction from memcpyopt. It was
...
refusing to optimize two memcpy's like this:
copy A <- B
copy C <- A
if it couldn't prove that noalias(B,C). We can eliminate
the copy by producing a memmove instead of memcpy.
llvm-svn: 119694
2010-11-18 08:00:57 +00:00
Chris Lattner
c274a83442
remove another pointless noalias check: M is a memcpy, so the
...
source and dest are known to not overlap.
llvm-svn: 119692
2010-11-18 07:39:57 +00:00
Chris Lattner
75cfe98534
use AA::isNoAlias instead of open coding it. Remove an extraneous noalias check:
...
there is no need to check to see if the source and dest of a memcpy are noalias,
behavior is undefined if not.
llvm-svn: 119691
2010-11-18 07:38:43 +00:00
Chris Lattner
7e9b2ea3bf
rearrange some code, splitting memcpy/memcpy optimization
...
out of processMemCpy into its own function.
llvm-svn: 119687
2010-11-18 07:02:37 +00:00
Dan Gohman
f372cf869b
Reapply r116831 and r116839, converting AliasAnalysis to use
...
uint64_t, plus fixes for places I missed before.
llvm-svn: 116875
2010-10-19 22:54:46 +00:00
Dan Gohman
b4aa503501
Revert r116831 and r116839, which are breaking selfhost builds.
...
llvm-svn: 116858
2010-10-19 21:06:16 +00:00
Dan Gohman
896ac62346
Oops, check in all the files for converting AliasAnalysis to
...
use uint64_t.
llvm-svn: 116839
2010-10-19 18:08:27 +00:00
Owen Anderson
6c18d1aac0
Get rid of static constructors for pass registration. Instead, every pass exposes an initializeMyPassFunction(), which
...
must be called in the pass's constructor. This function uses static dependency declarations to recursively initialize
the pass's dependencies.
Clients that only create passes through the createFooPass() APIs will require no changes. Clients that want to use the
CommandLine options for passes will need to manually call the appropriate initialization functions in PassInitialization.h
before parsing commandline arguments.
I have tested this with all standard configurations of clang and llvm-gcc on Darwin. It is possible that there are problems
with the static dependencies that will only be visible with non-standard options. If you encounter any crash in pass
registration/creation, please send the testcase to me directly.
llvm-svn: 116820
2010-10-19 17:21:58 +00:00
Dan Gohman
14fe8cf238
Consistently use AliasAnalysis::UnknownSize instead of hardcoding ~0u.
...
llvm-svn: 116815
2010-10-19 17:06:23 +00:00
Owen Anderson
18e4fed3fa
Generalize MemCpyOpt's handling of call slot forwarding to function properly when the call slot
...
forwarding is implemented with a load/store pair rather than a memcpy.
llvm-svn: 116637
2010-10-15 22:52:12 +00:00
Owen Anderson
8ac477ffb5
Begin adding static dependence information to passes, which will allow us to
...
perform initialization without static constructors AND without explicit initialization
by the client. For the moment, passes are required to initialize both their
(potential) dependencies and any passes they preserve. I hope to be able to relax
the latter requirement in the future.
llvm-svn: 116334
2010-10-12 19:48:12 +00:00
Owen Anderson
df7a4f2515
Now with fewer extraneous semicolons!
...
llvm-svn: 115996
2010-10-07 22:25:06 +00:00
Eric Christopher
3ad2f3a2f2
Fix the other half of the alignment changing issue by making sure that the
...
memcpy alignment is the minimum of the incoming alignments.
Fixes PR 8266.
llvm-svn: 115305
2010-10-01 09:02:05 +00:00
Eric Christopher
ebacd2b023
If we're changing the source of a memcpy we need to use the alignment
...
of the source, not the original alignment since it may no longer
be valid.
Fixes rdar://8400094
llvm-svn: 114781
2010-09-25 00:57:26 +00:00
Owen Anderson
a7aed18624
Reapply r110396, with fixes to appease the Linux buildbot gods.
...
llvm-svn: 110460
2010-08-06 18:33:48 +00:00
Owen Anderson
bda59bd247
Revert r110396 to fix buildbots.
...
llvm-svn: 110410
2010-08-06 00:23:35 +00:00