Chris Lattner
47a86bdbe2
use ConstantVector::getSplat in a few places.
...
llvm-svn: 148929
2012-01-25 06:02:56 +00:00
Rafael Espindola
2b14b80b60
Fix warning.
...
llvm-svn: 147284
2011-12-26 23:12:42 +00:00
Nadav Rotem
3924cb0267
Add support for vectors of pointers.
...
llvm-svn: 145801
2011-12-05 06:29:09 +00:00
Nick Lewycky
612d70b19d
Refactor code to use new attribute getters on CallSite for NoCapture and ByVal.
...
Suggested in code review by Eli.
That code in InstCombine looks kinda suspicious.
llvm-svn: 145013
2011-11-20 19:09:04 +00:00
Eli Friedman
ecb453805d
Make sure scalarrepl picks the correct alloca when it rewrites a bitcast. Fixes PR11353.
...
llvm-svn: 144442
2011-11-12 02:07:50 +00:00
Cameron Zwarich
057fbb1a10
The element insertion code in scalar replacement doesn't handle incorrect
...
element types, even though the element extraction code does. It is surprising
that this bug has been here for so long. Fixes <rdar://problem/10318778>.
llvm-svn: 142740
2011-10-23 07:02:10 +00:00
Cameron Zwarich
1a761dcfbd
Fix PR11106 by correcting a typo that has been in the code for over a year. This
...
would have never worked, since the element type of a vector type is never a
vector type. Also fix the conditional to be more direct in checking whether
EltTy is a vector type.
llvm-svn: 141713
2011-10-11 21:26:40 +00:00
Cameron Zwarich
d7515ccc47
Remove a lot of the fancy scalar replacement code for dealing with llvm-gcc's
...
lowering of NEON code. It provides little-to-no benefit now and only introduces
additional complexity.
llvm-svn: 141646
2011-10-11 06:10:30 +00:00
Benjamin Kramer
547b6c5ecd
Stop emitting instructions with the name "tmp" they eat up memory and have to be uniqued, without any benefit.
...
If someone prefers %tmp42 to %42, run instnamer.
llvm-svn: 140634
2011-09-27 20:39:19 +00:00
Eli Friedman
f9b785f185
PR10987: add a missed safety check to isSafePHIToSpeculate in scalarrepl.
...
llvm-svn: 140327
2011-09-22 18:56:30 +00:00
Eli Friedman
7c5dc122a0
Change a bunch of isVolatile() checks to check for atomic load/store as well.
...
No tests; these changes aren't really interesting in the sense that the logic is the same for volatile and atomic.
I believe this completes all of the changes necessary for the optimizer to handle loads and stores correctly. I'm going to try and come up with some additional testing, though.
llvm-svn: 139533
2011-09-12 20:23:13 +00:00
Nick Lewycky
15e2d90746
Finish adding support for lifetime intrinsics to SROA. Fixes PR10121!
...
llvm-svn: 136008
2011-07-25 23:14:22 +00:00
Jay Foad
d1b7849d49
Convert GetElementPtrInst to use ArrayRef.
...
llvm-svn: 135904
2011-07-25 09:48:08 +00:00
Dan Gohman
e106aee6f5
Fix MergeInVectorType to check for vector types with the same alloc
...
size but different element types, so that it filters out the cases
that CreateShuffleVectorCast doesn't handle. This fixes rdar://9786827.
llvm-svn: 135721
2011-07-21 23:30:09 +00:00
Jay Foad
bf904773bb
Convert TargetData::getIndexedOffset to use ArrayRef.
...
llvm-svn: 135478
2011-07-19 14:01:37 +00:00
Chris Lattner
229907cd11
land David Blaikie's patch to de-constify Type, with a few tweaks.
...
llvm-svn: 135375
2011-07-18 04:54:35 +00:00
Devang Patel
41e97da74f
Use DBG_VALUE location while inserting DBG_VALUE during alloca promotion.
...
llvm-svn: 134568
2011-07-07 00:05:58 +00:00
Devang Patel
c6ee9181d0
Handle cases where multiple dbg.declare and dbg.value intrinsics are tied to one alloca.
...
llvm-svn: 134549
2011-07-06 22:06:11 +00:00
Devang Patel
a3cbf52a57
Simplify. Consolidate dbg.declare handling in AllocaPromoter.
...
llvm-svn: 134538
2011-07-06 21:09:55 +00:00
Nick Lewycky
f64a39768d
Fix likely typo, reduce number of instruction name collisions.
...
llvm-svn: 134235
2011-07-01 06:27:03 +00:00
Nick Lewycky
a61df3f843
Teach one piece of scalarrepl to handle lifetime markers. When transforming an
...
alloca that only holds a copy of a global and we're going to replace the users
of the alloca with that global, just nuke the lifetime intrinsics. Part of
PR10121.
llvm-svn: 133905
2011-06-27 05:40:02 +00:00
Cameron Zwarich
9601ddb2f3
When scalar replacement returns a vector type, only accept it if the vector
...
type's bitwidth matches the (allocated) size of the alloca. This severely
pessimizes vector scalar replacement when the only vector type being used is
something like <3 x float> on x86 or ARM whose allocated size matches a
<4 x float>.
I hope to fix some of the flawed assumptions about allocated size throughout
scalar replacement and reenable this in most cases.
llvm-svn: 133338
2011-06-18 06:17:51 +00:00
Cameron Zwarich
2a26100c87
Fix an invalid bitcast crash that occurs when doing a partial memset of a vector
...
alloca. Fixes part of <rdar://problem/9580800>.
llvm-svn: 133336
2011-06-18 05:47:49 +00:00
Cameron Zwarich
cd42038fdc
Remove a pointless assignment. Nothing checks the value of VectorTy anymore now
...
unless ScalarKind is Vector.
llvm-svn: 133335
2011-06-18 05:47:45 +00:00
Cameron Zwarich
b5f19d9f6f
Be more obvious about what is being tested.
...
llvm-svn: 132982
2011-06-14 06:33:51 +00:00
Cameron Zwarich
922e4940bd
Fix grammar.
...
llvm-svn: 132952
2011-06-13 23:39:23 +00:00
Cameron Zwarich
3ecbd59c27
Rename MergeInType to MergeInTypeForLoadOrStore.
...
llvm-svn: 132940
2011-06-13 21:44:43 +00:00
Cameron Zwarich
8cb90ac456
Remove the HadAVector instance variable and replace it with a use of ScalarKind.
...
llvm-svn: 132939
2011-06-13 21:44:40 +00:00
Cameron Zwarich
1bfab48edb
Remove a vacuous check.
...
llvm-svn: 132938
2011-06-13 21:44:38 +00:00
Cameron Zwarich
5e9a0be4b3
Have SRoA explicitly track the kind of scalar it is promoting. This is pretty
...
spartan right now, but I plan to encode more information in this enum to improve
the correctness and reliability of SRoA. At least this first pass makes it
possible to make VectorTy an actual VectorType.
llvm-svn: 132937
2011-06-13 21:44:35 +00:00
Cameron Zwarich
8deb615d64
Remove an argument that is always true.
...
llvm-svn: 132936
2011-06-13 21:44:31 +00:00
Cameron Zwarich
c62894d440
Remove a vacuous condition.
...
llvm-svn: 132767
2011-06-09 01:52:44 +00:00
Cameron Zwarich
77a699a829
Fix PR10104 by adding a bounds check on a vector element access check. It was
...
assuming that all offsets are legal vector accesses, and thus trying to access
the float member of { <2 x float>, float } as the 3rd element of the first
member.
llvm-svn: 132766
2011-06-09 01:45:33 +00:00
Cameron Zwarich
c3b1cc9aca
Fix an assymmetry between ConvertScalar_ExtractValue and ConvertScalar_InsertValue. The
...
former was using the size of the entire alloca, whereas the latter was correctly using
the allocated size of the immediate type being converted (which may differ from the size
of the alloca). This fixes PR10082.
llvm-svn: 132759
2011-06-08 22:08:31 +00:00
Devang Patel
84bb33add9
Use IRBuilder, preserve line numbers.
...
llvm-svn: 132578
2011-06-03 19:46:19 +00:00
Cameron Zwarich
46e1ebf367
Clean up the lazy initialization of DIBuilder a bit.
...
llvm-svn: 131956
2011-05-24 06:00:08 +00:00
Cameron Zwarich
843bc7d673
Make LoadAndStorePromoter preserve debug info and create llvm.dbg.values when
...
promoting allocas to SSA variables. Fixes <rdar://problem/9479036>.
llvm-svn: 131953
2011-05-24 03:10:43 +00:00
Duncan Sands
a071c82900
Fix PR9820: a read-only call differs from a load in that a load doesn't
...
return the pointer being dereferenced, it returns the pointee, but a call
might return the pointer itself.
llvm-svn: 130979
2011-05-06 10:30:37 +00:00
Cameron Zwarich
ca4c633489
Fix another case of <rdar://problem/9184212> that only occurs with code
...
generated by llvm-gcc, since llvm-gcc uses 2 i64s for passing a 4 x float
vector on ARM rather than an i64 array like Clang.
llvm-svn: 129878
2011-04-20 21:48:38 +00:00
Cameron Zwarich
76dfa226cf
The bitcast case here is actually handled uniformly earlier in the function, so
...
delete it.
llvm-svn: 129877
2011-04-20 21:48:34 +00:00
Cameron Zwarich
4cd9a4a975
Cleanup some code to better use an early return style in preparation for adding
...
more cases.
llvm-svn: 129876
2011-04-20 21:48:16 +00:00
Mon P Wang
1cde91674a
Cleanup r129509 based on comments by Chris
...
llvm-svn: 129532
2011-04-14 19:20:42 +00:00
Mon P Wang
0f6bad7b6e
Cleanup r129472 by using a utility routine as suggested by Eli.
...
llvm-svn: 129509
2011-04-14 08:04:01 +00:00
Mon P Wang
2e5528f0b2
Vectors with different number of elements of the same element type can have
...
the same allocation size but different primitive sizes(e.g., <3xi32> and
<4xi32>). When ScalarRepl promotes them, it can't use a bit cast but
should use a shuffle vector instead.
llvm-svn: 129472
2011-04-13 21:40:02 +00:00
Jay Foad
52131344a2
Remove PHINode::reserveOperandSpace(). Instead, add a parameter to
...
PHINode::Create() giving the (known or expected) number of operands.
llvm-svn: 128537
2011-03-30 11:28:46 +00:00
Jay Foad
e0938d8a87
(Almost) always call reserveOperandSpace() on newly created PHINodes.
...
llvm-svn: 128535
2011-03-30 11:19:20 +00:00
Cameron Zwarich
ff811cc475
Do some simple copy propagation through integer loads and stores when promoting
...
vector types. This helps a lot with inlined functions when using the ARM soft
float ABI. Fixes <rdar://problem/9184212>.
llvm-svn: 128453
2011-03-29 05:19:52 +00:00
Cameron Zwarich
d4174ee43e
Fix a typo and add a test.
...
llvm-svn: 128331
2011-03-26 04:58:50 +00:00
Cameron Zwarich
10ebc189ee
Fix PR9464 by correcting some math that just happened to be right in most cases
...
that were hit in practice.
llvm-svn: 128146
2011-03-23 05:25:55 +00:00
Cameron Zwarich
7599b106b7
Fix a comment.
...
llvm-svn: 127728
2011-03-16 08:13:42 +00:00