Eric Christopher
a7fb58f5f5
Migrate _chk call lowering from SimplifyLibCalls to InstCombine. Stub
...
out the remainder of the calls that we should lower in some way and
move the tests to the new correct directory. Fix up tests that are now
optimized more than they were before by -instcombine.
llvm-svn: 97875
2010-03-06 10:50:38 +00:00
Eric Christopher
87abfc506f
Move SimplifyLibCalls's LibCall builders to a separate file so they
...
can be used in more places. Add an argument for the TargetData that
most of them need. Update for the getInt8PtrTy() change. Should be
no functionality change.
llvm-svn: 97844
2010-03-05 22:25:30 +00:00
Evan Cheng
d214ed0e75
Safely turn memset_chk etc. to non-chk variant if the known object size is >= memset / memcpy / memmove size.
...
llvm-svn: 97828
2010-03-05 20:59:47 +00:00
Eric Christopher
4899cbc77d
Move GetStringLength and helper from SimplifyLibCalls to ValueTracking.
...
No functionality change.
llvm-svn: 97793
2010-03-05 06:58:57 +00:00
Duncan Sands
19d0b47b1f
There are two ways of checking for a given type, for example isa<PointerType>(T)
...
and T->isPointerTy(). Convert most instances of the first form to the second form.
Requested by Chris.
llvm-svn: 96344
2010-02-16 11:11:14 +00:00
Duncan Sands
9dff9bec31
Uniformize the names of type predicates: rather than having isFloatTy and
...
isInteger, we now have isFloatTy and isIntegerTy. Requested by Chris!
llvm-svn: 96223
2010-02-15 16:12:20 +00:00
Eric Christopher
d86233c118
Recommit this, looks like it wasn't the cause.
...
llvm-svn: 95165
2010-02-03 00:21:58 +00:00
Eric Christopher
e67d01a9a8
Hopefully temporarily revert this.
...
llvm-svn: 95154
2010-02-02 23:01:31 +00:00
Eric Christopher
4264e7e46f
Re-add strcmp and known size object size checking optimization.
...
Passed bootstrap and nightly test run here.
llvm-svn: 95145
2010-02-02 22:10:43 +00:00
Eric Christopher
14dfc3f6df
Don't need to check the last argument since it'll always be bool. We also
...
don't use TargetData here.
llvm-svn: 95040
2010-02-02 00:51:45 +00:00
Eric Christopher
9afa973203
More indentation/tabification fixes.
...
llvm-svn: 95036
2010-02-02 00:13:06 +00:00
Eric Christopher
1408234753
Untabify previous commit.
...
llvm-svn: 95035
2010-02-02 00:06:55 +00:00
Eric Christopher
56e4182c49
Formatting.
...
llvm-svn: 95027
2010-02-01 23:25:03 +00:00
Eric Christopher
5a0e174863
Revert my last couple of patches. They appear to have broken bison.
...
llvm-svn: 94841
2010-01-29 21:16:24 +00:00
Eric Christopher
9b3c02b7da
Make strcpy_chk lower to strcpy if we have a safe size.
...
llvm-svn: 94783
2010-01-29 01:37:11 +00:00
Eric Christopher
ba7cd4c393
Reapply 94059 while fixing the calling convention setup
...
for strcpy.
llvm-svn: 94287
2010-01-23 05:29:06 +00:00
Bob Wilson
6c0c8d41b4
Revert 94059. It is breaking the MultiSource/Benchmarks/Prolangs-C/bison
...
test on ARM.
llvm-svn: 94198
2010-01-22 19:16:40 +00:00
Eric Christopher
fa863258d0
Add strcpy_chk -> strcpy support for "don't know" object size
...
answers. This will update as object size checking gets better information.
llvm-svn: 94059
2010-01-21 01:04:38 +00:00
Eric Christopher
2cdb806fd8
Move the object size intrinsic optimization to inst-combine and make
...
it work for any integer size return type.
llvm-svn: 92853
2010-01-06 20:04:44 +00:00
Mikhail Glushenkov
40d2429b28
Formatting.
...
llvm-svn: 92831
2010-01-06 09:20:39 +00:00
Benjamin Kramer
d2564e3afb
Move remaining stuff to the isInteger predicate.
...
llvm-svn: 92771
2010-01-05 21:05:54 +00:00
David Greene
9ddc6e2e12
Change errs() to dbgs().
...
llvm-svn: 92615
2010-01-05 01:27:21 +00:00
Mikhail Glushenkov
6a8ac8ce8f
80-col violations, trailing whitespace.
...
llvm-svn: 92470
2010-01-04 07:55:25 +00:00
Chris Lattner
1a32ede6fd
move an optimization for memcmp out of simplifylibcalls and into
...
SDISel. This optimization was causing simplifylibcalls to
introduce type-unsafe nastiness. This is the first step, I'll be
expanding the memcmp optimizations shortly, covering things that
we really really wouldn't want simplifylibcalls to do.
llvm-svn: 92098
2009-12-24 00:37:38 +00:00
Chris Lattner
efebb234b7
reorder to follow a normal fall-through style, no functionality change.
...
llvm-svn: 92084
2009-12-23 23:24:51 +00:00
Eric Christopher
fdb33458fc
Update objectsize intrinsic and associated dependencies. Fix
...
lowering code and update testcases.
llvm-svn: 91979
2009-12-23 02:51:48 +00:00
Eric Christopher
ab6a0d60d5
Whitespace fixes.
...
llvm-svn: 91875
2009-12-22 01:23:51 +00:00
Chris Lattner
f278addbdc
reapply my strstr optimization. I have reproduced the x86-64 bootstrap
...
miscompile (i386.o miscompares) but it happens both with and without
this patch.
llvm-svn: 91532
2009-12-16 09:32:05 +00:00
Chris Lattner
177be32334
revert my strstr optimization, I'm told it breaks x86-64 bootstrap.
...
Will reapply with a fix when I get a chance.
llvm-svn: 91486
2009-12-16 00:46:02 +00:00
Chris Lattner
26ab363361
optimize strstr, PR5783
...
llvm-svn: 91438
2009-12-15 19:14:40 +00:00
Chris Lattner
24aba42d04
add some other xforms that should be done as part of PR5783
...
llvm-svn: 91428
2009-12-15 09:05:13 +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
Eric Christopher
0c7bd96de2
Add more optimizations for object size checking, enable handling of
...
object size intrinsic and verify return type is correct. Collect various
code in one place.
llvm-svn: 89523
2009-11-21 01:01:30 +00:00
Daniel Dunbar
f87c75706f
Revert "Add some rough optimizations for checking routines.", it buildeth not.
...
llvm-svn: 89482
2009-11-20 20:17:30 +00:00
Eric Christopher
cf97d01dff
Add some rough optimizations for checking routines.
...
llvm-svn: 89479
2009-11-20 19:57:37 +00:00
Duncan Sands
e5de4a9ad6
CreateIntCast takes an "isSigned" parameter. Pass "true" for it, rather than
...
a name.
llvm-svn: 88908
2009-11-16 12:32:28 +00:00
Chris Lattner
feeabde753
fix PR5104: when printing a single character, return the result of
...
putchar in case there is an error.
llvm-svn: 86515
2009-11-09 04:57:04 +00:00
Benjamin Kramer
b971445ab7
Teach SimplifyLibCalls to fold memcmp calls with constant arguments.
...
llvm-svn: 86141
2009-11-05 17:44:22 +00:00
Eric Christopher
7a50b280c1
Add objectsize intrinsic and hook it up through codegen. Doesn't
...
do anything than return "I don't know" at the moment.
llvm-svn: 85189
2009-10-27 00:52:25 +00:00
Eric Christopher
5b741f3d14
80-column and whitespace fixes.
...
llvm-svn: 83489
2009-10-07 21:14:25 +00:00
Duncan Sands
9ed7b16bf3
Introduce and use convenience methods for getting pointer types
...
where the element is of a basic builtin type. For example, to get
an i8* use getInt8PtrTy.
llvm-svn: 83379
2009-10-06 15:40:36 +00:00
Chris Lattner
fdd8790718
strength reduce a ton of type equality tests to check the typeid (Through
...
the new predicates I added) instead of going through a context and doing a
pointer comparison. Besides being cheaper, this allows a smart compiler
to turn the if sequence into a switch.
llvm-svn: 83297
2009-10-05 05:54:46 +00:00
Dan Gohman
62995c71a2
Fix SimplifyLibCalls to transfer attributes from callees rather than
...
calls, since direct calls don't always reflect the attributes of their
callees.
llvm-svn: 82867
2009-09-26 18:10:13 +00:00
Dan Gohman
394468dc8e
Rename ConstantFP's getInf to getInfinity.
...
llvm-svn: 82823
2009-09-25 23:40:21 +00:00
Dan Gohman
5ffd53892d
Transform pow(x, 0.5) to (x == -inf ? inf : fabs(sqrt(x))), which is
...
typically faster then doing a general pow.
llvm-svn: 82819
2009-09-25 23:10:17 +00:00
Victor Hernandez
5d034499ad
Enhance transform passes so that they apply the same tranforms to malloc calls as to MallocInst.
...
Reviewed by Dan Gohman.
llvm-svn: 82300
2009-09-18 22:35:49 +00:00
Chris Lattner
27266f164f
In C++, code is not allowed to call main. In C it is, this
...
simplifylibcalls optimization is thus valid for C++ but not C.
It's not important enough to worry about for C++ apps, so just
remove it.
rdar://7191924
llvm-svn: 80887
2009-09-03 05:19:59 +00:00
Chris Lattner
2dd09dbdf7
eliminate VISIBILITY_HIDDEN from Transforms/Scalar. PR4861
...
llvm-svn: 80766
2009-09-02 06:11:42 +00:00
Dan Gohman
dea2358c68
Fix SimplifyLibcalls and ValueTracking to check mayBeOverridden
...
before performing optimizations based on constant string values.
llvm-svn: 79384
2009-08-19 00:11:12 +00:00
Dan Gohman
9f2b3db428
Make TargetData optional in SimplifyLibCalls.
...
llvm-svn: 79298
2009-08-18 00:48:13 +00:00