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

82 Commits

Author SHA1 Message Date
Benjamin Kramer
476bfb7a10 Add strpbrk folding to SimplifyLibCalls.
llvm-svn: 115111
2010-09-29 23:52:12 +00:00
Benjamin Kramer
cec2603ec2 Simplify the loop in StrChrOptimizer. FileCheckize test.
llvm-svn: 115095
2010-09-29 22:29:12 +00:00
Benjamin Kramer
75a825ff6b Teach SimplifyLibCalls how to optimize strrchr.
llvm-svn: 115091
2010-09-29 21:50:51 +00:00
Rafael Espindola
6ccafc9391 Make sure that simplify libcalls does not replace a call with one calling
convention with a new call with a different calling convention.

llvm-svn: 106134
2010-06-16 19:34:01 +00:00
Benjamin Kramer
f600dc2eed simplify-libcalls: fold strncmp(x, y, 1) -> memcmp(x, y, 1)
The memcmp will be optimized further and even the pathological case
'strstr(x, "x") == x' generates optimal code now.

llvm-svn: 106097
2010-06-16 10:30:29 +00:00
Benjamin Kramer
21a49e9375 simplify-libcalls: fold strstr(a, b) == a -> strncmp(a, b, strlen(b)) == 0
llvm-svn: 106047
2010-06-15 21:34:25 +00:00
Nick Lewycky
418d80e555 The memcpy intrinsic only takes i8* for %src and %dst, so cast them to that
first. Fixes PR7265.

llvm-svn: 105206
2010-05-31 06:16:35 +00:00
Benjamin Kramer
0acbf37982 Properly promote operands when optimizing a single-character memcmp.
llvm-svn: 104648
2010-05-25 22:53:43 +00:00
Mon P Wang
484bbe6aa9 Reapply address space patch after fixing an issue in MemCopyOptimizer.
Added support for address spaces and added a isVolatile field to memcpy, memmove, and memset,
e.g., llvm.memcpy.i32(i8*, i8*, i32, i32) -> llvm.memcpy.p0i8.p0i8.i32(i8*, i8*, i32, i32, i1)

llvm-svn: 100304
2010-04-04 03:10:48 +00:00
Mon P Wang
0ccf050ca3 Revert r100191 since it breaks objc in clang
llvm-svn: 100199
2010-04-02 18:43:02 +00:00
Mon P Wang
a01350755e Reapply address space patch after fixing an issue in MemCopyOptimizer.
Added support for address spaces and added a isVolatile field to memcpy, memmove, and memset,
e.g., llvm.memcpy.i32(i8*, i8*, i32, i32) -> llvm.memcpy.p0i8.p0i8.i32(i8*, i8*, i32, i32, i1)

llvm-svn: 100191
2010-04-02 18:04:15 +00:00
Bob Wilson
aae933cc81 Revert Mon Ping's change 99928, since it broke all the llvm-gcc buildbots.
llvm-svn: 99948
2010-03-30 22:27:04 +00:00
Mon P Wang
9351ea594a Added support for address spaces and added a isVolatile field to memcpy, memmove, and memset,
e.g., llvm.memcpy.i32(i8*, i8*, i32, i32) -> llvm.memcpy.p0i8.p0i8.i32(i8*, i8*, i32, i32, i1)
A update of langref will occur in a subsequent checkin.

llvm-svn: 99928
2010-03-30 20:55:56 +00:00
Evan Cheng
1144c23330 Teach simplify libcall to transform __strcpy_chk to __memcpy_chk to enable optimizations down stream.
llvm-svn: 99282
2010-03-23 15:48:04 +00:00
Eric Christopher
a671e4f7aa 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
Evan Cheng
3346ea1d4e 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
ac28e14b77 Recommit this, looks like it wasn't the cause.
llvm-svn: 95165
2010-02-03 00:21:58 +00:00
Eric Christopher
f070aae6f7 Hopefully temporarily revert this.
llvm-svn: 95154
2010-02-02 23:01:31 +00:00
Eric Christopher
575fe8690d 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
47d90f7adb 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
f01379e6c2 Make strcpy_chk lower to strcpy if we have a safe size.
llvm-svn: 94783
2010-01-29 01:37:11 +00:00
Chris Lattner
5d3919d5f9 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
2d5fc1649a 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
8751050a34 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
fa960751b1 optimize strstr, PR5783
llvm-svn: 91438
2009-12-15 19:14:40 +00:00
Benjamin Kramer
a38019a3de Teach SimplifyLibCalls to fold memcmp calls with constant arguments.
llvm-svn: 86141
2009-11-05 17:44:22 +00:00
Dan Gohman
0a396aa546 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
8e056e8b9b I put the wrong rdar number in this test.
llvm-svn: 82829
2009-09-26 01:11:57 +00:00
Dan Gohman
d564cd42d9 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
Dan Gohman
205b641954 Change tests from "opt %s" to "opt < %s" so that opt doesn't see the
input filename so that opt doesn't print the input filename in the
output so that grep lines in the tests don't unintentionally match
strings in the input filename.

llvm-svn: 81537
2009-09-11 18:01:28 +00:00
Dan Gohman
c95df8b6d8 Use opt -S instead of piping bitcode output through llvm-dis.
llvm-svn: 81257
2009-09-08 22:34:10 +00:00
Dan Gohman
8d84372836 Change these tests to feed the assembly files to opt directly, instead
of using llvm-as, now that opt supports this.

llvm-svn: 81226
2009-09-08 16:50:01 +00:00
Daniel Dunbar
a953c39b9e Eliminate uses of %prcontext.
- I'd appreciate it if someone else eyeballs my changes to make sure I captured
   the intent of the test.

llvm-svn: 81083
2009-09-05 11:35:16 +00:00
Chris Lattner
3ac0c58031 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
Dan Gohman
e3245061a9 Add targetdata strings to these tests, since SimplifyLibCalls uses
TargetData to find the pointer size.

llvm-svn: 79490
2009-08-19 23:18:49 +00:00
Dan Gohman
807652ac3a 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
Daniel Dunbar
89cb72a6bc Fix PR4645 which was fallout from the fix for PR4641.
- Call RAUW to delete all instructions (this is a patch from Nick Lewycky).

llvm-svn: 77512
2009-07-29 22:00:43 +00:00
Nick Lewycky
1961298b63 Just discard the output, no need to turn it back into text.
llvm-svn: 77439
2009-07-29 06:14:52 +00:00
Chris Lattner
e5f1099d05 don't dump .bc file to stdout, and simplify this to a trivial testcase.
llvm-svn: 77436
2009-07-29 05:32:07 +00:00
Nick Lewycky
e0524c1795 Bulk erasing instructions without RAUWing them is unsafe. Instead, break them
into a new BB that has no predecessors.

llvm-svn: 77433
2009-07-29 05:17:50 +00:00
Eli Friedman
7b1597133d Fix simplifylibcalls memset recognition to work on 64-bit platforms
where int is 32 bits.

llvm-svn: 76293
2009-07-18 08:34:51 +00:00
Chris Lattner
3a683c551f part of PR4405: disable a contentious optimization for
strcmp -> memcmp when the lengths of the strings are unknown.

Patch by Nick Lewycky!

llvm-svn: 73751
2009-06-19 04:17:36 +00:00
Dan Gohman
5f6f8101d5 Split the Add, Sub, and Mul instruction opcodes into separate
integer and floating-point opcodes, introducing
FAdd, FSub, and FMul.

For now, the AsmParser, BitcodeReader, and IRBuilder all preserve
backwards compatability, and the Core LLVM APIs preserve backwards
compatibility for IR producers. Most front-ends won't need to change
immediately.

This implements the first step of the plan outlined here:
http://nondot.org/sabre/LLVMNotes/IntegerOverflow.txt

llvm-svn: 72897
2009-06-04 22:49:04 +00:00
Chris Lattner
8ac63163fe fix PR4284, a bug in simplifylibcalls handling memcmp. Patch by
Benjamin Kramer!

llvm-svn: 72625
2009-05-30 18:43:04 +00:00
Chris Lattner
927ebd34e2 Fix PR4206 - crash in simplify lib calls
llvm-svn: 71644
2009-05-13 06:26:11 +00:00
Chris Lattner
f03202e76d add some optimizations for strncpy/strncat and factor some
code.  Patch by Benjamin Kramer!

llvm-svn: 68885
2009-04-12 05:06:39 +00:00
Ed Schouten
ff25f858fd Let the strcat optimizer return the pointer to the start of the buffer,
instead of the place where it started to perform the string copy.

- PR3661
- Patch by Benjamin Kramer!

llvm-svn: 68443
2009-04-06 13:06:48 +00:00
Nick Lewycky
0a8e13fd8b Mark strto* as readonly when the endptr is null.
llvm-svn: 64460
2009-02-13 17:08:33 +00:00
Nick Lewycky
7ec551cfad On strtod and friends, mark 'endptr' nocapture in the function prototype, and
mark the first argument nocapture if endptr=NULL for each particular call.

llvm-svn: 64453
2009-02-13 15:31:46 +00:00
Nick Lewycky
260e80bd90 Reapply r64300:
Make sure the SCC pass manager initializes any contained
function pass managers.  Without this, simplify-libcalls
would add nocapture attributes when run on its own, but
not when run as part of -std-compile-opts or similar.

llvm-svn: 64443
2009-02-13 07:15:53 +00:00