Gabor Greif
e315b7db00
use getArgOperand (corrected by CallInst::ArgOffset) instead of getOperand
...
llvm-svn: 107275
2010-06-30 12:38:26 +00:00
Gabor Greif
cc251773b5
use ArgOperand API
...
llvm-svn: 107017
2010-06-28 16:50:57 +00:00
Gabor Greif
d2559bceee
use ArgOperand API (some hunks I could split)
...
llvm-svn: 106824
2010-06-25 07:57:14 +00:00
Gabor Greif
04a3ec3771
use (even more, still) ArgOperand API
...
llvm-svn: 106750
2010-06-24 15:51:11 +00:00
Gabor Greif
55a6d5f8c5
use (even more) ArgOperand API
...
llvm-svn: 106744
2010-06-24 13:54:33 +00:00
Gabor Greif
37ff2f8455
use ArgOperand API
...
llvm-svn: 106743
2010-06-24 13:42:49 +00:00
Gabor Greif
f53212a5a3
use ArgOperand API
...
llvm-svn: 106740
2010-06-24 12:58:35 +00:00
Duncan Sands
32d3986765
Teach instCombine to remove malloc+free if malloc's only uses are comparisons
...
to null. Patch by Matti Niemenmaa.
llvm-svn: 104871
2010-05-27 19:09:06 +00:00
Chris Lattner
22d3b3b3b7
further clarify alignment of globals, fix instcombine
...
to not increase the alignment of globals with an assigned
alignment and section.
llvm-svn: 102476
2010-04-28 00:31:12 +00:00
Gabor Greif
2eaf8afcff
use abstract accessors to CallInst
...
llvm-svn: 101899
2010-04-20 13:13:04 +00:00
Eric Christopher
e78496e5f1
Revert 101465, it broke internal OpenGL testing.
...
Probably the best way to know that all getOperand() calls have been handled
is to replace that API instead of updating.
llvm-svn: 101579
2010-04-16 23:37:20 +00:00
Gabor Greif
e7d6812008
reapply r101434
...
with a fix for self-hosting
rotate CallInst operands, i.e. move callee to the back
of the operand array
the motivation for this patch are laid out in my mail to llvm-commits:
more efficient access to operands and callee, faster callgraph-construction,
smaller compiler binary
llvm-svn: 101465
2010-04-16 15:33:14 +00:00
Gabor Greif
cd116e8c6a
back out r101423 and r101397, they break llvm-gcc self-host on darwin10
...
llvm-svn: 101434
2010-04-16 01:16:20 +00:00
Gabor Greif
2e18d34d80
reapply r101364, which has been backed out in r101368
...
with a fix
rotate CallInst operands, i.e. move callee to the back
of the operand array
the motivation for this patch are laid out in my mail to llvm-commits:
more efficient access to operands and callee, faster callgraph-construction,
smaller compiler binary
llvm-svn: 101397
2010-04-15 20:51:13 +00:00
Gabor Greif
6022150477
back out r101364, as it trips the linux nightlybot on some clang C++ tests
...
llvm-svn: 101368
2010-04-15 12:46:56 +00:00
Gabor Greif
428ca23bbd
rotate CallInst operands, i.e. move callee to the back
...
of the operand array
the motivation for this patch are laid out in my mail to llvm-commits:
more efficient access to operands and callee, faster callgraph-construction,
smaller compiler binary
llvm-svn: 101364
2010-04-15 10:49:53 +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
a544f02286
Fix an incorrect logic causing instcombine to miss some _chk -> non-chk transformations.
...
llvm-svn: 99263
2010-03-23 06:06:09 +00:00
Gabor Greif
abb84bec5c
Add a setCalledFunction member to InvokeInst (like in CallInst)
...
and use this (as well as getCalledValue) to access the callee,
instead of {g|s}etOperand(0).
llvm-svn: 99084
2010-03-20 21:00:25 +00:00
Benjamin Kramer
0592752a53
Factor checked library call optimization into a common helper class and use it
...
to unify the almost identical code in CodeGenPrepare and InstCombineCalls.
llvm-svn: 98338
2010-03-12 09:27:41 +00:00
Benjamin Kramer
846fefb000
stpcpy is so similar to strcpy, it doesn't deserve a complete copy of the __strcpy_chk -> strcpy code.
...
llvm-svn: 98284
2010-03-11 20:45:13 +00:00
Eric Christopher
017a0a06d8
Lower stpcpy_chk when possible.
...
llvm-svn: 98274
2010-03-11 19:24:34 +00:00
Eric Christopher
c2a92dadc5
Add strncpy libcall creator. Use it when it should be used.
...
llvm-svn: 98219
2010-03-11 01:25:07 +00:00
Evan Cheng
db47eab2a3
Re-commit 97860 with fix. getMallocAllocatedType may return null.
...
llvm-svn: 98000
2010-03-08 22:54:36 +00:00
Eric Christopher
b7e9bf6e57
Let the fallthrough handle whether or not we've changed anything
...
before we try to optimize.
llvm-svn: 97876
2010-03-06 10:59:25 +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
Eric Christopher
b3f0926f84
Temporarily revert:
...
Log:
Transform @llvm.objectsize to integer if the argument is a result of malloc of known size.
Modified:
llvm/trunk/lib/Transforms/InstCombine/InstCombineCalls.cpp
llvm/trunk/test/Transforms/InstCombine/objsize.ll
It appears to be causing swb and nightly test failures.
llvm-svn: 97866
2010-03-06 03:11:35 +00:00
Evan Cheng
071e007ce6
Transform @llvm.objectsize to integer if the argument is a result of malloc of known size.
...
llvm-svn: 97860
2010-03-06 01:01:42 +00:00
Evan Cheng
782183fe4a
Instcombine should turn llvm.objectsize of a alloca with static size to an integer.
...
llvm-svn: 97827
2010-03-05 20:47:23 +00:00
Evan Cheng
340941a422
Add missing break for Intrinsic::objectsize case. It was falling through to the following Intrinsic::bswap code. I have no idea why it wasn't breaking stuff.
...
llvm-svn: 97774
2010-03-05 01:22:47 +00:00
Evan Cheng
d9816ef946
Instcombine constant folding can normalize gep with negative index to index with large offset. When instcombine objsize checking transformation sees these geps where the offset seemingly point out of bound, it should just return "i don't know" rather than asserting.
...
llvm-svn: 96825
2010-02-22 23:34:00 +00:00
Duncan Sands
1b33dd3c83
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
2acaf3609c
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
96f3c4222f
Fix a problem where we had bitcasted operands that gave us
...
odd offsets since the bitcasted pointer size and the offset pointer
size are going to be different types for the GEP vs base object.
llvm-svn: 96134
2010-02-13 23:38:01 +00:00
Eric Christopher
2e0201ee18
Make sure that ConstantExpr offsets also aren't off of extern
...
symbols.
Thanks to Duncan Sands for the testcase!
llvm-svn: 95877
2010-02-11 17:44:04 +00:00
Eric Christopher
9516309f55
Add ConstantExpr handling to Intrinsic::objectsize lowering.
...
Update testcase accordingly now that we can optimize another
section.
llvm-svn: 95846
2010-02-11 01:48:54 +00:00
Eric Christopher
6691a59247
Move Intrinsic::objectsize lowering back to InstCombineCalls and
...
enable constant 0 offset lowering.
llvm-svn: 95691
2010-02-09 21:24:27 +00:00
Eric Christopher
f89979ce6a
Remove this code for now. I have a better idea and will rewrite with
...
that in mind.
llvm-svn: 95402
2010-02-05 19:04:06 +00:00
Eric Christopher
ee4a176739
Temporarily revert this since it appears to have caused a build
...
failure.
llvm-svn: 95294
2010-02-04 06:41:27 +00:00
Eric Christopher
9b3e42f09e
Rework constant expr and array handling for objectsize instcombining.
...
Fix bugs where we would compute out of bounds as in bounds, and where
we couldn't know that the linker could override the size of an array.
Add a few new testcases, change existing testcase to use a private
global array instead of extern.
llvm-svn: 95283
2010-02-04 02:55:34 +00:00
Eric Christopher
fe6ab1518e
If we're dealing with a zero-length array, don't lower to any
...
particular size, we just don't know what the length is yet.
llvm-svn: 95266
2010-02-03 23:56:07 +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
048492d669
Reformat my last patch slightly.
...
llvm-svn: 95147
2010-02-02 22:29:26 +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
Chris Lattner
5f10919836
fix rdar://7590304, a miscompilation of objc apps on arm. The caller
...
of objc message send was getting marked arm_apcscc, but the prototype
isn't. This is fine at runtime because objcmsgsend is implemented in
assembly. Only turn a mismatched caller and callee into 'unreachable'
if the callee is a definition.
llvm-svn: 94986
2010-02-01 18:11:34 +00:00
Chris Lattner
a336497d3f
fix rdar://7590304, an infinite loop in instcombine. In the invoke
...
case, instcombine can't zap the invoke for fear of changing the CFG.
However, we have to do something to prevent the next iteration of
instcombine from inserting another store -> undef before the invoke
thereby getting into infinite iteration between dead store elim and
store insertion.
Just zap the callee to null, which will prevent the next iteration
from doing anything.
llvm-svn: 94985
2010-02-01 18:04:58 +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
7d74af1824
Add constant support to object size handling and remove default
...
lowering. We'll either figure it out, or not and be lowered by
SelectionDAGBuild.
Add test.
llvm-svn: 94775
2010-01-29 01:09:57 +00:00
Eric Christopher
937778e8d0
Remove unnecessary dyn_cast and add a comment. Part of a WIP.
...
llvm-svn: 93026
2010-01-08 21:37:11 +00:00
Eric Christopher
0574ce70c3
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
Benjamin Kramer
0ba7479f2c
Move remaining stuff to the isInteger predicate.
...
llvm-svn: 92771
2010-01-05 21:05:54 +00:00
Chris Lattner
e21194fe22
split call handling out to InstCombineCalls.cpp
...
llvm-svn: 92707
2010-01-05 07:32:13 +00:00