//===- LoopStrengthReduce.cpp - Strength Reduce GEPs in Loops -------------===////// The LLVM Compiler Infrastructure//// This file was developed by Nate Begeman and is distributed under the// University of Illinois Open Source License. See LICENSE.TXT for details.////===----------------------------------------------------------------------===////// This pass performs a strength reduction on array references inside loops that// have as one or more of their components the loop induction variable. This is// accomplished by creating a new Value to hold the initial value of the array// access for the first iteration, and then creating a new GEP instruction in// the loop to increment the value by the appropriate amount.////===----------------------------------------------------------------------===//#define DEBUG_TYPE "loop-reduce"#include"llvm/Transforms/Scalar.h"#include"llvm/Constants.h"#include"llvm/Instructions.h"#include"llvm/IntrinsicInst.h"#include"llvm/Type.h"#include"llvm/DerivedTypes.h"#include"llvm/Analysis/Dominators.h"#include"llvm/Analysis/LoopInfo.h"#include"llvm/Analysis/LoopPass.h"#include"llvm/Analysis/ScalarEvolutionExpander.h"#include"llvm/Support/CFG.h"#include"llvm/Support/GetElementPtrTypeIterator.h"#include"llvm/Transforms/Utils/BasicBlockUtils.h"#include"llvm/Transforms/Utils/Local.h"#include"llvm/Target/TargetData.h"#include"llvm/ADT/Statistic.h"#include"llvm/Support/Debug.h"#include"llvm/Support/Compiler.h"#include"llvm/Target/TargetLowering.h"#include<algorithm>#include<set>using