summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms
Commit message (Collapse)AuthorAgeFilesLines
* [SimplifyCFG] delay switch condition forwarding to -latesimplifycfgSanjay Patel2017-10-222-7/+13
| | | | | | | | | | | As discussed in D39011: https://reviews.llvm.org/D39011 ...replacing constants with a variable is inverting the transform done by other IR passes, so we definitely don't want to do this early. In fact, it's questionable whether this transform belongs in SimplifyCFG at all. I'll look at moving this to codegen as a follow-up step. llvm-svn: 316298
* [SimplifyCFG] try harder to forward switch condition to phi (PR34471)Sanjay Patel2017-10-221-2/+32
| | | | | | | | | | | | | | | | | | | | | | | | | | | | The missed canonicalization/optimization in the motivating test from PR34471 leads to very different codegen: int switcher(int x) { switch(x) { case 17: return 17; case 19: return 19; case 42: return 42; default: break; } return 0; } int comparator(int x) { if (x == 17) return 17; if (x == 19) return 19; if (x == 42) return 42; return 0; } For the first example, we use a bit-test optimization to avoid a series of compare-and-branch: https://godbolt.org/g/BivDsw Differential Revision: https://reviews.llvm.org/D39011 llvm-svn: 316293
* [LoopInterchange] Fix phi node ordering miscompile.David Green2017-10-211-1/+6
| | | | | | | | | | | The way that splitInnerLoopHeader splits blocks requires that the induction PHI will be the first PHI in the inner loop header. This makes sure that is actually the case when there are both IV and reduction phis. Differential Revision: https://reviews.llvm.org/D38682 llvm-svn: 316261
* [Transforms] Fix some Clang-tidy modernize and Include What You Use ↵Eugene Zelenko2017-10-215-170/+297
| | | | | | warnings; other minor fixes (NFC). llvm-svn: 316253
* [Transforms] Fix some Clang-tidy modernize and Include What You Use ↵Eugene Zelenko2017-10-204-141/+289
| | | | | | warnings; other minor fixes (NFC). llvm-svn: 316241
* [Transforms] Fix some Clang-tidy modernize and Include What You Use ↵Eugene Zelenko2017-10-193-302/+449
| | | | | | warnings; other minor fixes (NFC). llvm-svn: 316190
* [Transforms] Fix some Clang-tidy modernize and Include What You Use ↵Eugene Zelenko2017-10-196-114/+317
| | | | | | warnings; other minor fixes (NFC). llvm-svn: 316187
* Fix MSVC signed/unsigned comparison warningSimon Pilgrim2017-10-191-1/+1
| | | | llvm-svn: 316161
* [NFC][IRCE] Filter out empty ranges earlyMax Kazantsev2017-10-191-4/+6
| | | | llvm-svn: 316146
* [MergeFunctions] Don't blindly RAUW a GlobalValue with a ConstantExpr.whitequark2017-10-191-0/+3
| | | | | | | | | | | | | | | | MergeFunctions uses (through FunctionComparator) a map of GlobalValues to identifiers because it needs to compare functions and globals do not have an inherent total order. Thus, FunctionComparator (through GlobalNumberState) has a ValueMap<GlobalValue *>. r315852 added a RAUW on globals that may have been previously encountered by the FunctionComparator, which would replace a GlobalValue * key with a ConstantExpr *, which is illegal. This commit adjusts that code path to remove the function being replaced from the ValueMap as well. llvm-svn: 316145
* [PM] Refactor the bounds checking pass to remove a method only called inChandler Carruth2017-10-181-28/+25
| | | | | | one place. llvm-svn: 316135
* Revert "[ScalarEvolution] Handling for ICmp occuring in the evolution chain."Sanjoy Das2017-10-181-5/+2
| | | | | | | This reverts commit r316054. There was some confusion over the review process: http://lists.llvm.org/pipermail/llvm-commits/Week-of-Mon-20171016/495884.html llvm-svn: 316129
* [Transforms] Fix some Clang-tidy modernize and Include What You Use ↵Eugene Zelenko2017-10-185-144/+236
| | | | | | warnings; other minor fixes (NFC). llvm-svn: 316128
* [ScalarEvolution] Handling for ICmp occuring in the evolution chain.Jatin Bhateja2017-10-181-2/+5
| | | | | | | | | | | | | | | | | | | | | | Summary: If a compare instruction is same or inverse of the compare in the branch of the loop latch, then return a constant evolution node. Currently scope of evaluation is limited to SCEV computation for PHI nodes. This shall facilitate computations of loop exit counts in cases where compare appears in the evolution chain of induction variables. Will fix PR 34538 Reviewers: sanjoy, hfinkel, junryoungju Reviewed By: junryoungju Subscribers: javed.absar, llvm-commits Differential Revision: https://reviews.llvm.org/D38494 llvm-svn: 316054
* [GlobalDCE] Use DenseMap instead of unordered_multimap for GVDependencies.Michael Zolotukhin2017-10-171-3/+3
| | | | | | | | | | | | | | | Summary: std::unordered_multimap happens to be very slow when the number of elements grows large. On one of our internal applications we observed a 17x compile time improvement from changing it to DenseMap. Reviewers: mehdi_amini, serge-sans-paille, davide Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D38916 llvm-svn: 316045
* [Transforms] Fix some Clang-tidy modernize and Include What You Use ↵Eugene Zelenko2017-10-179-157/+329
| | | | | | warnings; other minor fixes (NFC). llvm-svn: 316034
* Fix signed overflow detected by ubsanVitaly Buka2017-10-171-1/+1
| | | | | | This overflow does not affect algorithm, so just suppress it. llvm-svn: 316018
* Revert 315440 on behalf of mkazantsevPhilip Reames2017-10-171-77/+0
| | | | | | | | | | | This patch reverts rL315440 because of the bug described at https://bugs.llvm.org/show_bug.cgi?id=34937 The fix for the bug is on review as D38944, but not yet ready. Given this is a regression reverting until a fix is ready is called for. Max would have done the revert himself, but is having trouble doing a build of fresh LLVM for some reason. I did the build and test to ensure the revert worked as expected on his behalf. llvm-svn: 315974
* [JumpThreading] Move two PredValueInfoTy vectors to a scope closer to their ↵Craig Topper2017-10-161-2/+2
| | | | | | usage. NFCI llvm-svn: 315941
* [Transforms] Fix some Clang-tidy modernize and Include What You Use ↵Eugene Zelenko2017-10-166-139/+282
| | | | | | warnings; other minor fixes (NFC). llvm-svn: 315940
* [ObjCARC] Do not move a release that has the clang.imprecise_release tagAkira Hatanaka2017-10-161-3/+8
| | | | | | | | | | | | | | above PHI instructions. ARC optimizer has an optimization that moves a call to an ObjC runtime function above a phi instruction when the phi has a null operand and is an argument passed to the function call. This optimization should not kick in when the runtime function is an objc_release that releases an object with precise lifetime semantics. rdar://problem/34959669 llvm-svn: 315914
* [InstCombine] don't unnecessarily generate a constant; NFCISanjay Patel2017-10-161-3/+2
| | | | llvm-svn: 315910
* Revert rL315894, "SLPVectorizer.cpp: Try to appease stage2-3 difference. ↵NAKAMURA Takumi2017-10-161-9/+23
| | | | | | (D38586)" llvm-svn: 315896
* Move folding of icmp with zero after checking for min/max idioms.Nikolai Bozhenov2017-10-162-11/+23
| | | | | | | | | | | | | | | | | | | | | Summary: The following transformation for cmp instruction: icmp smin(x, PositiveValue), 0 -> icmp x, 0 should only be done after checking for min/max to prevent infinite looping caused by a reverse canonicalization. That is why this transformation was moved to place after the mentioned check. Reviewers: spatel, efriedma Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D38934 Patch by: Artur Gainullin <artur.gainullin@intel.com> llvm-svn: 315895
* SLPVectorizer.cpp: Try to appease stage2-3 difference. (D38586)NAKAMURA Takumi2017-10-161-23/+9
| | | | llvm-svn: 315894
* revert r314984: revert r314698 - [InstCombine] remove one-use restriction ↵Sanjay Patel2017-10-151-6/+6
| | | | | | | | | for icmp (shr exact X, C1), C2 --> icmp X, (C2<<C1) Recommitting r314698. The bug exposed by this change should be fixed with: https://reviews.llvm.org/rL315579 llvm-svn: 315857
* [SimplifyCFG] use range-for-loops, tidy; NFCISanjay Patel2017-10-151-20/+10
| | | | | | | There seems to be something missing here as shown in PR34471: https://bugs.llvm.org/show_bug.cgi?id=34471 llvm-svn: 315855
* Reverting r315590; it did not include changes for llvm-tblgen, which is ↵Aaron Ballman2017-10-154-14/+14
| | | | | | | | causing link errors for several people. Error LNK2019 unresolved external symbol "public: void __cdecl `anonymous namespace'::MatchableInfo::dump(void)const " (?dump@MatchableInfo@?A0xf4f1c304@@QEBAXXZ) referenced in function "public: void __cdecl `anonymous namespace'::AsmMatcherEmitter::run(class llvm::raw_ostream &)" (?run@AsmMatcherEmitter@?A0xf4f1c304@@QEAAXAEAVraw_ostream@llvm@@@Z) llvm-tblgen D:\llvm\2017\utils\TableGen\AsmMatcherEmitter.obj 1 llvm-svn: 315854
* [MergeFunctions] Merge small functions if possible without a thunk.whitequark2017-10-151-12/+10
| | | | | | | | | | This can result in significant code size savings in some cases, e.g. an interrupt table all filled with the same assembly stub in a certain Cortex-M BSP results in code blowup by a factor of 2.5. Differential Revision: https://reviews.llvm.org/D34806 llvm-svn: 315853
* [MergeFunctions] Replace all uses of unnamed_addr functions.whitequark2017-10-151-3/+9
| | | | | | | | | This reduces code size for constructs like vtables or interrupt tables that refer to functions in global initializers. Differential Revision: https://reviews.llvm.org/D34805 llvm-svn: 315852
* [LoopInfo][Refactor] Make SetLoopAlreadyUnrolled a member function of the ↵Hongbin Zheng2017-10-152-67/+2
| | | | | | | | | | Loop Pass, NFC. This avoid code duplication and allow us to add the disable unroll metadata elsewhere. Differential Revision: https://reviews.llvm.org/D38928 llvm-svn: 315850
* [InstCombine] use m_Neg() to reduce code; NFCISanjay Patel2017-10-131-13/+9
| | | | llvm-svn: 315762
* [Transforms] Fix some Clang-tidy modernize and Include What You Use ↵Eugene Zelenko2017-10-136-132/+320
| | | | | | warnings; other minor fixes (NFC). llvm-svn: 315760
* LowerTypeTests: Give imported symbols a type with size 0 so that they are ↵Peter Collingbourne2017-10-131-2/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | not assumed not to alias. It is possible for both a base and a derived class to be satisfied with a unique vtable. If a program contains casts of the same pointer to both of those types, the CFI checks will be lowered to this (with ThinLTO): if (p != &__typeid_base_global_addr) trap(); if (p != &__typeid_derived_global_addr) trap(); The optimizer may then use the first condition combined with the assumption that __typeid_base_global_addr and __typeid_derived_global_addr may not alias to optimize away the second comparison, resulting in an unconditional trap. This patch fixes the bug by giving imported globals the type [0 x i8]*, which prevents the optimizer from assuming that they do not alias. Differential Revision: https://reviews.llvm.org/D38873 llvm-svn: 315753
* [InstCombine] move code to remove repeated constant check; NFCISanjay Patel2017-10-131-8/+7
| | | | | | Also, consolidate tests for this fold in one place. llvm-svn: 315745
* [InstCombine] recycle adds for better efficiencySanjay Patel2017-10-131-26/+21
| | | | | | Also, clean up unnecessary matcher capture variable initializations. llvm-svn: 315743
* [InstCombine] use local var to reduce code duplication; NFCISanjay Patel2017-10-131-16/+15
| | | | llvm-svn: 315728
* [IPSCCP] Move common functions to ValueLatticeUtils (NFC)Matthew Simpson2017-10-131-62/+27
| | | | | | | | | | | This patch moves some common utility functions out of IPSCCP and makes them available globally. The functions determine if interprocedural data-flow analyses can propagate information through function returns, arguments, and global variables. Differential Revision: https://reviews.llvm.org/D37638 llvm-svn: 315719
* [InstCombine] add hasOneUse check to add-zext-add fold to prevent increasing ↵Sanjay Patel2017-10-131-4/+2
| | | | | | instructions llvm-svn: 315718
* [InstCombine] use AddOne helper to reduce code; NFCSanjay Patel2017-10-131-6/+3
| | | | llvm-svn: 315709
* [InstCombine] rearrange code to remove repeated constant check; NFCISanjay Patel2017-10-132-7/+7
| | | | llvm-svn: 315703
* [InstCombine] allow zext(bool) + C --> select bool, C+1, C for vector typesSanjay Patel2017-10-131-10/+15
| | | | | | | The backend should be prepared for this transform after: https://reviews.llvm.org/rL311731 llvm-svn: 315701
* [RS4GC] Look through vector bitcasts when looking for base pointerDaniel Neilson2017-10-131-0/+5
| | | | | | | | | | | | | | | | | | Summary: In RS4GC it is possible that a base pointer is contained in a vector that has undergone a bitcast from one element-pointertype to another. We teach RS4GC how to look through bitcasts of vector types when looking for a base pointer. Reviewers: anna Reviewed By: anna Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D38849 llvm-svn: 315694
* Revert r314923: "Recommit : Use the basic cost if a GEP is not used as ↵Daniel Jasper2017-10-132-2/+2
| | | | | | | | | | | | | addressing mode" Significantly reduces performancei (~30%) of gipfeli (https://github.com/google/gipfeli) I have not yet managed to reproduce this regression with the open-source version of the benchmark on github, but will work with others to get a reproducer to you later today. llvm-svn: 315680
* Disable gcov instrumentation of functions using funclet-based exception handlingMarco Castelluccio2017-10-131-0/+13
| | | | | | | | | | | | | | Summary: This patch fixes the crash from https://bugs.llvm.org/show_bug.cgi?id=34659 and https://bugs.llvm.org/show_bug.cgi?id=34833. Reviewers: rnk, majnemer Reviewed By: rnk, majnemer Subscribers: majnemer, llvm-commits Differential Revision: https://reviews.llvm.org/D38223 llvm-svn: 315677
* [Transforms] Fix some Clang-tidy modernize and Include What You Use ↵Eugene Zelenko2017-10-121-163/+236
| | | | | | warnings; other minor fixes (NFC). llvm-svn: 315640
* [CVP] Process binary operations even when def is localAnna Thomas2017-10-121-16/+4
| | | | | | | | | | | | | | | | | | | | | | | | | Summary: This patch adds processing of binary operations when the def of operands are in the same block (i.e. local processing). Earlier we bailed out in such cases (the bail out was introduced in rL252032) because LVI at that time was more precise about context at the end of basic blocks, which implied local def and use analysis didn't benefit CVP. Since then we've added support for LVI in presence of assumes and guards. The test cases added show how local def processing in CVP helps adding more information to the ashr, sdiv, srem and add operators. Note: processCmp which suffers from the same problem will be handled in a later patch. Reviewers: philip, apilipenko, SjoerdMeijer, hfinkel Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D38766 llvm-svn: 315634
* [LoopPredication] Check whether the loop is already guarded by the first ↵Artur Pilipenko2017-10-121-2/+6
| | | | | | iteration check condition llvm-svn: 315623
* Revert "Reintroduce "[SCCP] Propagate integer range info for parameters in ↵Bruno Cardoso Lopes2017-10-121-92/+8
| | | | | | | | | | | IPSCCP."" This reverts commit r315593: still affect two bots: http://lab.llvm.org:8011/builders/clang-with-lto-ubuntu/builds/5308 http://green.lab.llvm.org/green/job/clang-stage2-configure-Rlto/21751/ llvm-svn: 315618
* [LoopPredication] Support ule, sle latch predicatesArtur Pilipenko2017-10-121-20/+35
| | | | | | | | | | This is a follow up for the loop predication change 313981 to support ule, sle latch predicates. Reviewed By: mkazantsev Differential Revision: https://reviews.llvm.org/D38177 llvm-svn: 315616
OpenPOWER on IntegriCloud