Chromium Code Reviews| Index: lib/Transforms/NaCl/FixVectorLoadStoreAlignment.cpp |
| diff --git a/lib/Transforms/NaCl/FixVectorLoadStoreAlignment.cpp b/lib/Transforms/NaCl/FixVectorLoadStoreAlignment.cpp |
| index 6a33387d47afa23d145e67c828f107f8d2b68cd5..5a7a4998eaf471abec38a36d883c53024079327a 100644 |
| --- a/lib/Transforms/NaCl/FixVectorLoadStoreAlignment.cpp |
| +++ b/lib/Transforms/NaCl/FixVectorLoadStoreAlignment.cpp |
| @@ -30,6 +30,7 @@ |
| #include "llvm/Pass.h" |
| #include "llvm/Support/Debug.h" |
| #include "llvm/Support/MathExtras.h" |
| +#include "llvm/Support/raw_ostream.h" |
| #include "llvm/Transforms/NaCl.h" |
| using namespace llvm; |
| @@ -41,10 +42,6 @@ public: |
| FixVectorLoadStoreAlignment() : BasicBlockPass(ID), M(0), DL(0) { |
| initializeFixVectorLoadStoreAlignmentPass(*PassRegistry::getPassRegistry()); |
| } |
| - void getAnalysisUsage(AnalysisUsage &AU) const override { |
| - AU.addRequired<DataLayoutPass>(); |
| - BasicBlockPass::getAnalysisUsage(AU); |
| - } |
| using BasicBlockPass::doInitialization; |
| bool doInitialization(Module &Mod) override { |
| M = &Mod; |
| @@ -203,7 +200,7 @@ void FixVectorLoadStoreAlignment::scalarizeVectorLoadStore( |
| for (unsigned Elem = 0, NumElems = LoadedVecTy->getNumElements(); |
| Elem != NumElems; ++Elem) { |
| unsigned Align = MinAlign(BaseAlign, ElemAllocSize * Elem); |
| - Value *GEP = IRB.CreateConstInBoundsGEP1_32(Base, Elem); |
| + Value *GEP = IRB.CreateConstInBoundsGEP1_32(ElemTy, Base, Elem); |
| LoadInst *LoadedElem = |
| IRB.CreateAlignedLoad(GEP, Align, VecLoad->isVolatile()); |
| LoadedElem->setSynchScope(VecLoad->getSynchScope()); |
| @@ -236,7 +233,7 @@ void FixVectorLoadStoreAlignment::scalarizeVectorLoadStore( |
| for (unsigned Elem = 0, NumElems = StoredVecTy->getNumElements(); |
| Elem != NumElems; ++Elem) { |
| unsigned Align = MinAlign(BaseAlign, ElemAllocSize * Elem); |
| - Value *GEP = IRB.CreateConstInBoundsGEP1_32(Base, Elem); |
| + Value *GEP = IRB.CreateConstInBoundsGEP1_32(ElemTy, Base, Elem); |
| Value *ElemToStore = IRB.CreateExtractElement( |
| StoredVec, ConstantInt::get(Type::getInt32Ty(M->getContext()), Elem)); |
| StoreInst *StoredElem = IRB.CreateAlignedStore(ElemToStore, GEP, Align, |
| @@ -251,7 +248,7 @@ void FixVectorLoadStoreAlignment::scalarizeVectorLoadStore( |
| bool FixVectorLoadStoreAlignment::runOnBasicBlock(BasicBlock &BB) { |
| bool Changed = false; |
| if (!DL) |
| - DL = &getAnalysis<DataLayoutPass>().getDataLayout(); |
| + DL = &BB.getParent()->getParent()->getDataLayout(); |
|
jvoung (off chromium)
2015/05/26 20:39:45
could be getModule()
Derek Schuff
2015/05/26 22:01:32
Done.
|
| Instructions Loads; |
| Instructions Stores; |
| visitVectorLoadStore(BB, Loads, Stores); |