|
@@ -1160,7 +1160,8 @@ llvm::Value *CodeGenFunction::EmitLoadOfScalar(LValue lvalue,
|
|
return EmitLoadOfScalar(lvalue.getAddress(), lvalue.isVolatile(),
|
|
return EmitLoadOfScalar(lvalue.getAddress(), lvalue.isVolatile(),
|
|
lvalue.getType(), Loc, lvalue.getAlignmentSource(),
|
|
lvalue.getType(), Loc, lvalue.getAlignmentSource(),
|
|
lvalue.getTBAAInfo(),
|
|
lvalue.getTBAAInfo(),
|
|
- lvalue.getTBAABaseType(), lvalue.getTBAAOffset());
|
|
|
|
|
|
+ lvalue.getTBAABaseType(), lvalue.getTBAAOffset(),
|
|
|
|
+ lvalue.isNontemporal());
|
|
}
|
|
}
|
|
|
|
|
|
static bool hasBooleanRepresentation(QualType Ty) {
|
|
static bool hasBooleanRepresentation(QualType Ty) {
|
|
@@ -1226,7 +1227,8 @@ llvm::Value *CodeGenFunction::EmitLoadOfScalar(Address Addr, bool Volatile,
|
|
AlignmentSource AlignSource,
|
|
AlignmentSource AlignSource,
|
|
llvm::MDNode *TBAAInfo,
|
|
llvm::MDNode *TBAAInfo,
|
|
QualType TBAABaseType,
|
|
QualType TBAABaseType,
|
|
- uint64_t TBAAOffset) {
|
|
|
|
|
|
+ uint64_t TBAAOffset,
|
|
|
|
+ bool isNontemporal) {
|
|
// For better performance, handle vector loads differently.
|
|
// For better performance, handle vector loads differently.
|
|
if (Ty->isVectorType()) {
|
|
if (Ty->isVectorType()) {
|
|
const llvm::Type *EltTy = Addr.getElementType();
|
|
const llvm::Type *EltTy = Addr.getElementType();
|
|
@@ -1258,6 +1260,11 @@ llvm::Value *CodeGenFunction::EmitLoadOfScalar(Address Addr, bool Volatile,
|
|
}
|
|
}
|
|
|
|
|
|
llvm::LoadInst *Load = Builder.CreateLoad(Addr, Volatile);
|
|
llvm::LoadInst *Load = Builder.CreateLoad(Addr, Volatile);
|
|
|
|
+ if (isNontemporal) {
|
|
|
|
+ llvm::MDNode *Node = llvm::MDNode::get(
|
|
|
|
+ Load->getContext(), llvm::ConstantAsMetadata::get(Builder.getInt32(1)));
|
|
|
|
+ Load->setMetadata(CGM.getModule().getMDKindID("nontemporal"), Node);
|
|
|
|
+ }
|
|
if (TBAAInfo) {
|
|
if (TBAAInfo) {
|
|
llvm::MDNode *TBAAPath = CGM.getTBAAStructTagInfo(TBAABaseType, TBAAInfo,
|
|
llvm::MDNode *TBAAPath = CGM.getTBAAStructTagInfo(TBAABaseType, TBAAInfo,
|
|
TBAAOffset);
|
|
TBAAOffset);
|
|
@@ -1330,7 +1337,8 @@ void CodeGenFunction::EmitStoreOfScalar(llvm::Value *Value, Address Addr,
|
|
AlignmentSource AlignSource,
|
|
AlignmentSource AlignSource,
|
|
llvm::MDNode *TBAAInfo,
|
|
llvm::MDNode *TBAAInfo,
|
|
bool isInit, QualType TBAABaseType,
|
|
bool isInit, QualType TBAABaseType,
|
|
- uint64_t TBAAOffset) {
|
|
|
|
|
|
+ uint64_t TBAAOffset,
|
|
|
|
+ bool isNontemporal) {
|
|
|
|
|
|
// Handle vectors differently to get better performance.
|
|
// Handle vectors differently to get better performance.
|
|
if (Ty->isVectorType()) {
|
|
if (Ty->isVectorType()) {
|
|
@@ -1365,6 +1373,12 @@ void CodeGenFunction::EmitStoreOfScalar(llvm::Value *Value, Address Addr,
|
|
}
|
|
}
|
|
|
|
|
|
llvm::StoreInst *Store = Builder.CreateStore(Value, Addr, Volatile);
|
|
llvm::StoreInst *Store = Builder.CreateStore(Value, Addr, Volatile);
|
|
|
|
+ if (isNontemporal) {
|
|
|
|
+ llvm::MDNode *Node =
|
|
|
|
+ llvm::MDNode::get(Store->getContext(),
|
|
|
|
+ llvm::ConstantAsMetadata::get(Builder.getInt32(1)));
|
|
|
|
+ Store->setMetadata(CGM.getModule().getMDKindID("nontemporal"), Node);
|
|
|
|
+ }
|
|
if (TBAAInfo) {
|
|
if (TBAAInfo) {
|
|
llvm::MDNode *TBAAPath = CGM.getTBAAStructTagInfo(TBAABaseType, TBAAInfo,
|
|
llvm::MDNode *TBAAPath = CGM.getTBAAStructTagInfo(TBAABaseType, TBAAInfo,
|
|
TBAAOffset);
|
|
TBAAOffset);
|
|
@@ -1378,7 +1392,7 @@ void CodeGenFunction::EmitStoreOfScalar(llvm::Value *value, LValue lvalue,
|
|
EmitStoreOfScalar(value, lvalue.getAddress(), lvalue.isVolatile(),
|
|
EmitStoreOfScalar(value, lvalue.getAddress(), lvalue.isVolatile(),
|
|
lvalue.getType(), lvalue.getAlignmentSource(),
|
|
lvalue.getType(), lvalue.getAlignmentSource(),
|
|
lvalue.getTBAAInfo(), isInit, lvalue.getTBAABaseType(),
|
|
lvalue.getTBAAInfo(), isInit, lvalue.getTBAABaseType(),
|
|
- lvalue.getTBAAOffset());
|
|
|
|
|
|
+ lvalue.getTBAAOffset(), lvalue.isNontemporal());
|
|
}
|
|
}
|
|
|
|
|
|
/// EmitLoadOfLValue - Given an expression that represents a value lvalue, this
|
|
/// EmitLoadOfLValue - Given an expression that represents a value lvalue, this
|