Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(454)

Unified Diff: lib/Transforms/NaCl/FixVectorLoadStoreAlignment.cpp

Issue 1151093004: Changes from 3.7 merge to files not in upstream (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-llvm.git@master
Patch Set: Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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);

Powered by Google App Engine
This is Rietveld 408576698