[llvm] r289339 - [X86][IR] Move the autoupgrading of store intrinsics out of the main nested if/else chain. This should buy a little more time against the MSVC limit mentioned in PR31034.
Craig Topper via llvm-commits
llvm-commits at lists.llvm.org
Sat Dec 10 13:15:49 PST 2016
Author: ctopper
Date: Sat Dec 10 15:15:48 2016
New Revision: 289339
URL: http://llvm.org/viewvc/llvm-project?rev=289339&view=rev
Log:
[X86][IR] Move the autoupgrading of store intrinsics out of the main nested if/else chain. This should buy a little more time against the MSVC limit mentioned in PR31034.
The handlers for stores all return at the end of their block so they can be picked off early.
Modified:
llvm/trunk/lib/IR/AutoUpgrade.cpp
Modified: llvm/trunk/lib/IR/AutoUpgrade.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/AutoUpgrade.cpp?rev=289339&r1=289338&r2=289339&view=diff
==============================================================================
--- llvm/trunk/lib/IR/AutoUpgrade.cpp (original)
+++ llvm/trunk/lib/IR/AutoUpgrade.cpp Sat Dec 10 15:15:48 2016
@@ -745,6 +745,108 @@ void llvm::UpgradeIntrinsicCall(CallInst
if (IsX86)
Name = Name.substr(4);
+ if (IsX86 && Name.startswith("sse4a.movnt.")) {
+ Module *M = F->getParent();
+ SmallVector<Metadata *, 1> Elts;
+ Elts.push_back(
+ ConstantAsMetadata::get(ConstantInt::get(Type::getInt32Ty(C), 1)));
+ MDNode *Node = MDNode::get(C, Elts);
+
+ Value *Arg0 = CI->getArgOperand(0);
+ Value *Arg1 = CI->getArgOperand(1);
+
+ // Nontemporal (unaligned) store of the 0'th element of the float/double
+ // vector.
+ Type *SrcEltTy = cast<VectorType>(Arg1->getType())->getElementType();
+ PointerType *EltPtrTy = PointerType::getUnqual(SrcEltTy);
+ Value *Addr = Builder.CreateBitCast(Arg0, EltPtrTy, "cast");
+ Value *Extract =
+ Builder.CreateExtractElement(Arg1, (uint64_t)0, "extractelement");
+
+ StoreInst *SI = Builder.CreateAlignedStore(Extract, Addr, 1);
+ SI->setMetadata(M->getMDKindID("nontemporal"), Node);
+
+ // Remove intrinsic.
+ CI->eraseFromParent();
+ return;
+ }
+
+ if (IsX86 && (Name.startswith("avx.movnt.") ||
+ Name.startswith("avx512.storent."))) {
+ Module *M = F->getParent();
+ SmallVector<Metadata *, 1> Elts;
+ Elts.push_back(
+ ConstantAsMetadata::get(ConstantInt::get(Type::getInt32Ty(C), 1)));
+ MDNode *Node = MDNode::get(C, Elts);
+
+ Value *Arg0 = CI->getArgOperand(0);
+ Value *Arg1 = CI->getArgOperand(1);
+
+ // Convert the type of the pointer to a pointer to the stored type.
+ Value *BC = Builder.CreateBitCast(Arg0,
+ PointerType::getUnqual(Arg1->getType()),
+ "cast");
+ VectorType *VTy = cast<VectorType>(Arg1->getType());
+ StoreInst *SI = Builder.CreateAlignedStore(Arg1, BC,
+ VTy->getBitWidth() / 8);
+ SI->setMetadata(M->getMDKindID("nontemporal"), Node);
+
+ // Remove intrinsic.
+ CI->eraseFromParent();
+ return;
+ }
+
+ if (IsX86 && Name == "sse2.storel.dq") {
+ Value *Arg0 = CI->getArgOperand(0);
+ Value *Arg1 = CI->getArgOperand(1);
+
+ Type *NewVecTy = VectorType::get(Type::getInt64Ty(C), 2);
+ Value *BC0 = Builder.CreateBitCast(Arg1, NewVecTy, "cast");
+ Value *Elt = Builder.CreateExtractElement(BC0, (uint64_t)0);
+ Value *BC = Builder.CreateBitCast(Arg0,
+ PointerType::getUnqual(Elt->getType()),
+ "cast");
+ Builder.CreateAlignedStore(Elt, BC, 1);
+
+ // Remove intrinsic.
+ CI->eraseFromParent();
+ return;
+ }
+
+ if (IsX86 && (Name.startswith("sse.storeu.") ||
+ Name.startswith("sse2.storeu.") ||
+ Name.startswith("avx.storeu."))) {
+ Value *Arg0 = CI->getArgOperand(0);
+ Value *Arg1 = CI->getArgOperand(1);
+
+ Arg0 = Builder.CreateBitCast(Arg0,
+ PointerType::getUnqual(Arg1->getType()),
+ "cast");
+ Builder.CreateAlignedStore(Arg1, Arg0, 1);
+
+ // Remove intrinsic.
+ CI->eraseFromParent();
+ return;
+ }
+
+ if (IsX86 && (Name.startswith("avx512.mask.storeu."))) {
+ UpgradeMaskedStore(Builder, CI->getArgOperand(0), CI->getArgOperand(1),
+ CI->getArgOperand(2), /*Aligned*/false);
+
+ // Remove intrinsic.
+ CI->eraseFromParent();
+ return;
+ }
+
+ if (IsX86 && (Name.startswith("avx512.mask.store."))) {
+ UpgradeMaskedStore(Builder, CI->getArgOperand(0), CI->getArgOperand(1),
+ CI->getArgOperand(2), /*Aligned*/true);
+
+ // Remove intrinsic.
+ CI->eraseFromParent();
+ return;
+ }
+
Value *Rep;
// Upgrade packed integer vector compare intrinsics to compare instructions.
if (IsX86 && (Name.startswith("sse2.pcmpeq.") ||
@@ -854,96 +956,6 @@ void llvm::UpgradeIntrinsicCall(CallInst
if (CI->getNumArgOperands() == 3)
Rep = EmitX86Select(Builder, CI->getArgOperand(2), Rep,
CI->getArgOperand(1));
- } else if (IsX86 && Name.startswith("sse4a.movnt.")) {
- Module *M = F->getParent();
- SmallVector<Metadata *, 1> Elts;
- Elts.push_back(
- ConstantAsMetadata::get(ConstantInt::get(Type::getInt32Ty(C), 1)));
- MDNode *Node = MDNode::get(C, Elts);
-
- Value *Arg0 = CI->getArgOperand(0);
- Value *Arg1 = CI->getArgOperand(1);
-
- // Nontemporal (unaligned) store of the 0'th element of the float/double
- // vector.
- Type *SrcEltTy = cast<VectorType>(Arg1->getType())->getElementType();
- PointerType *EltPtrTy = PointerType::getUnqual(SrcEltTy);
- Value *Addr = Builder.CreateBitCast(Arg0, EltPtrTy, "cast");
- Value *Extract =
- Builder.CreateExtractElement(Arg1, (uint64_t)0, "extractelement");
-
- StoreInst *SI = Builder.CreateAlignedStore(Extract, Addr, 1);
- SI->setMetadata(M->getMDKindID("nontemporal"), Node);
-
- // Remove intrinsic.
- CI->eraseFromParent();
- return;
- } else if (IsX86 && (Name.startswith("avx.movnt.") ||
- Name.startswith("avx512.storent."))) {
- Module *M = F->getParent();
- SmallVector<Metadata *, 1> Elts;
- Elts.push_back(
- ConstantAsMetadata::get(ConstantInt::get(Type::getInt32Ty(C), 1)));
- MDNode *Node = MDNode::get(C, Elts);
-
- Value *Arg0 = CI->getArgOperand(0);
- Value *Arg1 = CI->getArgOperand(1);
-
- // Convert the type of the pointer to a pointer to the stored type.
- Value *BC = Builder.CreateBitCast(Arg0,
- PointerType::getUnqual(Arg1->getType()),
- "cast");
- VectorType *VTy = cast<VectorType>(Arg1->getType());
- StoreInst *SI = Builder.CreateAlignedStore(Arg1, BC,
- VTy->getBitWidth() / 8);
- SI->setMetadata(M->getMDKindID("nontemporal"), Node);
-
- // Remove intrinsic.
- CI->eraseFromParent();
- return;
- } else if (IsX86 && Name == "sse2.storel.dq") {
- Value *Arg0 = CI->getArgOperand(0);
- Value *Arg1 = CI->getArgOperand(1);
-
- Type *NewVecTy = VectorType::get(Type::getInt64Ty(C), 2);
- Value *BC0 = Builder.CreateBitCast(Arg1, NewVecTy, "cast");
- Value *Elt = Builder.CreateExtractElement(BC0, (uint64_t)0);
- Value *BC = Builder.CreateBitCast(Arg0,
- PointerType::getUnqual(Elt->getType()),
- "cast");
- Builder.CreateAlignedStore(Elt, BC, 1);
-
- // Remove intrinsic.
- CI->eraseFromParent();
- return;
- } else if (IsX86 && (Name.startswith("sse.storeu.") ||
- Name.startswith("sse2.storeu.") ||
- Name.startswith("avx.storeu."))) {
- Value *Arg0 = CI->getArgOperand(0);
- Value *Arg1 = CI->getArgOperand(1);
-
- Arg0 = Builder.CreateBitCast(Arg0,
- PointerType::getUnqual(Arg1->getType()),
- "cast");
- Builder.CreateAlignedStore(Arg1, Arg0, 1);
-
- // Remove intrinsic.
- CI->eraseFromParent();
- return;
- } else if (IsX86 && (Name.startswith("avx512.mask.storeu."))) {
- UpgradeMaskedStore(Builder, CI->getArgOperand(0), CI->getArgOperand(1),
- CI->getArgOperand(2), /*Aligned*/false);
-
- // Remove intrinsic.
- CI->eraseFromParent();
- return;
- } else if (IsX86 && (Name.startswith("avx512.mask.store."))) {
- UpgradeMaskedStore(Builder, CI->getArgOperand(0), CI->getArgOperand(1),
- CI->getArgOperand(2), /*Aligned*/true);
-
- // Remove intrinsic.
- CI->eraseFromParent();
- return;
} else if (IsX86 && (Name.startswith("avx512.mask.loadu."))) {
Rep = UpgradeMaskedLoad(Builder, CI->getArgOperand(0),
CI->getArgOperand(1), CI->getArgOperand(2),
More information about the llvm-commits
mailing list