summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms
Commit message (Collapse)AuthorAgeFilesLines
* PlaceSafepoints: use IRBuilder helpersRamkumar Ramachandra2015-02-261-44/+39
| | | | | | | | | | Use the IRBuilder helpers for gc.statepoint and gc.result, instead of coding the construction by hand. Note that the gc.statepoint IRBuilder handles only CallInst, not InvokeInst; retain that part of hand-coding. Differential Revision: http://reviews.llvm.org/D7518 llvm-svn: 230591
* InstrProf: Make the __llvm_profile_runtime_user symbol hiddenJustin Bogner2015-02-251-0/+1
| | | | | | | | | This symbol exists only to pull in the required pieces of the runtime, so nothing ever needs to refer to it. Making it hidden avoids the potential for issues with duplicate symbols when linking profiled libraries together. llvm-svn: 230566
* only propagate equality comparisons of FP values that we are certain are ↵Sanjay Patel2015-02-251-3/+7
| | | | | | | | | | | | non-zero This is a follow-on to r227491 which tightens the check for propagating FP values. If a non-constant value happens to be a zero, we would hit the same bug as before. Bug noted and patch suggested by Eli Friedman. llvm-svn: 230564
* InstCombine: extract instead of shuffle when performing vector/array type ↵JF Bastien2015-02-251-5/+116
| | | | | | | | | | | | | punning Summary: SROA generates code that isn't quite as easy to optimize and contains unusual-sized shuffles, but that code is generally correct. As discussed in D7487 the right place to clean things up is InstCombine, which will pick up the type-punning pattern and transform it into a more obvious bitcast+extractelement, while leaving the other patterns SROA encounters as-is. Test Plan: make check Reviewers: jvoung, chandlerc Subscribers: llvm-commits llvm-svn: 230560
* LowerBitSets: Align referenced globals.Peter Collingbourne2015-02-251-22/+40
| | | | | | | | | | | | | | | | This change aligns globals to the next highest power of 2 bytes, up to a maximum of 128. This makes it more likely that we will be able to compress bit sets with a greater alignment. In many more cases, we can now take advantage of a new optimization also introduced in this patch that removes bit set checks if the bit set is all ones. The 128 byte maximum was found to provide the best tradeoff between instruction overhead and data overhead in a recent build of Chromium. It allows us to remove ~2.4MB of instructions at the cost of ~250KB of data. Differential Revision: http://reviews.llvm.org/D7873 llvm-svn: 230540
* [IC] Turn non-null MD on pointer loads to range MD on integer loads.Charles Davis2015-02-251-4/+18
| | | | | | | | | | | | | | | | | Summary: This change fixes the FIXME that you recently added when you committed (a modified version of) my patch. When `InstCombine` combines a load and store of an pointer to those of an equivalently-sized integer, it currently drops any `!nonnull` metadata that might be present. This change replaces `!nonnull` metadata with `!range !{ 1, -1 }` metadata instead. Reviewers: chandlerc Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D7621 llvm-svn: 230462
* LowerBitSets: Introduce global layout builder.Peter Collingbourne2015-02-241-10/+78
| | | | | | | | | | The builder is based on a layout algorithm that tries to keep members of small bit sets together. The new layout compresses Chromium's bit sets to around 15% of their original size. Differential Revision: http://reviews.llvm.org/D7796 llvm-svn: 230394
* remove function names from comments; NFCSanjay Patel2015-02-241-42/+38
| | | | llvm-svn: 230391
* Fix alloca_instruments_all_paddings.cc test to work under higher -O levels ↵Kuba Brecka2015-02-241-7/+5
| | | | | | | | | | (llvm part) When AddressSanitizer only a single dynamic alloca and no static allocas, due to an early exit from FunctionStackPoisoner::poisonStack we forget to unpoison the dynamic alloca. This patch fixes that. Reviewed at http://reviews.llvm.org/D7810 llvm-svn: 230316
* New instcombine rule: max(~a,~b) -> ~min(a, b)Sanjoy Das2015-02-243-23/+66
| | | | | | | | | | This case is interesting because ScalarEvolutionExpander lowers min(a, b) as ~max(~a,~b). I think the profitability heuristics can be made more clever/aggressive, but this is a start. Differential Revision: http://reviews.llvm.org/D7821 llvm-svn: 230285
* add newline for easier reading; NFCSanjay Patel2015-02-231-1/+1
| | | | llvm-svn: 230265
* Remap frame variables for native Windows exception handling.Andrew Kaylor2015-02-231-2/+22
| | | | | | Differential Revision: http://reviews.llvm.org/D7770 llvm-svn: 230249
* Prevent hoisting fmul from THEN/ELSE to IF if there is fmsub/fmadd opportunity.Chad Rosier2015-02-231-2/+6
| | | | | | | | | | | This patch adds the isProfitableToHoist API. For AArch64, we want to prevent a fmul from being hoisted in cases where it is more profitable to form a fmsub/fmadd. Phabricator Review: http://reviews.llvm.org/D7299 Patch by Lawrence Hu <lawrence@codeaurora.org> llvm-svn: 230241
* InstSimplify: simplify 0 / X if nnan and nszMehdi Amini2015-02-231-2/+4
| | | | | From: Fiona Glaser <fglaser@apple.com> llvm-svn: 230238
* Roll condition into an assert then wrap it 'ifndef NDEBUG' to protect from ↵David Blaikie2015-02-221-8/+7
| | | | | | the inevitable "unused variable" warning in a non-asserts build. llvm-svn: 230181
* [LICM] Refactor to expose functionality as utility functionsHal Finkel2015-02-221-173/+199
| | | | | | | | | | | This refactors the core functionality of LICM: HoistRegion, SinkRegion and PromoteAliasSet (renamed to promoteLoopAccessesToScalars) as utility functions in LoopUtils. This will enable other transformations to make use of them directly. Patch by Ashutosh Nema. llvm-svn: 230178
* RewriteStatepointsForGC.cpp: Fix for -Asserts to mark isNullConstant() as ↵NAKAMURA Takumi2015-02-221-1/+1
| | | | | | LLVM_ATTRIBUTE_UNUSED. [-Wunused-function] llvm-svn: 230169
* RewriteStatepointsForGC.cpp: Fix for -Asserts. [-Wunused-variable]NAKAMURA Takumi2015-02-221-2/+1
| | | | llvm-svn: 230168
* LowerBitSets.cpp: Prune incorrect \param(s). [-Wdocumentation]NAKAMURA Takumi2015-02-221-6/+6
| | | | | | \param should be used as itemized. llvm-svn: 230167
* IRCE: generalize InductiveRangeCheck::computeSafeIterationSpace toSanjoy Das2015-02-211-32/+57
| | | | | | | | | | work with a non-canonical induction variable. This is currently a non-functional change because we only ever call computeSafeIterationSpace on a canonical induction variable; but the generalization will be useful in a later commit. llvm-svn: 230151
* IRCE: use SCEVs instead of llvm::Value's for intermediateSanjoy Das2015-02-211-46/+30
| | | | | | | | | calculations. Semantically non-functional change. This gets rid of some of the SCEV -> Value -> SCEV round tripping and the Construct(SMin|SMax)Of and MaybeSimplify helper routines. llvm-svn: 230150
* [PlaceSafepoints] Adjust enablement logic to default to off and be GC ↵Philip Reames2015-02-211-11/+26
| | | | | | | | configurable per GC Previously, this pass ran over every function in the Module if added to the pass order. With this change, it runs only over those with a GC attribute where the GC explicitly opts in. A GC can also choose which of entry safepoint polls, backedge safepoint polls, and call safepoints it wants. I hope to get these exposed as checks on the GCStrategy at some point, but for now, the checks are manual string comparisons. llvm-svn: 230097
* Remove some unnecessary unreachables in favor of (sometimes implicit) assertionsDavid Blaikie2015-02-201-53/+34
| | | | | | | Also simplify some else-after-return cases including some standard algorithm convenience/use. llvm-svn: 230094
* Hide a bunch of advanced testing options in default opt --help outputPhilip Reames2015-02-201-7/+9
| | | | | | These are internal options. I need to go through, evaluate which are worth keeping and which not. Many of them should probably be renamed as well. Until I have time to do that, we can at least stop poluting the standard opt -help output. llvm-svn: 230088
* [RewriteStatepointsForGC] Use DenseSet in place of std::set [NFC]Philip Reames2015-02-201-8/+8
| | | | | | This should be the last cleanup on non-llvm preferred data structures. I left one use of std::set in an assertion; DenseSet didn't seem to have a tombstone for CallSite defined. That might be worth fixing, but wasn't worth it for a debug only use. llvm-svn: 230084
* [RewriteStatepointsForGC] Replace std::map with DenseMapPhilip Reames2015-02-201-2/+2
| | | | | | I'd done the work of extracting the typedef in a previous commit, but didn't actually change it. Hopefully this will make any subtle changes easier to isolate. llvm-svn: 230081
* [RewriteStatepointsForGC] Cleanup - replace std::vector usage [NFC]Philip Reames2015-02-201-40/+38
| | | | | | Migrate std::vector usage to a combination of SmallVector and ArrayRef. llvm-svn: 230079
* [RewriteStatepointsForGC] More style cleanup [NFC]Philip Reames2015-02-201-15/+14
| | | | | | Use llvm_unreachable where appropriate, use SmallVector where easy to do so, introduce typedefs for planned type migrations. llvm-svn: 230068
* [RewriteStatepointsForGC] Remove notion of SafepointBounds [NFC]Philip Reames2015-02-201-49/+11
| | | | | | The notion of a range of inserted safepoint related code is no longer really applicable. This survived over from an earlier implementation. Just saving the inserted gc.statepoint and working from that is far clearer given the current code structure. Particularly when invokable statepoints get involved. llvm-svn: 230063
* LoopRotate: When reconstructing loop simplify form don't split edges from ↵Benjamin Kramer2015-02-201-0/+2
| | | | | | | | | | | | indirectbrs. Yet another chapter in the endless story. While this looks like we leave the loop in a non-canonical state this replicates the logic in LoopSimplify so it doesn't diverge from the canonical form in any way. PR21968 llvm-svn: 230058
* Introduce bitset metadata format and bitset lowering pass.Peter Collingbourne2015-02-204-0/+531
| | | | | | | | | | | | | | | | | | | | This patch introduces a new mechanism that allows IR modules to co-operatively build pointer sets corresponding to addresses within a given set of globals. One particular use case for this is to allow a C++ program to efficiently verify (at each call site) that a vtable pointer is in the set of valid vtable pointers for the class or its derived classes. One way of doing this is for a toolchain component to build, for each class, a bit set that maps to the memory region allocated for the vtables, such that each 1 bit in the bit set maps to a valid vtable for that class, and lay out the vtables next to each other, to minimize the total size of the bit sets. The patch introduces a metadata format for representing pointer sets, an '@llvm.bitset.test' intrinsic and an LTO lowering pass that lays out the globals and builds the bitsets, and documents the new feature. Differential Revision: http://reviews.llvm.org/D7288 llvm-svn: 230054
* [GC, RewriteStatepointsForGC] Style cleanup and bug fixPhilip Reames2015-02-201-9/+29
| | | | | | | | When doing style cleanup, I noticed a minor bug in this code. If we have a pointer that we think is unused after a statepoint and thus doesn't need relocation, we store a null pointer into the alloca we're about to promote. This helps turn a mistake in liveness analysis into an easily debuggable crash. It turned out this code had never been updated to handle invoke statepoints. There's no test for this. Without a bug in liveness, it appears impossible to make this trigger in a way which is visible in the resulting IR. We might store the null, but when promoting the alloca, there will be no uses and thus nothing to test against. Suggestions on how to test are very welcome. llvm-svn: 230047
* Use unreachable instead of assert(false) to silence MSVC warningReid Kleckner2015-02-201-1/+1
| | | | llvm-svn: 230045
* [GC] Style cleanup for RewriteStatepointForGC (1 of many) [NFC]Philip Reames2015-02-201-62/+55
| | | | | | Starting to update variable naming and types to match LLVM style. This will be an incremental process to minimize the chance of breakage as I work. Step one, rename member variables to LLVM CamelCase and use llvm's ADT. Much more to come. llvm-svn: 230042
* Bugfix for 229954Philip Reames2015-02-201-2/+5
| | | | | | Before calling Function::getGC to test for enablement, we need to make sure there's actually a GC at all via Function::hasGC. Otherwise, we'd crash on functions without a GC. Thankfully, this only mattered if you manually scheduled the pass, but still, oops. :( llvm-svn: 230040
* RewriteStatepointsForGC: Move details into anonymous namespaces. NFC.Benjamin Kramer2015-02-201-10/+12
| | | | | | While there reduce the number of duplicated std::map lookups. llvm-svn: 230012
* Wrap recursive function only used in assert in #ifndef NDEBUG.Benjamin Kramer2015-02-201-1/+5
| | | | | | Avoids unused function warnings in Release builds. llvm-svn: 230009
* Fix build in release mode, four cases of -Wunused-variable.Nick Lewycky2015-02-201-0/+5
| | | | llvm-svn: 229976
* [InstCombine] Remove unnecessary variable indexing into single-element arraysHal Finkel2015-02-201-0/+187
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This change addresses a deficiency pointed out in PR22629. To copy from the bug report: [from the bug report] Consider this code: int f(int x) { int a[] = {12}; return a[x]; } GCC knows to optimize this to movl $12, %eax ret The code generated by recent Clang at -O3 is: movslq %edi, %rax movl .L_ZZ1fiE1a(,%rax,4), %eax retq .L_ZZ1fiE1a: .long 12 # 0xc [end from the bug report] This definitely seems worth fixing. I've also seen this kind of code before (as the base case of generic vector wrapper templates with one element). The general idea is to look at the GEP feeding a load or a store, which has some variable as its first non-zero index, and determine if that index must be zero (or else an out-of-bounds access would occur). We can do this for allocas and globals with constant initializers where we know the maximum size of the underlying object. When we find such a GEP, we create a new one for the memory access with that first variable index replaced with a constant zero. Even if we can't eliminate the memory access (and sometimes we can't), it is still useful because it removes unnecessary indexing calculations. llvm-svn: 229959
* Adjust enablement of RewriteStatepointsForGCPhilip Reames2015-02-201-1/+2
| | | | | | | | When back merging the changes in 229945 I noticed that I forgot to mark the test cases with the appropriate GC. We want the rewriting to be off by default (even when manually added to the pass order), not on-by default. To keep the current test working, mark them as using the statepoint-example GC and whitelist that GC. Longer term, we need a better selection mechanism here for both actual usage and testing. As I migrate more tests to the in tree version of this pass, I will probably need to update the enable/disable logic as well. llvm-svn: 229954
* Add a pass for constructing gc.statepoint sequences w/explicit relocationsPhilip Reames2015-02-203-0/+1933
| | | | | | | | | | | | | This patch consists of a single pass whose only purpose is to visit previous inserted gc.statepoints which do not have gc.relocates inserted yet, and insert them. This can be used either immediately after IR generation to perform 'early safepoint insertion' or late in the pass order to perform 'late insertion'. This patch is setting the stage for work to continue in tree. In particular, there are known naming and style violations in the current patch. I'll try to get those resolved over the next week or so. As I touch each area to make style changes, I need to make sure we have adequate testing in place. As part of the cleanup, I will be cleaning up a collection of test cases we have out of tree and submitting them upstream. The tests included in this change are very basic and mostly to provide examples of usage. The pass has several main subproblems it needs to address: - First, it has identify any live pointers. In the current code, the use of address spaces to distinguish pointers to GC managed objects is hard coded, but this will become parametrizable in the near future. Note that the current change doesn't actually contain a useful liveness analysis. It was seperated into a followup change as the code wasn't ready to be shared. Instead, the current implementation just considers any dominating def of appropriate pointer type to be live. - Second, it has to identify base pointers for each live pointer. This is a fairly straight forward data flow algorithm. - Third, the information in the previous steps is used to actually introduce rewrites. Rather than trying to do this by hand, we simply re-purpose the code behind Mem2Reg to do this for us. llvm-svn: 229945
* [sanitizer] when dumping the basic block trace, also dump the module names. ↵Kostya Serebryany2015-02-201-3/+12
| | | | | | Patch by Laszlo Szekeres llvm-svn: 229940
* [objc-arc-contract] We can not move retains over instructions which can not ↵Michael Gottesman2015-02-202-39/+152
| | | | | | | | | | conservatively be proven to not decrement the retain's RCIdentity. I also cleaned up the code to make it more understandable for mere mortals. <rdar://problem/19853758> llvm-svn: 229937
* [objc-arc] Add the predicate CanDecrementRefCount.Michael Gottesman2015-02-204-2/+61
| | | | | | | | | This is different from CanAlterRefCount since CanDecrementRefCount is attempting to prove specifically whether or not an instruction can decrement instead of the more general question of whether it can decrement or increment. llvm-svn: 229936
* SSAUpdater: Use range-based for. NFC.Benjamin Kramer2015-02-191-24/+17
| | | | llvm-svn: 229908
* [objc-arc] Convert the bodies of ARCInstKind predicates into covered switches.Michael Gottesman2015-02-192-58/+323
| | | | | | | | | | | | | | | This is much better than the previous manner of just using short-curcuiting booleans from: 1. A "naive" efficiency perspective: we do not have to rely on the compiler to change the short circuiting boolean operations into a switch. 2. An understanding perspective by making the implicit behavior of negative predicates explicit. 3. A maintainability perspective through the covered switch flag making it easy to know where to update code when adding new ARCInstKinds. llvm-svn: 229906
* [objc-arc] Change the InstructionClass to be an enum class called ARCInstKind.Michael Gottesman2015-02-1912-588/+648
| | | | | | | I also renamed ObjCARCUtil.cpp -> ARCInstKind.cpp. That file only contained items related to ARCInstKind anyways. llvm-svn: 229905
* [LoopAccesses] Change LAA:getInfo to return a constant referenceAdam Nemet2015-02-191-3/+3
| | | | | | | | As expected, this required a few more const-correctness fixes. Based on Hal's feedback on D7684. llvm-svn: 229899
* [LoopAccesses] Split out LoopAccessReport from VectorizerReportAdam Nemet2015-02-191-7/+26
| | | | | | | | | | | | The only difference between these two is that VectorizerReport adds a vectorizer-specific prefix to its messages. When LAA is used in the vectorizer context the prefix is added when we promote the LoopAccessReport into a VectorizerReport via one of the constructors. This is part of the patchset that converts LoopAccessAnalysis into an actual analysis pass. llvm-svn: 229897
* [LoopAccesses] Add missing const to APIs in VectorizationReportAdam Nemet2015-02-191-2/+2
| | | | | | | | | | When I split out LoopAccessReport from this, I need to create some temps so constness becomes necessary. This is part of the patchset that converts LoopAccessAnalysis into an actual analysis pass. llvm-svn: 229896
OpenPOWER on IntegriCloud