summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRuiling Song <ruiling.song@intel.com>2015-02-11 10:59:09 +0800
committerZhigang Gong <zhigang.gong@intel.com>2015-02-11 16:32:27 +0800
commit80a77ec73811a14625122b71ebc21a8a8c670d66 (patch)
tree09e7ba90906f417dc07055f039bd0fb25ce3058f
parent029c4c87cd0d8e01625ede68f183d798472fe82c (diff)
GBE: Load/store should use same address space as before.
Signed-off-by: Ruiling Song <ruiling.song@intel.com> Reviewed-by: Zhigang Gong <zhigang.gong@linux.intel.com>
-rw-r--r--backend/src/llvm/ExpandLargeIntegers.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/backend/src/llvm/ExpandLargeIntegers.cpp b/backend/src/llvm/ExpandLargeIntegers.cpp
index 2743cb12..194622cb 100644
--- a/backend/src/llvm/ExpandLargeIntegers.cpp
+++ b/backend/src/llvm/ExpandLargeIntegers.cpp
@@ -652,15 +652,16 @@ static void convertInstruction(Instruction *Inst, ConversionState &State,
} else if (LoadInst *Load = dyn_cast<LoadInst>(Inst)) {
Value *Op = Load->getPointerOperand();
+ unsigned AddrSpace = Op->getType()->getPointerAddressSpace();
TypePair Tys = getExpandedIntTypes(Load->getType());
AlignPair Align = getAlign(DL, Load, Load->getType());
- Value *Loty = IRB.CreateBitCast(Op, Tys.Lo->getPointerTo(),
+ Value *Loty = IRB.CreateBitCast(Op, Tys.Lo->getPointerTo(AddrSpace),
Twine(Op->getName(), ".loty"));
Value *Lo =
IRB.CreateAlignedLoad(Loty, Align.Lo, Twine(Load->getName(), ".lo"));
Value *HiAddr =
IRB.CreateConstGEP1_32(Loty, 1, Twine(Op->getName(), ".hi.gep"));
- Value *HiTy = IRB.CreateBitCast(HiAddr, Tys.Hi->getPointerTo(),
+ Value *HiTy = IRB.CreateBitCast(HiAddr, Tys.Hi->getPointerTo(AddrSpace),
Twine(Op->getName(), ".hity"));
Value *Hi =
IRB.CreateAlignedLoad(HiTy, Align.Hi, Twine(Load->getName(), ".hi"));
@@ -668,15 +669,16 @@ static void convertInstruction(Instruction *Inst, ConversionState &State,
} else if (StoreInst *Store = dyn_cast<StoreInst>(Inst)) {
Value *Ptr = Store->getPointerOperand();
+ unsigned AddrSpace = Ptr->getType()->getPointerAddressSpace();
TypePair Tys = getExpandedIntTypes(Store->getValueOperand()->getType());
ValuePair StoreVals = State.getConverted(Store->getValueOperand());
AlignPair Align = getAlign(DL, Store, Store->getValueOperand()->getType());
- Value *Loty = IRB.CreateBitCast(Ptr, Tys.Lo->getPointerTo(),
+ Value *Loty = IRB.CreateBitCast(Ptr, Tys.Lo->getPointerTo(AddrSpace),
Twine(Ptr->getName(), ".loty"));
Value *Lo = IRB.CreateAlignedStore(StoreVals.Lo, Loty, Align.Lo);
Value *HiAddr =
IRB.CreateConstGEP1_32(Loty, 1, Twine(Ptr->getName(), ".hi.gep"));
- Value *HiTy = IRB.CreateBitCast(HiAddr, Tys.Hi->getPointerTo(),
+ Value *HiTy = IRB.CreateBitCast(HiAddr, Tys.Hi->getPointerTo(AddrSpace),
Twine(Ptr->getName(), ".hity"));
Value *Hi = IRB.CreateAlignedStore(StoreVals.Hi, HiTy, Align.Hi);
State.recordConverted(Store, ValuePair(Lo, Hi));