summaryrefslogtreecommitdiff
path: root/lib/Transforms
Commit message (Collapse)AuthorAge
* Scan the successor blocks and use the PHI nodes as a hint for possible chain ↵Nadav Rotem2013-06-18
| | | | | | roots. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@184201 91177308-0d34-0410-b5e6-96231b3b80d8
* Add a return value to make this function more useful.Nadav Rotem2013-06-18
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@184200 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix nondeterminism in .gcno file generation.Nick Lewycky2013-06-18
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@184174 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix for a regression caused by the LoopVectorizer whenPekka Jaaskelainen2013-06-17
| | | | | | | | | vectorizing loops with memory accesses to non-zero address spaces. It simply dropped the AS info. Fixes PR16306. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@184103 91177308-0d34-0410-b5e6-96231b3b80d8
* Disable vectorization for -Oz.Nadav Rotem2013-06-17
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@184089 91177308-0d34-0410-b5e6-96231b3b80d8
* Enable the loop vectorizer by default for -Os and -O2.Nadav Rotem2013-06-17
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@184084 91177308-0d34-0410-b5e6-96231b3b80d8
* Use 0 instead of NULL.Jakub Staszak2013-06-15
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@184044 91177308-0d34-0410-b5e6-96231b3b80d8
* PruneEH: Only merge attribute sets when used. No functionality change.Benjamin Kramer2013-06-15
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@184041 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix DeleteDeadVarargs not to crash on functions referenced by BlockAddressesDerek Schuff2013-06-13
| | | | | | | | | | | | | | | This pass was assuming that if hasAddressTaken() returns false for a function, the function's only uses are call sites. That's not true because there can be references by BlockAddresses too. Fix the pass to handle this case. Fix BlockAddress::replaceUsesOfWithOnConstant() to allow a function's type to be changed by RAUW'ing the function with a bitcast of the recreated function. Patch by Mark Seaborn. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@183933 91177308-0d34-0410-b5e6-96231b3b80d8
* Always remove an alias when we rename the target.Rafael Espindola2013-06-12
| | | | | | Should fix the dragonegg build bots. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@183845 91177308-0d34-0410-b5e6-96231b3b80d8
* Move PathV2.h to Path.hRafael Espindola2013-06-11
| | | | | | | Most clients have already been moved from Path V1 to V2. The ones using V1 now include PathV1.h explicitly. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@183801 91177308-0d34-0410-b5e6-96231b3b80d8
* Change how globalopt handles aliases in llvm.used.Rafael Espindola2013-06-11
| | | | | | | | | | | | | | | | | | | | | | | | Instead of a custom implementation of replaceAllUsesWith, we just call replaceAllUsesWith and recreate llvm.used and llvm.compiler-used. This change is particularity interesting because it makes llvm see through what clang is doing with static used functions in extern "C" contexts. With this change, running clang -O2 in extern "C" { __attribute__((used)) static void foo() {} } produces @llvm.used = appending global [1 x i8*] [i8* bitcast (void ()* @foo to i8*)], section "llvm.metadata" define internal void @foo() #0 { entry: ret void } git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@183756 91177308-0d34-0410-b5e6-96231b3b80d8
* Make DeadArgumentElimination more conservative on variadic functionsTim Northover2013-06-09
| | | | | | | Variadic functions are particularly fragile in the face of ABI changes, so this limits how much the pass changes them git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@183625 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix a potential bug in r183584.Shuxin Yang2013-06-08
| | | | | | | | | | | | | | r183584 tries to derive some info from the code *AFTER* a call and apply these derived info to the code *BEFORE* the call, which is not always safe as the call in question may never return, and in this case, the derived info is invalid. Thank Duncan for pointing out this potential bug. rdar://14073661 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@183606 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix an assertion in MemCpyOpt pass.Shuxin Yang2013-06-07
| | | | | | | | | | | | | | | | | | | | | | The MemCpyOpt pass is capable of optimizing: callee(&S); copy N bytes from S to D. into: callee(&D); subject to some legality constraints. Assertion is triggered when the compiler tries to evalute "sizeof(typeof(D))", while D is an opaque-typed, 'sret' formal argument of function being compiled. i.e. the signature of the func being compiled is something like this: T caller(...,%opaque* noalias nocapture sret %D, ...) The fix is that when come across such situation, instead of calling some utility functions to get the size of D's type (which will crash), we simply assume D has at least N bytes as implified by the copy-instruction. rdar://14073661 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@183584 91177308-0d34-0410-b5e6-96231b3b80d8
* [objc-arc] Ensure that the cfg path count does not overflow when we multiply ↵Michael Gottesman2013-06-07
| | | | | | | | TopDownPathCount/BottomUpPathCount. rdar://12480535 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@183489 91177308-0d34-0410-b5e6-96231b3b80d8
* Simplify code. No functionality change.Jakub Staszak2013-06-06
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@183461 91177308-0d34-0410-b5e6-96231b3b80d8
* Jeffrey Yasskin volunteered to benchmark the vectorizer on -O2 or -Os when ↵Nadav Rotem2013-06-06
| | | | | | compiling chrome. This patch adds a new flag to enable vectorization on all levels and not only on -O3. It should go away once we make a decision. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@183456 91177308-0d34-0410-b5e6-96231b3b80d8
* Re-apply "Use IRBuilder instead of ConstantInt methods." with the fixed issues.Jakub Staszak2013-06-06
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@183439 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert "Use IRBuilder instead of ConstantInt methods. It simplifies code a ↵Rafael Espindola2013-06-06
| | | | | | | | little bit." This reverts commit 183328. It caused pr16244 and broke the bots. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@183422 91177308-0d34-0410-b5e6-96231b3b80d8
* Remove unneeded cast<>.Jakub Staszak2013-06-06
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@183363 91177308-0d34-0410-b5e6-96231b3b80d8
* Use IRBuilder instead of ConstantInt methods.Jakub Staszak2013-06-06
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@183360 91177308-0d34-0410-b5e6-96231b3b80d8
* Use IRBuilder instead of ConstantInt methods. It simplifies code a little bit.Jakub Staszak2013-06-05
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@183328 91177308-0d34-0410-b5e6-96231b3b80d8
* IndVarSimplify: check if loop invariant expansion can trapDavid Majnemer2013-06-04
| | | | | | | | | | | | | | | | IndVarSimplify is willing to move divide instructions outside of their loop bodies if they are invariant of the loop. However, it may not be safe to expand them if we do not know if they can trap. Instead, check to see if it is not safe to expand the instruction and skip the expansion. This fixes PR16041. Testcase by Rafael Ávila de Espíndola. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@183239 91177308-0d34-0410-b5e6-96231b3b80d8
* Second part of pr16069Rafael Espindola2013-06-04
| | | | | | | | | | | | | | | | | The problem this time seems to be a thinko. We were assuming that in the CFG A | \ | B | / C speculating the basic block B would cause only the phi value for the B->C edge to be speculated. That is not true, the phi's are semantically in the edges, so if the A->B->C path is taken, any code needed for A->C is not executed and we have to consider it too when deciding to speculate B. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@183226 91177308-0d34-0410-b5e6-96231b3b80d8
* Typo: s/caes/cases/ in SimplifyCFGHans Wennborg2013-06-04
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@183219 91177308-0d34-0410-b5e6-96231b3b80d8
* Delete dead safety check.Nick Lewycky2013-06-03
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@183167 91177308-0d34-0410-b5e6-96231b3b80d8
* SimplifyCFG: Do not transform PHI to select if doing so would be unsafeDavid Majnemer2013-06-03
| | | | | | | | | | | | | | PR16069 is an interesting case where an incoming value to a PHI is a trap value while also being a 'ConstantExpr'. We do not consider this case when performing the 'HoistThenElseCodeToIf' optimization. Instead, make our modifications more conservative if we detect that we cannot transform the PHI to a select. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@183152 91177308-0d34-0410-b5e6-96231b3b80d8
* SimplifyCFG: Small cleanup, use ICmpInst::isEquality()David Majnemer2013-06-03
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@183151 91177308-0d34-0410-b5e6-96231b3b80d8
* [asan] ASan Linux MIPS32 support (llvm part), patch by Jyun-Yan YKostya Serebryany2013-06-03
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@183104 91177308-0d34-0410-b5e6-96231b3b80d8
* When determining the new index for an insertelement, we may not assume that anNick Lewycky2013-06-01
| | | | | | | | | | | index greater than the size of the vector is invalid. The shuffle may be shrinking the size of the vector. Fixes a crash! Also drop the maximum recursion depth of the safety check for this optimization to five. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@183080 91177308-0d34-0410-b5e6-96231b3b80d8
* SimplifyCFG: Fix typo in comment for ComputeSpeculationCostDavid Majnemer2013-06-01
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@183078 91177308-0d34-0410-b5e6-96231b3b80d8
* Move getRealLinkageName to a common place and remove all the duplicates of it.Benjamin Kramer2013-06-01
| | | | | | Also simplify code a bit while there. No functionality change. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@183076 91177308-0d34-0410-b5e6-96231b3b80d8
* LoopVectorize: Change API call to get the backedge taken countArnold Schwaighofer2013-05-31
| | | | | | | | | | Use ScalarEvolution's getBackedgeTakenCount API instead of getExitCount since that is really what we want to know. Using the more specific getExitCount was safe because we made sure that there is only one exiting block. No functionality change. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@183047 91177308-0d34-0410-b5e6-96231b3b80d8
* Loop Strength Reduce: Scaling factor cost.Quentin Colombet2013-05-31
| | | | | | | | | | | | | Account for the cost of scaling factor in Loop Strength Reduce when rating the formulae. This uses a target hook. The default implementation of the hook is: if the addressing mode is legal, the scaling factor is free. <rdar://problem/13806271> git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@183045 91177308-0d34-0410-b5e6-96231b3b80d8
* LoopVectorize: PHIs with only outside users should prevent vectorizationArnold Schwaighofer2013-05-31
| | | | | | | | | | We check that instructions in the loop don't have outside users (except if they are reduction values). Unfortunately, we skipped this check for if-convertable PHIs. Fixes PR16184. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@183035 91177308-0d34-0410-b5e6-96231b3b80d8
* Modify how the formulae are rated in Loop Strength Reduce.Quentin Colombet2013-05-31
| | | | | | | | | | | | | | | Namely, check if the target allows to fold more that one register in the addressing mode and if yes, adjust the cost accordingly. Prior to this commit, reg1 + scale * reg2 accesses were artificially preferred to reg1 + reg2 accesses. Indeed, the cost model wrongly assumed that reg1 + reg2 needs a temporary register for the computation, whereas it was correctly estimated for reg1 + scale * reg2. <rdar://problem/13973908> git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@183021 91177308-0d34-0410-b5e6-96231b3b80d8
* Simplify multiplications by vectors whose elements are powers of 2.Rafael Espindola2013-05-31
| | | | | | Patch by Andrea Di Biagio. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@183005 91177308-0d34-0410-b5e6-96231b3b80d8
* [msan] Handle mixed track-origins and keep-going settings (llvm part).Evgeniy Stepanov2013-05-31
| | | | | | | | | | | | | | | Before this change, each module defined a weak_odr global __msan_track_origins with a value of 1 if origin tracking is enabled, 0 if disabled. If there are modules with different values, any of them may win. If 0 wins, and there is at least one module with 1, the program will most likely crash. With this change, __msan_track_origins is only emitted if origin tracking is on. Then runtime library detects if there is at least one module with origin tracking, and enables runtime support for it. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@182997 91177308-0d34-0410-b5e6-96231b3b80d8
* Reapply with r182909 with a fix to the calculation of the new indices forNick Lewycky2013-05-31
| | | | | | | insertelement instructions. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@182976 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert r182909.Evgeniy Stepanov2013-05-30
| | | | | | | PR/16177 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@182919 91177308-0d34-0410-b5e6-96231b3b80d8
* Swizzle vector inputs if it helps us eliminate shuffles.Nick Lewycky2013-05-30
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@182909 91177308-0d34-0410-b5e6-96231b3b80d8
* LoopVectorize.cpp: Fix abuse of StringRef on Twine. Twine captures the ↵NAKAMURA Takumi2013-05-29
| | | | | | pointer of StringRef. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@182820 91177308-0d34-0410-b5e6-96231b3b80d8
* Whitespace.NAKAMURA Takumi2013-05-29
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@182819 91177308-0d34-0410-b5e6-96231b3b80d8
* Add support for llvm.vectorizer metadataPaul Redmond2013-05-28
| | | | | | | | | | | | | | | | | | | | - llvm.loop.parallel metadata has been renamed to llvm.loop to be more generic by making the root of additional loop metadata. - Loop::isAnnotatedParallel now looks for llvm.loop and associated llvm.mem.parallel_loop_access - document llvm.loop and update llvm.mem.parallel_loop_access - add support for llvm.vectorizer.width and llvm.vectorizer.unroll - document llvm.vectorizer.* metadata - add utility class LoopVectorizerHints for getting/setting loop metadata - use llvm.vectorizer.width=1 to indicate already vectorized instead of already_vectorized - update existing tests that used llvm.loop.parallel and llvm.vectorizer.already_vectorized Reviewed by: Nadav Rotem git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@182802 91177308-0d34-0410-b5e6-96231b3b80d8
* Extend RemapInstruction and friends to take an optional new parameter, a ↵James Molloy2013-05-28
| | | | | | | | ValueMaterializer. Extend LinkModules to pass a ValueMaterializer to RemapInstruction and friends to lazily create Functions for lazily linked globals. This is a big win when linking small modules with large (mostly unused) library modules. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@182776 91177308-0d34-0410-b5e6-96231b3b80d8
* [msan] Fix argument shadow alignment.Evgeniy Stepanov2013-05-28
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@182771 91177308-0d34-0410-b5e6-96231b3b80d8
* Replace Count{Leading,Trailing}Zeros_{32,64} with count{Leading,Trailing}Zeros.Michael J. Spencer2013-05-24
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@182680 91177308-0d34-0410-b5e6-96231b3b80d8
* [objc-arc] KnownSafe does not imply that it is safe to perform code motion ↵Michael Gottesman2013-05-24
| | | | | | | | across CFG edges since even if it is safe to remove RR pairs, we may still be able to move a retain/release into a loop. rdar://13949644 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@182670 91177308-0d34-0410-b5e6-96231b3b80d8
* [objc-arc] Make sure that multiple owners is propogated correctly through ↵Michael Gottesman2013-05-24
| | | | | | | | the pass via the usage of a global data structure. rdar://13750319 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@182669 91177308-0d34-0410-b5e6-96231b3b80d8