summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms
Commit message (Collapse)AuthorAgeFilesLines
* When looking for a vector representation of a scalar, do a single lookup. ↵Nadav Rotem2012-10-181-7/+14
| | | | | | | | Also, cache the result of the broadcast instruction. No functionality change. llvm-svn: 166191
* Refactor insert and extract of sub-integers into static helpers thatChandler Carruth2012-10-181-68/+84
| | | | | | | | | | | | | operate purely on values. Sink the alloca loading and storing logic into the rewrite routines that are specific to alloca-integer-rewrite driving. This is just a refactoring here, but the subsequent step will be to reuse the insertion and extraction logic when rewriting integer loads and stores that have been split and decomposed into narrower loads and stores. No functionality changed other than different names for instructions. llvm-svn: 166176
* This FIXME was fixed some time ago. =]Chandler Carruth2012-10-181-3/+0
| | | | llvm-svn: 166175
* Introduce a BarrierNoop pass, a hack designed to allow *some* controlChandler Carruth2012-10-183-0/+56
| | | | | | | | | | | | | | | | | | | | | | | | | | | | over the implicitly-formed-and-nesting CGSCC pass manager and function pass managers, especially when using them on the opt commandline or using extension points in the module builder. The '-barrier' opt flag (or the pass itself) will create a no-op module pass in the pipeline, resetting the pass manager stack, and allowing the creation of a new pipeline of function passes or CGSCC passes to be created that is independent from any previous pipelines. For example, this can be used to test running two CGSCC passes in independent CGSCC pass managers as opposed to in the same CGSCC pass manager. It also allows us to introduce a further hack into the PassManagerBuilder to separate the O0 pipeline extension passes from the always-inliner's CGSCC pass manager, which they likely do not want to participate in... At the very least none of the Sanitizer passes want this behavior. This fixes a bug with ASan at O0 currently, and I'll commit the ASan test which covers this pass. I'm happy to add a test case that this pass exists and works, but not sure how much time folks would like me to spend adding test cases for the details of its behavior of partition pass managers.... The whole thing is just vile, and mostly intended to unblock ASan, so I'm hoping to rip this all out in a brave new pass manager world. llvm-svn: 166172
* remove unused variable to fix a warning.Nadav Rotem2012-10-181-2/+1
| | | | llvm-svn: 166170
* Temporarily revert the TargetTransform changes.Bob Wilson2012-10-182-88/+78
| | | | | | | | | | | The TargetTransform changes are breaking LTO bootstraps of clang. I am working with Nadav to figure out the problem, but I am reverting it for now to get our buildbots working. This reverts svn commits: 165665 165669 165670 165786 165787 165997 and I have also reverted clang svn 165741 llvm-svn: 166168
* Remove the use of dominators and AA.Nadav Rotem2012-10-181-8/+0
| | | | llvm-svn: 166167
* Vectorizer: Add support for loops with an unknown count. For example:Nadav Rotem2012-10-181-68/+159
| | | | | | | | for (i=0; i<n; i++){ a[i] = b[i+1] + c[i+3]; } llvm-svn: 166165
* LoopVectorize.cpp: Fix a warning. [-Wunused-variable]NAKAMURA Takumi2012-10-171-2/+1
| | | | llvm-svn: 166153
* Remove redundant SetInsertPoint call.Jakub Staszak2012-10-171-1/+0
| | | | llvm-svn: 166138
* Fix some typos and wrong indenting.Roman Divacky2012-10-171-4/+4
| | | | llvm-svn: 166128
* Add a loop vectorizer.Nadav Rotem2012-10-174-2/+814
| | | | llvm-svn: 166112
* [asan] better debug diagnostics in asan compiler moduleKostya Serebryany2012-10-171-4/+4
| | | | llvm-svn: 166102
* This just in, it is a *bad idea* to use 'udiv' on an offset ofChandler Carruth2012-10-171-3/+3
| | | | | | | | | | | a pointer. A very bad idea. Let's not do that. Fixes PR14105. Note that this wasn't *that* glaring of an oversight. Originally, these routines were only called on offsets within an alloca, which are intrinsically positive. But over the evolution of the pass, they ended up being called for arbitrary offsets, and things went downhill... llvm-svn: 166095
* Fix a really annoying "bug" introduced in r165941. The change from thatChandler Carruth2012-10-171-3/+3
| | | | | | | | | | | revision makes no sense. We cannot use the address space of the *post indexed* type to conclude anything about a *pre indexed* pointer type's size. More importantly, this index can never be over a pointer. We are indexing over arrays and vectors here. Of course, I have no test case here. Neither did the original patch. =/ llvm-svn: 166091
* [InstCombine] Teach InstCombine how to handle an obfuscated splat.Michael Gottesman2012-10-161-2/+5
| | | | | | | | | | | | An obfuscated splat is where the frontend poorly generates code for a splat using several different shuffles to create the splat, i.e., %A = load <4 x float>* %in_ptr, align 16 %B = shufflevector <4 x float> %A, <4 x float> undef, <4 x i32> <i32 0, i32 0, i32 undef, i32 undef> %C = shufflevector <4 x float> %B, <4 x float> %A, <4 x i32> <i32 0, i32 1, i32 4, i32 undef> %D = shufflevector <4 x float> %C, <4 x float> %A, <4 x i32> <i32 0, i32 1, i32 2, i32 4> llvm-svn: 166061
* Simplify code. No functionality change.Jakub Staszak2012-10-161-7/+3
| | | | llvm-svn: 166053
* 80-col fixup.Jakub Staszak2012-10-161-1/+2
| | | | llvm-svn: 166050
* Simplify potentially quadratic behavior while erasing elements from std::vector.Jakub Staszak2012-10-161-7/+1
| | | | llvm-svn: 166045
* Use the Attributes::get method which takes an AttrVal value directly to ↵Bill Wendling2012-10-163-34/+13
| | | | | | simplify the code a bit. No functionality change. llvm-svn: 166009
* Fix filename in file header.Craig Topper2012-10-161-1/+1
| | | | llvm-svn: 166004
* Move the Attributes::Builder outside of the Attributes class and into its ↵Bill Wendling2012-10-158-22/+22
| | | | | | own class named AttrBuilder. No functionality change. llvm-svn: 165960
* Resubmit the changes to llvm core to update the functions to support ↵Micah Villmow2012-10-156-15/+28
| | | | | | different pointer sizes on a per address space basis. llvm-svn: 165941
* [asan] make AddressSanitizer to be a FunctionPass instead of ModulePass. ↵Kostya Serebryany2012-10-151-63/+52
| | | | | | This will simplify chaining other FunctionPasses with asan. Also some minor cleanup llvm-svn: 165936
* Update the memcpy rewriting to fully support widened int rewriting. ThisChandler Carruth2012-10-151-8/+26
| | | | | | | | includes extracting ints for copying elsewhere and inserting ints when copying into the alloca. This should fix the CanSROA assertion coming out of Clang's regression test suite. llvm-svn: 165931
* Follow-up fix to r165928: handle memset rewriting for widened integers,Chandler Carruth2012-10-151-30/+25
| | | | | | | and generally clean up the memset handling. It had rotted a bit as the other rewriting logic got polished more. llvm-svn: 165930
* First major step toward addressing PR14059. This teaches SROA to handleChandler Carruth2012-10-151-53/+93
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | cases where we have partial integer loads and stores to an otherwise promotable alloca to widen[1] those loads and stores to cover the entire alloca and bitcast them into the appropriate type such that promotion can proceed. These partial loads and stores stem from an annoying confluence of ARM's calling convention and ABI lowering and the FCA pre-splitting which takes place in SROA. Clang lowers a { double, double } in-register function argument as a [4 x i32] function argument to ensure it is placed into integer 32-bit registers (a really unnerving implicit contract between Clang and the ARM backend I would add). This results in a FCA load of [4 x i32]* from the { double, double } alloca, and SROA decomposes this into a sequence of i32 loads and stores. Inlining proceeds, code gets folded, but at the end of the day, we still have i32 stores to the low and high halves of a double alloca. Widening these to be i64 operations, and bitcasting them to double prior to loading or storing allows promotion to proceed for these allocas. I looked quite a bit changing the IR which Clang produces for this case to be more friendly, but small changes seem unlikely to help. I think the best representation we could use currently would be to pass 4 i32 arguments thereby avoiding any FCAs, but that would still require this fix. It seems like it might eventually be nice to somehow encode the ABI register selection choices outside of the parameter type system so that the parameter can be a { double, double }, but the CC register annotations indicate that this should be passed via 4 integer registers. This patch does not address the second problem in PR14059, which is the reverse: when a struct alloca is loaded as a *larger* single integer. This patch also does not address some of the code quality issues with the FCA-splitting. Those don't actually impede any optimizations really, but they're on my list to clean up. [1]: Pedantic footnote: for those concerned about memory model issues here, this is safe. For the alloca to be promotable, it cannot escape or have any use of its address that could allow these loads or stores to be racing. Thus, widening is always safe. llvm-svn: 165928
* Hoist the canConvertValue predicate and the convertValue transform outChandler Carruth2012-10-151-44/+52
| | | | | | | into static helper functions. They're really quite generic and are going to be needed elsewhere shortly. llvm-svn: 165927
* Add an enum for the return and function indexes into the AttrListPtr object. ↵Bill Wendling2012-10-157-45/+77
| | | | | | This gets rid of some magic numbers. llvm-svn: 165924
* Attributes RewriteBill Wendling2012-10-158-48/+58
| | | | | | | | | | Convert the internal representation of the Attributes class into a pointer to an opaque object that's uniqued by and stored in the LLVMContext object. The Attributes class then becomes a thin wrapper around this opaque object. Eventually, the internal representation will be expanded to include attributes that represent code generation options, etc. llvm-svn: 165917
* instcombine: Migrate strcmp and strncmp optimizationsMeador Inge2012-10-152-105/+99
| | | | | | | This patch migrates the strcmp and strncmp optimizations from the simplify-libcalls pass into the instcombine library call simplifier. llvm-svn: 165915
* Simplify code. No functionality change.Benjamin Kramer2012-10-141-5/+3
| | | | llvm-svn: 165904
* Unquadratize SetVector removal loops in DSE.Benjamin Kramer2012-10-141-27/+36
| | | | | | | | | Erasing from the beginning or middle of the vector is expensive, remove_if can do it in linear time even though it's a bit ugly without lambdas. No functionality change. llvm-svn: 165903
* Remove operator cast method in favor of querying with the correct method.Bill Wendling2012-10-143-19/+36
| | | | llvm-svn: 165899
* Remove the bitwise AND operators from the Attributes class. Replace it with ↵Bill Wendling2012-10-142-3/+5
| | | | | | the equivalent from the builder class. llvm-svn: 165896
* Remove the bitwise assignment OR operator from the Attributes class. Replace ↵Bill Wendling2012-10-143-12/+22
| | | | | | it with the equivalent from the builder class. llvm-svn: 165895
* Remove the bitwise XOR operator from the Attributes class. Replace it with ↵Bill Wendling2012-10-141-2/+4
| | | | | | the equivalent from the builder class. llvm-svn: 165893
* Remove the bitwise NOT operator from the Attributes class. Replace it with ↵Bill Wendling2012-10-142-6/+10
| | | | | | the equivalent from the builder class. llvm-svn: 165892
* Remove unused private field.Benjamin Kramer2012-10-131-1/+0
| | | | llvm-svn: 165881
* instcombine: Migrate strchr and strrchr optimizationsMeador Inge2012-10-132-91/+86
| | | | | | | This patch migrates the strchr and strrchr optimizations from the simplify-libcalls pass into the instcombine library call simplifier. llvm-svn: 165875
* instcombine: Migrate strcat and strncat optimizationsMeador Inge2012-10-132-101/+107
| | | | | | | This patch migrates the strcat and strncat optimizations from the simplify-libcalls pass into the instcombine library call simplifier. llvm-svn: 165874
* Implement new LibCallSimplifier classMeador Inge2012-10-135-36/+299
| | | | | | | | | | | | | | | | This patch implements the new LibCallSimplifier class as outlined in [1]. In addition to providing the new base library simplification infrastructure, all the fortified library call simplifications were moved over to the new infrastructure. The rest of the library simplification optimizations will be moved over with follow up patches. NOTE: The original fortified library call simplifier located in the SimplifyFortifiedLibCalls class was not removed because it is still used by CodeGenPrepare. This class will eventually go away too. [1] http://lists.cs.uiuc.edu/pipermail/llvmdev/2012-August/052283.html llvm-svn: 165873
* Teach SROA to cope with wrapper aggregates. These show up a lot in ABIChandler Carruth2012-10-131-3/+33
| | | | | | | | | | | | | | | | | | | | | | | type coercion code, especially when targetting ARM. Things like [1 x i32] instead of i32 are very common there. The goal of this logic is to ensure that when we are picking an alloca type, we look through such wrapper aggregates and across any zero-length aggregate elements to find the simplest type possible to form a type partition. This logic should (generally speaking) rarely fire. It only ends up kicking in when an alloca is accessed using two different types (for instance, i32 and float), and the underlying alloca type has wrapper aggregates around it. I noticed a significant amount of this occurring looking at stepanov_abstraction generated code for arm, and suspect it happens elsewhere as well. Note that this doesn't yet address truly heinous IR productions such as PR14059 is concerning. Those result in mismatched *sizes* of types in addition to mismatched access and alloca types. llvm-svn: 165870
* Speculatively harden the conversion logic. I have no idea if this willChandler Carruth2012-10-131-0/+11
| | | | | | | | | help the dragonegg builders, and no test case at this point, but this was one dimly plausible case I spotted by inspection. Hopefully will get a testcase from those bots soon-ish, and will tidy this up with proper testing. llvm-svn: 165869
* Silence a warning in -assert builds.Chandler Carruth2012-10-131-0/+1
| | | | llvm-svn: 165867
* Clean up how we rewrite loads and stores to the whole alloca. When theseChandler Carruth2012-10-131-5/+49
| | | | | | | | | | | | are single value types, the load and store should be directly based upon the alloca and then bitcasting can fix the type as needed afterward. This might in theory improve some of the IR coming out of SROA, but I don't expect big changes yet and don't have any test cases on hand. This is really just a cleanup/refactoring patch. The next patch will cause this code path to be hit a lot more, actually get SROA to promote more allocas and include several more test cases. llvm-svn: 165864
* PGO: create metadata for switch only if it has more than one targets.Manman Ren2012-10-111-1/+1
| | | | | | | When all cases of a switch statement are dead, the weights vector only has one element, and we will get an ssertion failure when calling createBranchWeights. llvm-svn: 165759
* Revert 165732 for further review.Micah Villmow2012-10-116-28/+15
| | | | llvm-svn: 165747
* Add in the first iteration of support for llvm/clang/lldb to allow variable ↵Micah Villmow2012-10-116-15/+28
| | | | | | per address space pointer sizes to be optimized correctly. llvm-svn: 165726
* Don't crash when !tbaa.struct contents is invalid.Nick Lewycky2012-10-111-0/+3
| | | | llvm-svn: 165693
OpenPOWER on IntegriCloud