<div dir="ltr">Sorry for the trouble here. The visibility should have been removed from all of the types moved into public header files. I've removed it from the worklist in r227025.</div><div class="gmail_extra"><br><div class="gmail_quote">On Sat, Jan 24, 2015 at 1:31 PM, Aaron Ballman <span dir="ltr"><<a href="mailto:aaron@aaronballman.com" target="_blank">aaron@aaronballman.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">On Sat, Jan 24, 2015 at 3:50 PM, Patrik Hägglund H<br>
<<a href="mailto:patrik.h.hagglund@ericsson.com">patrik.h.hagglund@ericsson.com</a>> wrote:<br>
> I added LLVM_LIBRARY_VISIBILITY to InstCombinePass in r227013, but revert it due to <a href="http://lab.llvm.org:8011/builders/clang-hexagon-elf/builds/21749" target="_blank">http://lab.llvm.org:8011/builders/clang-hexagon-elf/builds/21749</a>. Benjamin pointed out the cause in another mail. Can any of you provide a more correct fix?<br>
<br>
</span>I think the correct fix may be to remove LLVM_LIBRARY_VISIBILITY from<br>
InstCombinWorklist, but I was waiting for Chandler's input since he<br>
understands the design here far better than I do.<br>
<span class="HOEnZb"><font color="#888888"><br>
~Aaron<br>
</font></span><div class="HOEnZb"><div class="h5"><br>
><br>
> /Patrik Hägglund<br>
><br>
> -----Original Message-----<br>
> From: <a href="mailto:llvm-commits-bounces@cs.uiuc.edu">llvm-commits-bounces@cs.uiuc.edu</a> [mailto:<a href="mailto:llvm-commits-bounces@cs.uiuc.edu">llvm-commits-bounces@cs.uiuc.edu</a>] On Behalf Of Aaron Ballman<br>
> Sent: den 24 januari 2015 18:08<br>
> To: Chandler Carruth<br>
> Cc: llvm-commits<br>
> Subject: Re: [llvm] r226987 - [PM] Port instcombine to the new pass manager!<br>
><br>
> This commit is causing some new warnings to be triggered:<br>
><br>
> /opt/llvm/build-llvm/llvm/include/llvm/Transforms/InstCombine/InstCombine.h:27:7:<br>
> warning: ‘llvm::InstCombinePass’ declared with greater visibility than<br>
> the type of its field ‘llvm::InstCombinePass::Worklist’ [-Wattributes]<br>
><br>
> I noticed that InstCombineWorklist has LLVM_LIBRARY_VISIBILITY but<br>
> InstCombinePass does not. Perhaps InstcombinePass should receive that<br>
> attribute as well?<br>
><br>
> ~Aaron<br>
><br>
> On Fri, Jan 23, 2015 at 11:19 PM, Chandler Carruth <<a href="mailto:chandlerc@gmail.com">chandlerc@gmail.com</a>> wrote:<br>
>> Author: chandlerc<br>
>> Date: Fri Jan 23 22:19:17 2015<br>
>> New Revision: 226987<br>
>><br>
>> URL: <a href="http://llvm.org/viewvc/llvm-project?rev=226987&view=rev" target="_blank">http://llvm.org/viewvc/llvm-project?rev=226987&view=rev</a><br>
>> Log:<br>
>> [PM] Port instcombine to the new pass manager!<br>
>><br>
>> This is exciting as this is a much more involved port. This is<br>
>> a complex, existing transformation pass. All of the core logic is shared<br>
>> between both old and new pass managers. Only the access to the analyses<br>
>> is separate because the actual techniques are separate. This also uses<br>
>> a bunch of different and interesting analyses and is the first time<br>
>> where we need to use an analysis across an IR layer.<br>
>><br>
>> This also paves the way to expose instcombine utility functions. I've<br>
>> got a static function that implements the core pass logic over<br>
>> a function which might be mildly interesting, but more interesting is<br>
>> likely exposing a routine which just uses instructions *already in* the<br>
>> worklist and combines until empty.<br>
>><br>
>> I've switched one of my favorite instcombine tests to run with both as<br>
>> well to make sure this keeps working.<br>
>><br>
>> Added:<br>
>> llvm/trunk/include/llvm/Transforms/InstCombine/<br>
>> llvm/trunk/include/llvm/Transforms/InstCombine/InstCombine.h<br>
>> llvm/trunk/include/llvm/Transforms/InstCombine/InstCombineWorklist.h<br>
>> - copied, changed from r226981, llvm/trunk/lib/Transforms/InstCombine/InstCombineWorklist.h<br>
>> Removed:<br>
>> llvm/trunk/lib/Transforms/InstCombine/InstCombineWorklist.h<br>
>> Modified:<br>
>> llvm/trunk/lib/Transforms/InstCombine/InstCombineInternal.h<br>
>> llvm/trunk/lib/Transforms/InstCombine/InstructionCombining.cpp<br>
>> llvm/trunk/test/Transforms/InstCombine/load.ll<br>
>> llvm/trunk/tools/opt/PassRegistry.def<br>
>> llvm/trunk/tools/opt/Passes.cpp<br>
>><br>
>> Added: llvm/trunk/include/llvm/Transforms/InstCombine/InstCombine.h<br>
>> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Transforms/InstCombine/InstCombine.h?rev=226987&view=auto" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Transforms/InstCombine/InstCombine.h?rev=226987&view=auto</a><br>
>> ==============================================================================<br>
>> --- llvm/trunk/include/llvm/Transforms/InstCombine/InstCombine.h (added)<br>
>> +++ llvm/trunk/include/llvm/Transforms/InstCombine/InstCombine.h Fri Jan 23 22:19:17 2015<br>
>> @@ -0,0 +1,46 @@<br>
>> +//===- InstCombine.h - InstCombine pass -------------------------*- C++ -*-===//<br>
>> +//<br>
>> +// The LLVM Compiler Infrastructure<br>
>> +//<br>
>> +// This file is distributed under the University of Illinois Open Source<br>
>> +// License. See LICENSE.TXT for details.<br>
>> +//<br>
>> +//===----------------------------------------------------------------------===//<br>
>> +/// \file<br>
>> +///<br>
>> +/// This file provides the primary interface to the instcombine pass. This pass<br>
>> +/// is suitable for use in the new pass manager. For a pass that works with the<br>
>> +/// legacy pass manager, please look for \c createInstructionCombiningPass() in<br>
>> +/// Scalar.h.<br>
>> +///<br>
>> +//===----------------------------------------------------------------------===//<br>
>> +<br>
>> +#ifndef LLVM_TRANSFORMS_INSTCOMBINE_INSTCOMBINE_H<br>
>> +#define LLVM_TRANSFORMS_INSTCOMBINE_INSTCOMBINE_H<br>
>> +<br>
>> +#include "llvm/IR/Function.h"<br>
>> +#include "llvm/IR/PassManager.h"<br>
>> +#include "llvm/Transforms/InstCombine/InstCombineWorklist.h"<br>
>> +<br>
>> +namespace llvm {<br>
>> +<br>
>> +class InstCombinePass {<br>
>> + InstCombineWorklist Worklist;<br>
>> +<br>
>> +public:<br>
>> + static StringRef name() { return "InstCombinePass"; }<br>
>> +<br>
>> + // Explicitly define constructors for MSVC.<br>
>> + InstCombinePass() {}<br>
>> + InstCombinePass(InstCombinePass &&Arg) : Worklist(std::move(Arg.Worklist)) {}<br>
>> + InstCombinePass &operator=(InstCombinePass &&RHS) {<br>
>> + Worklist = std::move(RHS.Worklist);<br>
>> + return *this;<br>
>> + }<br>
>> +<br>
>> + PreservedAnalyses run(Function &F, AnalysisManager<Function> *AM);<br>
>> +};<br>
>> +<br>
>> +}<br>
>> +<br>
>> +#endif<br>
>><br>
>> Copied: llvm/trunk/include/llvm/Transforms/InstCombine/InstCombineWorklist.h (from r226981, llvm/trunk/lib/Transforms/InstCombine/InstCombineWorklist.h)<br>
>> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Transforms/InstCombine/InstCombineWorklist.h?p2=llvm/trunk/include/llvm/Transforms/InstCombine/InstCombineWorklist.h&p1=llvm/trunk/lib/Transforms/InstCombine/InstCombineWorklist.h&r1=226981&r2=226987&rev=226987&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Transforms/InstCombine/InstCombineWorklist.h?p2=llvm/trunk/include/llvm/Transforms/InstCombine/InstCombineWorklist.h&p1=llvm/trunk/lib/Transforms/InstCombine/InstCombineWorklist.h&r1=226981&r2=226987&rev=226987&view=diff</a><br>
>> ==============================================================================<br>
>> --- llvm/trunk/lib/Transforms/InstCombine/InstCombineWorklist.h (original)<br>
>> +++ llvm/trunk/include/llvm/Transforms/InstCombine/InstCombineWorklist.h Fri Jan 23 22:19:17 2015<br>
>> @@ -7,8 +7,8 @@<br>
>> //<br>
>> //===----------------------------------------------------------------------===//<br>
>><br>
>> -#ifndef LLVM_LIB_TRANSFORMS_INSTCOMBINE_INSTCOMBINEWORKLIST_H<br>
>> -#define LLVM_LIB_TRANSFORMS_INSTCOMBINE_INSTCOMBINEWORKLIST_H<br>
>> +#ifndef LLVM_TRANSFORMS_INSTCOMBINE_INSTCOMBINEWORKLIST_H<br>
>> +#define LLVM_TRANSFORMS_INSTCOMBINE_INSTCOMBINEWORKLIST_H<br>
>><br>
>> #include "llvm/ADT/DenseMap.h"<br>
>> #include "llvm/ADT/SmallVector.h"<br>
>> @@ -32,6 +32,15 @@ class LLVM_LIBRARY_VISIBILITY InstCombin<br>
>> public:<br>
>> InstCombineWorklist() {}<br>
>><br>
>> + InstCombineWorklist(InstCombineWorklist &&Arg)<br>
>> + : Worklist(std::move(Arg.Worklist)),<br>
>> + WorklistMap(std::move(Arg.WorklistMap)) {}<br>
>> + InstCombineWorklist &operator=(InstCombineWorklist &&RHS) {<br>
>> + Worklist = std::move(RHS.Worklist);<br>
>> + WorklistMap = std::move(RHS.WorklistMap);<br>
>> + return *this;<br>
>> + }<br>
>> +<br>
>> bool isEmpty() const { return Worklist.empty(); }<br>
>><br>
>> /// Add - Add the specified instruction to the worklist if it isn't already<br>
>><br>
>> Modified: llvm/trunk/lib/Transforms/InstCombine/InstCombineInternal.h<br>
>> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/InstCombine/InstCombineInternal.h?rev=226987&r1=226986&r2=226987&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/InstCombine/InstCombineInternal.h?rev=226987&r1=226986&r2=226987&view=diff</a><br>
>> ==============================================================================<br>
>> --- llvm/trunk/lib/Transforms/InstCombine/InstCombineInternal.h (original)<br>
>> +++ llvm/trunk/lib/Transforms/InstCombine/InstCombineInternal.h Fri Jan 23 22:19:17 2015<br>
>> @@ -15,7 +15,6 @@<br>
>> #ifndef LLVM_LIB_TRANSFORMS_INSTCOMBINE_INSTCOMBINEINTERNAL_H<br>
>> #define LLVM_LIB_TRANSFORMS_INSTCOMBINE_INSTCOMBINEINTERNAL_H<br>
>><br>
>> -#include "InstCombineWorklist.h"<br>
>> #include "llvm/Analysis/AssumptionCache.h"<br>
>> #include "llvm/Analysis/LoopInfo.h"<br>
>> #include "llvm/Analysis/TargetFolder.h"<br>
>> @@ -27,6 +26,7 @@<br>
>> #include "llvm/IR/Operator.h"<br>
>> #include "llvm/IR/PatternMatch.h"<br>
>> #include "llvm/Pass.h"<br>
>> +#include "llvm/Transforms/InstCombine/InstCombineWorklist.h"<br>
>><br>
>> #define DEBUG_TYPE "instcombine"<br>
>><br>
>><br>
>> Removed: llvm/trunk/lib/Transforms/InstCombine/InstCombineWorklist.h<br>
>> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/InstCombine/InstCombineWorklist.h?rev=226986&view=auto" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/InstCombine/InstCombineWorklist.h?rev=226986&view=auto</a><br>
>> ==============================================================================<br>
>> --- llvm/trunk/lib/Transforms/InstCombine/InstCombineWorklist.h (original)<br>
>> +++ llvm/trunk/lib/Transforms/InstCombine/InstCombineWorklist.h (removed)<br>
>> @@ -1,107 +0,0 @@<br>
>> -//===- InstCombineWorklist.h - Worklist for InstCombine pass ----*- C++ -*-===//<br>
>> -//<br>
>> -// The LLVM Compiler Infrastructure<br>
>> -//<br>
>> -// This file is distributed under the University of Illinois Open Source<br>
>> -// License. See LICENSE.TXT for details.<br>
>> -//<br>
>> -//===----------------------------------------------------------------------===//<br>
>> -<br>
>> -#ifndef LLVM_LIB_TRANSFORMS_INSTCOMBINE_INSTCOMBINEWORKLIST_H<br>
>> -#define LLVM_LIB_TRANSFORMS_INSTCOMBINE_INSTCOMBINEWORKLIST_H<br>
>> -<br>
>> -#include "llvm/ADT/DenseMap.h"<br>
>> -#include "llvm/ADT/SmallVector.h"<br>
>> -#include "llvm/IR/Instruction.h"<br>
>> -#include "llvm/Support/Compiler.h"<br>
>> -#include "llvm/Support/Debug.h"<br>
>> -#include "llvm/Support/raw_ostream.h"<br>
>> -<br>
>> -#define DEBUG_TYPE "instcombine"<br>
>> -<br>
>> -namespace llvm {<br>
>> -<br>
>> -/// InstCombineWorklist - This is the worklist management logic for<br>
>> -/// InstCombine.<br>
>> -class LLVM_LIBRARY_VISIBILITY InstCombineWorklist {<br>
>> - SmallVector<Instruction*, 256> Worklist;<br>
>> - DenseMap<Instruction*, unsigned> WorklistMap;<br>
>> -<br>
>> - void operator=(const InstCombineWorklist&RHS) LLVM_DELETED_FUNCTION;<br>
>> - InstCombineWorklist(const InstCombineWorklist&) LLVM_DELETED_FUNCTION;<br>
>> -public:<br>
>> - InstCombineWorklist() {}<br>
>> -<br>
>> - bool isEmpty() const { return Worklist.empty(); }<br>
>> -<br>
>> - /// Add - Add the specified instruction to the worklist if it isn't already<br>
>> - /// in it.<br>
>> - void Add(Instruction *I) {<br>
>> - if (WorklistMap.insert(std::make_pair(I, Worklist.size())).second) {<br>
>> - DEBUG(dbgs() << "IC: ADD: " << *I << '\n');<br>
>> - Worklist.push_back(I);<br>
>> - }<br>
>> - }<br>
>> -<br>
>> - void AddValue(Value *V) {<br>
>> - if (Instruction *I = dyn_cast<Instruction>(V))<br>
>> - Add(I);<br>
>> - }<br>
>> -<br>
>> - /// AddInitialGroup - Add the specified batch of stuff in reverse order.<br>
>> - /// which should only be done when the worklist is empty and when the group<br>
>> - /// has no duplicates.<br>
>> - void AddInitialGroup(Instruction *const *List, unsigned NumEntries) {<br>
>> - assert(Worklist.empty() && "Worklist must be empty to add initial group");<br>
>> - Worklist.reserve(NumEntries+16);<br>
>> - WorklistMap.resize(NumEntries);<br>
>> - DEBUG(dbgs() << "IC: ADDING: " << NumEntries << " instrs to worklist\n");<br>
>> - for (unsigned Idx = 0; NumEntries; --NumEntries) {<br>
>> - Instruction *I = List[NumEntries-1];<br>
>> - WorklistMap.insert(std::make_pair(I, Idx++));<br>
>> - Worklist.push_back(I);<br>
>> - }<br>
>> - }<br>
>> -<br>
>> - // Remove - remove I from the worklist if it exists.<br>
>> - void Remove(Instruction *I) {<br>
>> - DenseMap<Instruction*, unsigned>::iterator It = WorklistMap.find(I);<br>
>> - if (It == WorklistMap.end()) return; // Not in worklist.<br>
>> -<br>
>> - // Don't bother moving everything down, just null out the slot.<br>
>> - Worklist[It->second] = nullptr;<br>
>> -<br>
>> - WorklistMap.erase(It);<br>
>> - }<br>
>> -<br>
>> - Instruction *RemoveOne() {<br>
>> - Instruction *I = Worklist.pop_back_val();<br>
>> - WorklistMap.erase(I);<br>
>> - return I;<br>
>> - }<br>
>> -<br>
>> - /// AddUsersToWorkList - When an instruction is simplified, add all users of<br>
>> - /// the instruction to the work lists because they might get more simplified<br>
>> - /// now.<br>
>> - ///<br>
>> - void AddUsersToWorkList(Instruction &I) {<br>
>> - for (User *U : I.users())<br>
>> - Add(cast<Instruction>(U));<br>
>> - }<br>
>> -<br>
>> -<br>
>> - /// Zap - check that the worklist is empty and nuke the backing store for<br>
>> - /// the map if it is large.<br>
>> - void Zap() {<br>
>> - assert(WorklistMap.empty() && "Worklist empty, but map not?");<br>
>> -<br>
>> - // Do an explicit clear, this shrinks the map if needed.<br>
>> - WorklistMap.clear();<br>
>> - }<br>
>> -};<br>
>> -<br>
>> -} // end namespace llvm.<br>
>> -<br>
>> -#undef DEBUG_TYPE<br>
>> -<br>
>> -#endif<br>
>><br>
>> Modified: llvm/trunk/lib/Transforms/InstCombine/InstructionCombining.cpp<br>
>> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/InstCombine/InstructionCombining.cpp?rev=226987&r1=226986&r2=226987&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/InstCombine/InstructionCombining.cpp?rev=226987&r1=226986&r2=226987&view=diff</a><br>
>> ==============================================================================<br>
>> --- llvm/trunk/lib/Transforms/InstCombine/InstructionCombining.cpp (original)<br>
>> +++ llvm/trunk/lib/Transforms/InstCombine/InstructionCombining.cpp Fri Jan 23 22:19:17 2015<br>
>> @@ -33,7 +33,7 @@<br>
>> //<br>
>> //===----------------------------------------------------------------------===//<br>
>><br>
>> -#include "llvm/Transforms/Scalar.h"<br>
>> +#include "llvm/Transforms/InstCombine/InstCombine.h"<br>
>> #include "InstCombineInternal.h"<br>
>> #include "llvm-c/Initialization.h"<br>
>> #include "llvm/ADT/SmallPtrSet.h"<br>
>> @@ -45,6 +45,7 @@<br>
>> #include "llvm/Analysis/InstructionSimplify.h"<br>
>> #include "llvm/Analysis/LoopInfo.h"<br>
>> #include "llvm/Analysis/MemoryBuiltins.h"<br>
>> +#include "llvm/Analysis/TargetLibraryInfo.h"<br>
>> #include "llvm/Analysis/ValueTracking.h"<br>
>> #include "llvm/IR/CFG.h"<br>
>> #include "llvm/IR/DataLayout.h"<br>
>> @@ -55,7 +56,7 @@<br>
>> #include "llvm/IR/ValueHandle.h"<br>
>> #include "llvm/Support/CommandLine.h"<br>
>> #include "llvm/Support/Debug.h"<br>
>> -#include "llvm/Analysis/TargetLibraryInfo.h"<br>
>> +#include "llvm/Transforms/Scalar.h"<br>
>> #include "llvm/Transforms/Utils/Local.h"<br>
>> #include <algorithm><br>
>> #include <climits><br>
>> @@ -2922,6 +2923,66 @@ static bool prepareICWorklistFromFunctio<br>
>> return MadeIRChange;<br>
>> }<br>
>><br>
>> +static bool combineInstructionsOverFunction(<br>
>> + Function &F, InstCombineWorklist &Worklist, AssumptionCache &AC,<br>
>> + TargetLibraryInfo &TLI, DominatorTree &DT, const DataLayout *DL = nullptr,<br>
>> + LoopInfo *LI = nullptr) {<br>
>> + // Minimizing size?<br>
>> + bool MinimizeSize = F.getAttributes().hasAttribute(<br>
>> + AttributeSet::FunctionIndex, Attribute::MinSize);<br>
>> +<br>
>> + /// Builder - This is an IRBuilder that automatically inserts new<br>
>> + /// instructions into the worklist when they are created.<br>
>> + IRBuilder<true, TargetFolder, InstCombineIRInserter> Builder(<br>
>> + F.getContext(), TargetFolder(DL), InstCombineIRInserter(Worklist, &AC));<br>
>> +<br>
>> + // Lower dbg.declare intrinsics otherwise their value may be clobbered<br>
>> + // by instcombiner.<br>
>> + bool DbgDeclaresChanged = LowerDbgDeclare(F);<br>
>> +<br>
>> + // Iterate while there is work to do.<br>
>> + int Iteration = 0;<br>
>> + for (;;) {<br>
>> + ++Iteration;<br>
>> + DEBUG(dbgs() << "\n\nINSTCOMBINE ITERATION #" << Iteration << " on "<br>
>> + << F.getName() << "\n");<br>
>> +<br>
>> + bool Changed = false;<br>
>> + if (prepareICWorklistFromFunction(F, DL, &TLI, Worklist))<br>
>> + Changed = true;<br>
>> +<br>
>> + InstCombiner IC(Worklist, &Builder, MinimizeSize, &AC, &TLI, &DT, DL, LI);<br>
>> + if (IC.run())<br>
>> + Changed = true;<br>
>> +<br>
>> + if (!Changed)<br>
>> + break;<br>
>> + }<br>
>> +<br>
>> + return DbgDeclaresChanged || Iteration > 1;<br>
>> +}<br>
>> +<br>
>> +PreservedAnalyses InstCombinePass::run(Function &F,<br>
>> + AnalysisManager<Function> *AM) {<br>
>> + auto *DL = F.getParent()->getDataLayout();<br>
>> +<br>
>> + auto &AC = AM->getResult<AssumptionAnalysis>(F);<br>
>> + auto &DT = AM->getResult<DominatorTreeAnalysis>(F);<br>
>> + auto &TLI = AM->getResult<TargetLibraryAnalysis>(F);<br>
>> +<br>
>> + auto *LI = AM->getCachedResult<LoopAnalysis>(F);<br>
>> +<br>
>> + if (!combineInstructionsOverFunction(F, Worklist, AC, TLI, DT, DL, LI))<br>
>> + // No changes, all analyses are preserved.<br>
>> + return PreservedAnalyses::all();<br>
>> +<br>
>> + // Mark all the analyses that instcombine updates as preserved.<br>
>> + // FIXME: Need a way to preserve CFG analyses here!<br>
>> + PreservedAnalyses PA;<br>
>> + PA.preserve<DominatorTreeAnalysis>();<br>
>> + return PA;<br>
>> +}<br>
>> +<br>
>> namespace {<br>
>> /// \brief The legacy pass manager's instcombine pass.<br>
>> ///<br>
>> @@ -2954,10 +3015,6 @@ bool InstructionCombiningPass::runOnFunc<br>
>> if (skipOptnoneFunction(F))<br>
>> return false;<br>
>><br>
>> - // Lower dbg.declare intrinsics otherwise their value may be clobbered<br>
>> - // by instcombiner.<br>
>> - bool DbgDeclaresChanged = LowerDbgDeclare(F);<br>
>> -<br>
>> // Required analyses.<br>
>> auto &AC = getAnalysis<AssumptionCacheTracker>().getAssumptionCache(F);<br>
>> auto &TLI = getAnalysis<TargetLibraryInfoWrapperPass>().getTLI();<br>
>> @@ -2969,35 +3026,7 @@ bool InstructionCombiningPass::runOnFunc<br>
>> auto *LIWP = getAnalysisIfAvailable<LoopInfoWrapperPass>();<br>
>> auto *LI = LIWP ? &LIWP->getLoopInfo() : nullptr;<br>
>><br>
>> - // Minimizing size?<br>
>> - bool MinimizeSize = F.getAttributes().hasAttribute(<br>
>> - AttributeSet::FunctionIndex, Attribute::MinSize);<br>
>> -<br>
>> - /// Builder - This is an IRBuilder that automatically inserts new<br>
>> - /// instructions into the worklist when they are created.<br>
>> - IRBuilder<true, TargetFolder, InstCombineIRInserter> Builder(<br>
>> - F.getContext(), TargetFolder(DL), InstCombineIRInserter(Worklist, &AC));<br>
>> -<br>
>> - // Iterate while there is work to do.<br>
>> - int Iteration = 0;<br>
>> - for (;;) {<br>
>> - ++Iteration;<br>
>> - DEBUG(dbgs() << "\n\nINSTCOMBINE ITERATION #" << Iteration << " on "<br>
>> - << F.getName() << "\n");<br>
>> -<br>
>> - bool Changed = false;<br>
>> - if (prepareICWorklistFromFunction(F, DL, &TLI, Worklist))<br>
>> - Changed = true;<br>
>> -<br>
>> - InstCombiner IC(Worklist, &Builder, MinimizeSize, &AC, &TLI, &DT, DL, LI);<br>
>> - if (IC.run())<br>
>> - Changed = true;<br>
>> -<br>
>> - if (!Changed)<br>
>> - break;<br>
>> - }<br>
>> -<br>
>> - return DbgDeclaresChanged || Iteration > 1;<br>
>> + return combineInstructionsOverFunction(F, Worklist, AC, TLI, DT, DL, LI);<br>
>> }<br>
>><br>
>> char InstructionCombiningPass::ID = 0;<br>
>><br>
>> Modified: llvm/trunk/test/Transforms/InstCombine/load.ll<br>
>> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/load.ll?rev=226987&r1=226986&r2=226987&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/load.ll?rev=226987&r1=226986&r2=226987&view=diff</a><br>
>> ==============================================================================<br>
>> --- llvm/trunk/test/Transforms/InstCombine/load.ll (original)<br>
>> +++ llvm/trunk/test/Transforms/InstCombine/load.ll Fri Jan 23 22:19:17 2015<br>
>> @@ -1,4 +1,5 @@<br>
>> ; RUN: opt -instcombine -S < %s | FileCheck %s<br>
>> +; RUN: opt -passes=instcombine -S < %s | FileCheck %s<br>
>><br>
>> ; This test makes sure that these instructions are properly eliminated.<br>
>><br>
>><br>
>> Modified: llvm/trunk/tools/opt/PassRegistry.def<br>
>> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/opt/PassRegistry.def?rev=226987&r1=226986&r2=226987&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/opt/PassRegistry.def?rev=226987&r1=226986&r2=226987&view=diff</a><br>
>> ==============================================================================<br>
>> --- llvm/trunk/tools/opt/PassRegistry.def (original)<br>
>> +++ llvm/trunk/tools/opt/PassRegistry.def Fri Jan 23 22:19:17 2015<br>
>> @@ -60,6 +60,7 @@ FUNCTION_ANALYSIS("targetlibinfo", Targe<br>
>> #ifndef FUNCTION_PASS<br>
>> #define FUNCTION_PASS(NAME, CREATE_PASS)<br>
>> #endif<br>
>> +FUNCTION_PASS("instcombine", InstCombinePass())<br>
>> FUNCTION_PASS("invalidate<all>", InvalidateAllAnalysesPass())<br>
>> FUNCTION_PASS("no-op-function", NoOpFunctionPass())<br>
>> FUNCTION_PASS("print", PrintFunctionPass(dbgs()))<br>
>><br>
>> Modified: llvm/trunk/tools/opt/Passes.cpp<br>
>> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/opt/Passes.cpp?rev=226987&r1=226986&r2=226987&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/opt/Passes.cpp?rev=226987&r1=226986&r2=226987&view=diff</a><br>
>> ==============================================================================<br>
>> --- llvm/trunk/tools/opt/Passes.cpp (original)<br>
>> +++ llvm/trunk/tools/opt/Passes.cpp Fri Jan 23 22:19:17 2015<br>
>> @@ -25,6 +25,7 @@<br>
>> #include "llvm/IR/PassManager.h"<br>
>> #include "llvm/IR/Verifier.h"<br>
>> #include "llvm/Support/Debug.h"<br>
>> +#include "llvm/Transforms/InstCombine/InstCombine.h"<br>
>><br>
>> using namespace llvm;<br>
>><br>
>><br>
>><br>
>> _______________________________________________<br>
>> llvm-commits mailing list<br>
>> <a href="mailto:llvm-commits@cs.uiuc.edu">llvm-commits@cs.uiuc.edu</a><br>
>> <a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits</a><br>
><br>
> _______________________________________________<br>
> llvm-commits mailing list<br>
> <a href="mailto:llvm-commits@cs.uiuc.edu">llvm-commits@cs.uiuc.edu</a><br>
> <a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits</a><br>
<br>
_______________________________________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@cs.uiuc.edu">llvm-commits@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits</a><br>
</div></div></blockquote></div><br></div>