aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Transforms
Commit message (Collapse)AuthorAgeFilesLines
* Remove unused private field.Benjamin Kramer2012-10-131-1/+0
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@165881 91177308-0d34-0410-b5e6-96231b3b80d8
* 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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@165875 91177308-0d34-0410-b5e6-96231b3b80d8
* 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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@165874 91177308-0d34-0410-b5e6-96231b3b80d8
* 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 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@165873 91177308-0d34-0410-b5e6-96231b3b80d8
* 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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@165870 91177308-0d34-0410-b5e6-96231b3b80d8
* 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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@165869 91177308-0d34-0410-b5e6-96231b3b80d8
* Silence a warning in -assert builds.Chandler Carruth2012-10-131-0/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@165867 91177308-0d34-0410-b5e6-96231b3b80d8
* 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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@165864 91177308-0d34-0410-b5e6-96231b3b80d8
* 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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@165759 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert 165732 for further review.Micah Villmow2012-10-116-28/+15
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@165747 91177308-0d34-0410-b5e6-96231b3b80d8
* 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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@165726 91177308-0d34-0410-b5e6-96231b3b80d8
* Don't crash when !tbaa.struct contents is invalid.Nick Lewycky2012-10-111-0/+3
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@165693 91177308-0d34-0410-b5e6-96231b3b80d8
* Add a new interface to allow IR-level passes to access codegen-specific ↵Nadav Rotem2012-10-102-78/+88
| | | | | | information. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@165665 91177308-0d34-0410-b5e6-96231b3b80d8
* Remove the final bits of Attributes being declared in the AttributeBill Wendling2012-10-104-10/+24
| | | | | | | | namespace. Use the attribute's enum value instead. No functionality change intended. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@165610 91177308-0d34-0410-b5e6-96231b3b80d8
* Pass into the AttributeWithIndex::get method an ArrayRef of attributeBill Wendling2012-10-101-31/+33
| | | | | | | enums. These are then created via the correct Attributes creation method. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@165607 91177308-0d34-0410-b5e6-96231b3b80d8
* Have 'addFnAttr' take the attribute enum value. Then have it build the ↵Bill Wendling2012-10-103-9/+5
| | | | | | attribute object and add it appropriately. No functionality change. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@165595 91177308-0d34-0410-b5e6-96231b3b80d8
* Use the attribute enums to query if a parameter has an attribute.Bill Wendling2012-10-091-1/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@165550 91177308-0d34-0410-b5e6-96231b3b80d8
* Update EarlyCSE's SimpleValues to use Hashing.h for their hashes. Expanded ↵Michael Ilseman2012-10-091-25/+81
| | | | | | the hashing and equality to allow for equality modulo commutativity for binary ops, and comparisons with swapping of predicates. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@165509 91177308-0d34-0410-b5e6-96231b3b80d8
* Fixup for r165490: Use DenseMap instead of std::map. Simplify the loop in ↵Alexey Samsonov2012-10-091-13/+16
| | | | | | CollectFunctionDIs. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@165498 91177308-0d34-0410-b5e6-96231b3b80d8
* Use the enum value of the attributes when adding them to the attributes builder.Bill Wendling2012-10-093-13/+13
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@165494 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix PR14016.Alexey Samsonov2012-10-091-0/+50
| | | | | | | | | | | DeadArgumentElimination pass can replace one LLVM function with another, invalidating a pointer stored in debug info metadata entry for this function. To fix this, we collect debug info descriptors for functions before running a DeadArgumentElimination pass and "patch" pointers in metadata nodes if we replace a function. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@165490 91177308-0d34-0410-b5e6-96231b3b80d8
* Create enums for the different attributes.Bill Wendling2012-10-099-20/+27
| | | | | | | | We use the enums to query whether an Attributes object has that attribute. The opaque layer is responsible for knowing where that specific attribute is stored. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@165488 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix PR14034, an infloop / heap corruption / crash bug in the new SROA.Chandler Carruth2012-10-091-0/+2
| | | | | | | Thanks to Benjamin for the raw test case. This one took about 50 times longer to reduce than to fix. =/ git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@165476 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix. Apply the no capture attribute to the correct parameter.Bill Wendling2012-10-091-4/+7
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@165469 91177308-0d34-0410-b5e6-96231b3b80d8
* Convert to using the Attributes::Builder class to create attributes.Bill Wendling2012-10-092-14/+29
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@165468 91177308-0d34-0410-b5e6-96231b3b80d8
* Convert to using the Attributes::Builder interface.Bill Wendling2012-10-092-14/+19
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@165465 91177308-0d34-0410-b5e6-96231b3b80d8
* Refactor the AddrMode class out of TLI to its own header file.Nadav Rotem2012-10-081-7/+8
| | | | | | | | | | This class is used by LSR and a number of places in the codegen. This is the first step in de-coupling LSR from TLI, and creating a new interface in between them. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@165455 91177308-0d34-0410-b5e6-96231b3b80d8
* Give CaptureTracker::shouldExplore a base implementation. Most users want to doNick Lewycky2012-10-081-2/+0
| | | | | | | the same thing. No functionality change. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@165435 91177308-0d34-0410-b5e6-96231b3b80d8
* Move TargetData to DataLayout.Micah Villmow2012-10-0850-268/+268
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@165402 91177308-0d34-0410-b5e6-96231b3b80d8
* SROA.cpp: Fix a warning, [-Wunused-variable]NAKAMURA Takumi2012-10-051-0/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@165309 91177308-0d34-0410-b5e6-96231b3b80d8
* Move this test a bit later, after the point at which we know that we eitherDuncan Sands2012-10-051-10/+10
| | | | | | | | | have an alloca or a parameter, since then the alloca test should make sense to readers, while before it probably appears too specific. No functionality change. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@165306 91177308-0d34-0410-b5e6-96231b3b80d8
* Teach the new SROA a new trick. Now we zap any memcpy or memmoves whichChandler Carruth2012-10-051-42/+93
| | | | | | | | | | | | are in fact identity operations. We detect these and kill their partitions so that even splitting is unaffected by them. This is particularly important because Clang relies on emitting identity memcpy operations for struct copies, and these fold away to constants very often after inlining. Fixes the last big performance FIXME I have on my plate. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@165285 91177308-0d34-0410-b5e6-96231b3b80d8
* Lift the speculation visitor above all the helpers that are targeted atChandler Carruth2012-10-051-281/+283
| | | | | | | | | | | the rewrite visitor to make the fact that the speculation is completely independent a bit more clear. I promise that this is just a cut/paste of the one visitor and adding the annonymous namespace wrappings. The diff may look completely preposterous, it does in git for some reason. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@165284 91177308-0d34-0410-b5e6-96231b3b80d8
* This patch corrects commit 165126 by using an integer bit width instead of Preston Gurd2012-10-042-11/+11
| | | | | | | | | | a pointer to a type, in order to remove the uses of getGlobalContext(). Patch by Tyler Nowicki. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@165255 91177308-0d34-0410-b5e6-96231b3b80d8
* Add a comment to the commit r165187.Jakub Staszak2012-10-041-1/+3
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@165238 91177308-0d34-0410-b5e6-96231b3b80d8
* SimplifyCFG: Enhance the "remove CFG edge that leads to null pointer ↵Benjamin Kramer2012-10-041-2/+3
| | | | | | | | | | dereference" optimization to also handle instructions with multiple uses. We conservatively only check the first use to avoid walking long use chains. This catches the common case of having both a load and a store to a pointer supplied by a PHI node. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@165232 91177308-0d34-0410-b5e6-96231b3b80d8
* In my recent change to avoid use of underaligned memory I didn't notice thatDuncan Sands2012-10-041-7/+7
| | | | | | | | | cpyDest can be mutated in some cases, which would then cause a crash later if indeed the memory was underaligned. This brought down several buildbots, so I guess the underaligned case is much more common than I thought! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@165228 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix PR13969, a mini-phase-ordering issue with the new SROA pass.Chandler Carruth2012-10-041-23/+50
| | | | | | | | | | | | | | | | | | | | | Currently, we re-visit allocas when something changes about the way they might be *split* to allow better scalarization to take place. However, we weren't handling the case when the *promotion* is what would change the behavior of SROA. When an address derived from an alloca is stored into another alloca, we consider the first to have escaped. If the second is ever promoted to an SSA value, we will suddenly be able to run the SROA pass on the first alloca. This patch adds explicit support for this form if iteration. When we detect a store of a pointer derived from an alloca, we flag the underlying alloca for reprocessing after promotion. The logic works hard to only do this when there is definitely going to be promotion and it might remove impediments to the analysis of the alloca. Thanks to Nick for the great test case and Benjamin for some sanity check review. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@165223 91177308-0d34-0410-b5e6-96231b3b80d8
* The memcpy optimizer was happily doing call slot forwarding when the new memoryDuncan Sands2012-10-041-4/+30
| | | | | | | | | | | was less aligned than the old. In the testcase this results in an overaligned memset: the memset alignment was correct for the original memory but is too much for the new memory. Fix this by either increasing the alignment of the new memory or bailing out if that isn't possible. Should fix the gcc-4.7 self-host buildbot failure. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@165220 91177308-0d34-0410-b5e6-96231b3b80d8
* Teach the integer-promotion rewrite strategy to be endianness aware.Chandler Carruth2012-10-041-9/+29
| | | | | | | | | | | | | | | | | | | | | | | Sorry for this being broken so long. =/ As part of this, switch all of the existing tests to be Little Endian, which is the behavior I was asserting in them anyways! Add in a new big-endian test that checks the interesting behavior there. Another part of this is to tighten the rules abotu when we perform the full-integer promotion. This logic now rejects cases where there fully promoted integer is a non-multiple-of-8 bitwidth or cases where the loads or stores touch bits which are in the allocated space of the alloca but are not loaded or stored when accessing the integer. Sadly, these aren't really observable today as the rest of the pass will already ensure the invariants hold. However, the latter situation is likely to become a potential concern in the future. Thanks to Benjamin and Duncan for early review of this patch. I'm still looking into whether there are further endianness issues, please let me know if anyone sees BE failures persisting past this. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@165219 91177308-0d34-0410-b5e6-96231b3b80d8
* Use method to query for attributes.Bill Wendling2012-10-042-2/+2
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@165209 91177308-0d34-0410-b5e6-96231b3b80d8
* Add method to query for 'NoAlias' attribute on call/invoke instructions.Bill Wendling2012-10-041-1/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@165208 91177308-0d34-0410-b5e6-96231b3b80d8
* Use method to query for attributes.Bill Wendling2012-10-041-1/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@165207 91177308-0d34-0410-b5e6-96231b3b80d8
* Query for attributes via the correct method call.Bill Wendling2012-10-041-2/+2
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@165206 91177308-0d34-0410-b5e6-96231b3b80d8
* [tsan] add 3 internal flags for fine-grain control of what is instrumented ↵Kostya Serebryany2012-10-041-7/+18
| | | | | | and what is not. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@165204 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix PR13967.Jakub Staszak2012-10-031-1/+4
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@165187 91177308-0d34-0410-b5e6-96231b3b80d8
* This Patch corrects a problem whereby the optimization to use a faster dividePreston Gurd2012-10-031-5/+15
| | | | | | | | | | | | | | | | instruction (for Intel Atom) was not being done by Clang, because the type context used by Clang is not the default context. It fixes the problem by getting the global context types for each div/rem instruction in order to compare them against the types in the BypassTypeMap. Tests for this will be done as a separate patch to Clang. Patch by Tyler Nowicki. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@165126 91177308-0d34-0410-b5e6-96231b3b80d8
* tsan: prepare for migration to new memory_order enum values (ABI compatible)Dmitry Vyukov2012-10-031-1/+2
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@165107 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix an issue where we failed to adjust the alignment constraint onChandler Carruth2012-10-031-0/+6
| | | | | | | | a memcpy to reflect that '0' has a different meaning when applied to a load or store. Now we correctly use underaligned loads and stores for the test case added. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@165101 91177308-0d34-0410-b5e6-96231b3b80d8
* Try to use a better set of abstractions for computing the alignmentChandler Carruth2012-10-031-16/+28
| | | | | | | | | | | | | | | | | | | | necessary during rewriting. As part of this, fix a real think-o here where we might have left off an alignment specification when the address is in fact underaligned. I haven't come up with any way to trigger this, as there is always some other factor that reduces the alignment, but it certainly might have been an observable bug in some way I can't think of. This also slightly changes the strategy for placing explicit alignments on loads and stores to only do so when the alignment does not match that required by the ABI. This causes a few redundant alignments to go away from test cases. I've also added a couple of tests that really push on the alignment that we end up with on loads and stores. More to come here as I try to fix an underlying bug I have conjectured and produced test cases for, although it's not clear if this bug is the one currently hitting dragonegg's gcc47 bootstrap. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@165100 91177308-0d34-0410-b5e6-96231b3b80d8