aboutsummaryrefslogtreecommitdiffstats
path: root/test/Transforms/ScalarRepl
Commit message (Collapse)AuthorAgeFilesLines
* line endingsMatt Beaumont-Gay2012-03-151-20/+20
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@152832 91177308-0d34-0410-b5e6-96231b3b80d8
* Fixed a transform crash when setting a negative size value for memset. ↵Aaron Ballman2012-03-151-0/+20
| | | | | | Fixes PR12202. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@152756 91177308-0d34-0410-b5e6-96231b3b80d8
* Replace all instances of dg.exp file with lit.local.cfg, since all tests are ↵Eli Bendersky2012-02-162-3/+1
| | | | | | | | | | | run with LIT now and now Dejagnu. dg.exp is no longer needed. Patch reviewed by Daniel Dunbar. It will be followed by additional cleanup patches. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@150664 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix SSAUpdaterImpl's RecordMatchingPHI to record exactly theDan Gohman2012-02-031-0/+77
| | | | | | | | | | | PHI nodes which were matched, rather than climbing up the original PHI node's operands to rediscover PHI nodes for recording, since the PHI nodes found that are not necessarily part of the matched set. This fixes rdar://10589171. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@149654 91177308-0d34-0410-b5e6-96231b3b80d8
* Upgrade syntax of tests using volatile instructions to use 'load volatile' ↵Chris Lattner2011-11-271-2/+2
| | | | | | instead of 'volatile load', which is archaic. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@145171 91177308-0d34-0410-b5e6-96231b3b80d8
* remove autoupgrade support for really old-style debug info intrinsics.Chris Lattner2011-11-272-291/+0
| | | | | | | | I think this is the last of autoupgrade that can be removed in 3.1. Can the atomic upgrade stuff also go? git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@145169 91177308-0d34-0410-b5e6-96231b3b80d8
* Make sure scalarrepl picks the correct alloca when it rewrites a bitcast. ↵Eli Friedman2011-11-121-0/+26
| | | | | | Fixes PR11353. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@144442 91177308-0d34-0410-b5e6-96231b3b80d8
* The element insertion code in scalar replacement doesn't handle incorrectCameron Zwarich2011-10-231-0/+19
| | | | | | | 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>. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@142740 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix PR11106 by correcting a typo that has been in the code for over a year. ThisCameron Zwarich2011-10-111-0/+22
| | | | | | | | 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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@141713 91177308-0d34-0410-b5e6-96231b3b80d8
* Add a test for PR10565.Cameron Zwarich2011-10-111-0/+15
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@141647 91177308-0d34-0410-b5e6-96231b3b80d8
* Remove a lot of the fancy scalar replacement code for dealing with llvm-gcc'sCameron Zwarich2011-10-111-167/+0
| | | | | | | lowering of NEON code. It provides little-to-no benefit now and only introduces additional complexity. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@141646 91177308-0d34-0410-b5e6-96231b3b80d8
* Stop emitting instructions with the name "tmp" they eat up memory and have ↵Benjamin Kramer2011-09-271-5/+5
| | | | | | | | to be uniqued, without any benefit. If someone prefers %tmp42 to %42, run instnamer. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@140634 91177308-0d34-0410-b5e6-96231b3b80d8
* PR10987: add a missed safety check to isSafePHIToSpeculate in scalarrepl.Eli Friedman2011-09-221-0/+40
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@140327 91177308-0d34-0410-b5e6-96231b3b80d8
* Use %% for literals in RUN lines.Andrew Trick2011-08-261-1/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@138647 91177308-0d34-0410-b5e6-96231b3b80d8
* Move "atomic" and "volatile" designations on instructions after the opcodeEli Friedman2011-08-121-2/+2
| | | | | | | | | | | | of the instruction. Note that this change affects the existing non-atomic load and store instructions; the parser now accepts both forms, and the change is noted in the release notes. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@137527 91177308-0d34-0410-b5e6-96231b3b80d8
* Finish adding support for lifetime intrinsics to SROA. Fixes PR10121!Nick Lewycky2011-07-251-0/+139
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@136008 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix MergeInVectorType to check for vector types with the same allocDan Gohman2011-07-211-0/+27
| | | | | | | | size but different element types, so that it filters out the cases that CreateShuffleVectorCast doesn't handle. This fixes rdar://9786827. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@135721 91177308-0d34-0410-b5e6-96231b3b80d8
* Land the long talked about "type system rewrite" patch. ThisChris Lattner2011-07-093-11/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | patch brings numerous advantages to LLVM. One way to look at it is through diffstat: 109 files changed, 3005 insertions(+), 5906 deletions(-) Removing almost 3K lines of code is a good thing. Other advantages include: 1. Value::getType() is a simple load that can be CSE'd, not a mutating union-find operation. 2. Types a uniqued and never move once created, defining away PATypeHolder. 3. Structs can be "named" now, and their name is part of the identity that uniques them. This means that the compiler doesn't merge them structurally which makes the IR much less confusing. 4. Now that there is no way to get a cycle in a type graph without a named struct type, "upreferences" go away. 5. Type refinement is completely gone, which should make LTO much MUCH faster in some common cases with C++ code. 6. Types are now generally immutable, so we can use "Type *" instead "const Type *" everywhere. Downsides of this patch are that it removes some functions from the C API, so people using those will have to upgrade to (not yet added) new API. "LLVM 3.0" is the right time to do this. There are still some cleanups pending after this, this patch is large enough as-is. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@134829 91177308-0d34-0410-b5e6-96231b3b80d8
* Teach one piece of scalarrepl to handle lifetime markers. When transforming anNick Lewycky2011-06-271-0/+14
| | | | | | | | | 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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@133905 91177308-0d34-0410-b5e6-96231b3b80d8
* Remove support for parsing the "type i32" syntax for defining a numberedChris Lattner2011-06-192-6/+6
| | | | | | | | | top level type without a specified number. This syntax isn't documented and blocks forward progress. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@133371 91177308-0d34-0410-b5e6-96231b3b80d8
* When scalar replacement returns a vector type, only accept it if the vectorCameron Zwarich2011-06-182-2/+19
| | | | | | | | | | | | 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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@133338 91177308-0d34-0410-b5e6-96231b3b80d8
* rip out a ton of intrinsic modernization logic from AutoUpgrade.cpp, which isChris Lattner2011-06-1811-125/+103
| | | | | | | | | | | for pre-2.9 bitcode files. We keep x86 unaligned loads, movnt, crc32, and the target indep prefetch change. As usual, updating the testsuite is a PITA. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@133337 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix an invalid bitcast crash that occurs when doing a partial memset of a vectorCameron Zwarich2011-06-181-0/+22
| | | | | | alloca. Fixes part of <rdar://problem/9580800>. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@133336 91177308-0d34-0410-b5e6-96231b3b80d8
* manually upgrade a bunch of tests to modern syntax, and remove some thatChris Lattner2011-06-172-2/+4
| | | | | | | | are either unreduced or only test old syntax. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@133228 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix PR10104 by adding a bounds check on a vector element access check. It wasCameron Zwarich2011-06-091-3/+5
| | | | | | | | 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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@132766 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix an assymmetry between ConvertScalar_ExtractValue and ↵Cameron Zwarich2011-06-081-0/+60
| | | | | | | | | | 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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@132759 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix "make check" in Release by removing debug-only options from an 'opt' ↵Cameron Zwarich2011-05-241-2/+2
| | | | | | invocation. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@131972 91177308-0d34-0410-b5e6-96231b3b80d8
* Make LoadAndStorePromoter preserve debug info and create llvm.dbg.values whenCameron Zwarich2011-05-242-0/+62
| | | | | | promoting allocas to SSA variables. Fixes <rdar://problem/9479036>. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@131953 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix PR9820: a read-only call differs from a load in that a load doesn'tDuncan Sands2011-05-061-0/+26
| | | | | | | | return the pointer being dereferenced, it returns the pointee, but a call might return the pointer itself. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@130979 91177308-0d34-0410-b5e6-96231b3b80d8
* make a couple of changes to the standard pass pipeline:Chris Lattner2011-04-261-1/+1
| | | | | | | | | | | | | | | | | | | 1. Only run the early (in the module pass pipe) instcombine/simplifycfg if the "unit at a time" passes they are cleaning up after runs. 2. Move the "clean up after the unroller" pass to the very end of the function-level pass pipeline. Loop unroll uses instsimplify now, so it doesn't create a ton of trash. Moving instcombine later allows it to clean up after opportunities are exposed by GVN, DSE, etc. 3. Introduce some phase ordering tests for things that are specifically intended to be simplified by the full optimizer as a whole. This resolves PR2338, and is progress towards PR6627, which will be generating code that looks similar to test2. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@130241 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix another case of <rdar://problem/9184212> that only occurs with codeCameron Zwarich2011-04-201-0/+15
| | | | | | | 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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129878 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix a ton of comment typos found by codespell. Patch byChris Lattner2011-04-151-2/+2
| | | | | | | | Luis Felipe Strano Moraes! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129558 91177308-0d34-0410-b5e6-96231b3b80d8
* Vectors with different number of elements of the same element type can haveMon P Wang2011-04-131-0/+46
| | | | | | | | | 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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129472 91177308-0d34-0410-b5e6-96231b3b80d8
* Do some simple copy propagation through integer loads and stores when promotingCameron Zwarich2011-03-292-1/+54
| | | | | | | vector types. This helps a lot with inlined functions when using the ARM soft float ABI. Fixes <rdar://problem/9184212>. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@128453 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix a typo and add a test.Cameron Zwarich2011-03-261-0/+15
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@128331 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix PR9464 by correcting some math that just happened to be right in most casesCameron Zwarich2011-03-231-0/+16
| | | | | | that were hit in practice. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@128146 91177308-0d34-0410-b5e6-96231b3b80d8
* Only convert allocas to scalars if it is profitable. The profitability metric ICameron Zwarich2011-03-161-0/+27
| | | | | | | | | | | chose is having a non-memcpy/memset use and being larger than any native integer type. Originally I chose having an access of a size smaller than the total size of the alloca, but this caused some minor issues on the spirit benchmark where SRoA runs again after some inlining. This fixes <rdar://problem/8613163>. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127718 91177308-0d34-0410-b5e6-96231b3b80d8
* Add native integer type TargetData to some existing tests.Cameron Zwarich2011-03-162-2/+2
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127717 91177308-0d34-0410-b5e6-96231b3b80d8
* Add a test case for r127320.Cameron Zwarich2011-03-091-0/+14
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127321 91177308-0d34-0410-b5e6-96231b3b80d8
* Add support to scalar replacement for partial vector accesses of an alloca, e.g.Cameron Zwarich2011-03-091-0/+59
| | | | | | | | | | | | | | | | | a union of a float, <2 x float>, and <4 x float>. This mostly comes up with the use of vector intrinsics, especially in NEON when programmers know the layout of the register file. This enables codegen to eliminate a lot of the subregister traffic it would otherwise generate. This commit only enables this for a small number of floating-point cases, but a lot more integer cases. I assume this is okay for all ports, but I did not do extensive testing of the quality of code involving i512 vectors and the like. If there is a use case where this generates worse code than before, let me know and we can scale it back. This fixes <rdar://problem/9036264>. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127317 91177308-0d34-0410-b5e6-96231b3b80d8
* merge all the "crash tests" into crash.llChris Lattner2011-01-2415-293/+240
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@124101 91177308-0d34-0410-b5e6-96231b3b80d8
* fix PR9017, a bug where we'd assert when promoting in unreachableChris Lattner2011-01-241-0/+20
| | | | | | | code. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@124100 91177308-0d34-0410-b5e6-96231b3b80d8
* enhance SRoA to promote allocas that are used by PHI nodes. This oftenChris Lattner2011-01-241-3/+24
| | | | | | | | | | | occurs because instcombine sinks loads and inserts phis. This kicks in on such apps as 175.vpr, eon, 403.gcc, xalancbmk and a bunch of times in spec2006 in some app that uses std::deque. This resolves the last of rdar://7339113. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@124090 91177308-0d34-0410-b5e6-96231b3b80d8
* Enhance SRoA to promote allocas that are used by selects in someChris Lattner2011-01-231-4/+58
| | | | | | | | | | | | | | | | | | | | | | common cases. This triggers a surprising number of times in SPEC2K6 because min/max idioms end up doing this. For example, code from the STL ends up looking like this to SRoA: %202 = load i64* %__old_size, align 8, !tbaa !3 %203 = load i64* %__old_size, align 8, !tbaa !3 %204 = load i64* %__n, align 8, !tbaa !3 %205 = icmp ult i64 %203, %204 %storemerge.i = select i1 %205, i64* %__n, i64* %__old_size %206 = load i64* %storemerge.i, align 8, !tbaa !3 We can now promote both the __n and the __old_size allocas. This addresses another chunk of rdar://7339113, poor codegen on stringswitch. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@124088 91177308-0d34-0410-b5e6-96231b3b80d8
* Enhance SRoA to be more aggressive about scalarization of aggregate allocasChris Lattner2011-01-231-0/+78
| | | | | | | | | | | | | | that have PHI or select uses of their element pointers. This can often happen when instcombine sinks two loads into a successor, inserting a phi or select. With this patch, we can scalarize the alloca, but the pinned elements are not yet promoted. This is still a win for large aggregates where only one element is used. This fixes rdar://8904039 and part of rdar://7339113 (poor codegen on stringswitch). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@124070 91177308-0d34-0410-b5e6-96231b3b80d8
* remove an old hack that avoided creating MMX datatypes. TheChris Lattner2011-01-231-4/+2
| | | | | | | X86 backend has been fixed. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@124064 91177308-0d34-0410-b5e6-96231b3b80d8
* if an alloca is only ever accessed as a unit, and is accessed with ↵Chris Lattner2011-01-161-2/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | load/store instructions, then don't try to decimate it into its individual pieces. This will just make a mess of the IR and is pointless if none of the elements are individually accessed. This was generating really terrible code for std::bitset (PR8980) because it happens to be lowered by clang as an {[8 x i8]} structure instead of {i64}. The testcase now is optimized to: define i64 @test2(i64 %X) { br label %L2 L2: ; preds = %0 ret i64 %X } before we generated: define i64 @test2(i64 %X) { %sroa.store.elt = lshr i64 %X, 56 %1 = trunc i64 %sroa.store.elt to i8 %sroa.store.elt8 = lshr i64 %X, 48 %2 = trunc i64 %sroa.store.elt8 to i8 %sroa.store.elt9 = lshr i64 %X, 40 %3 = trunc i64 %sroa.store.elt9 to i8 %sroa.store.elt10 = lshr i64 %X, 32 %4 = trunc i64 %sroa.store.elt10 to i8 %sroa.store.elt11 = lshr i64 %X, 24 %5 = trunc i64 %sroa.store.elt11 to i8 %sroa.store.elt12 = lshr i64 %X, 16 %6 = trunc i64 %sroa.store.elt12 to i8 %sroa.store.elt13 = lshr i64 %X, 8 %7 = trunc i64 %sroa.store.elt13 to i8 %8 = trunc i64 %X to i8 br label %L2 L2: ; preds = %0 %9 = zext i8 %1 to i64 %10 = shl i64 %9, 56 %11 = zext i8 %2 to i64 %12 = shl i64 %11, 48 %13 = or i64 %12, %10 %14 = zext i8 %3 to i64 %15 = shl i64 %14, 40 %16 = or i64 %15, %13 %17 = zext i8 %4 to i64 %18 = shl i64 %17, 32 %19 = or i64 %18, %16 %20 = zext i8 %5 to i64 %21 = shl i64 %20, 24 %22 = or i64 %21, %19 %23 = zext i8 %6 to i64 %24 = shl i64 %23, 16 %25 = or i64 %24, %22 %26 = zext i8 %7 to i64 %27 = shl i64 %26, 8 %28 = or i64 %27, %25 %29 = zext i8 %8 to i64 %30 = or i64 %29, %28 ret i64 %30 } In this case, instcombine was able to eliminate the nonsense, but in PR8980 enough PHIs are in play that instcombine backs off. It's better to not generate this stuff in the first place. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123571 91177308-0d34-0410-b5e6-96231b3b80d8
* Extend SROA to handle arrays accessed as homogeneous structs and vice versa.Bob Wilson2011-01-131-3/+26
| | | | | | | | | | | | | | | | | This is a minor extension of SROA to handle a special case that is important for some ARM NEON operations. Some of the NEON intrinsics return multiple values, which are handled as struct types containing multiple elements of the same vector type. The corresponding return types declared in the arm_neon.h header have equivalent arrays. We need SROA to recognize that it can split up those arrays and structs into separate vectors, even though they are not always accessed with the same type. SROA already handles loads and stores of an entire alloca by using insertvalue/extractvalue to access the individual pieces, and that code works the same regardless of whether the type is a struct or an array. So, all that needs to be done is to check for compatible arrays and homogeneous structs. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123381 91177308-0d34-0410-b5e6-96231b3b80d8
* Make SROA more aggressive with allocas containing padding.Bob Wilson2011-01-131-1/+28
| | | | | | | SROA only split up structs and arrays one level at a time, so padding can only cause trouble if it is located in between the struct or array elements. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123380 91177308-0d34-0410-b5e6-96231b3b80d8
* Treat a call of function pointer like a load of the pointer when consideringNick Lewycky2010-11-241-0/+13
| | | | | | | | whether the pointer can be replaced with the global variable it is a copy of. Fixes PR8680. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@120126 91177308-0d34-0410-b5e6-96231b3b80d8