Remove more default address space argument usage.
[oota-llvm.git] / lib / Transforms / Utils / BuildLibCalls.cpp
index 82384a1edf52c8b3c8a92ccd7cffacd00d3ddfe1..1539cc2d9a675fd98be4c866f9418f7262064fc9 100644 (file)
@@ -27,7 +27,8 @@ using namespace llvm;
 
 /// CastToCStr - Return V if it is an i8*, otherwise cast it to i8*.
 Value *llvm::CastToCStr(Value *V, IRBuilder<> &B) {
-  return B.CreateBitCast(V, B.getInt8PtrTy(), "cstr");
+  unsigned AS = V->getType()->getPointerAddressSpace();
+  return B.CreateBitCast(V, B.getInt8PtrTy(AS), "cstr");
 }
 
 /// EmitStrLen - Emit a call to the strlen function to the builder, for the