diff options
author | Piotr Padlewski <prazek@google.com> | 2015-09-15 18:32:14 +0000 |
---|---|---|
committer | Piotr Padlewski <prazek@google.com> | 2015-09-15 18:32:14 +0000 |
commit | 6c15ec49ede56932382b24eaaaa851f79d3cca78 (patch) | |
tree | 0b993b57bf75064ce37ef3fc1b8b1cd30951ad09 /llvm/lib/CodeGen/CodeGenPrepare.cpp | |
parent | dc29c973e5c8e3f1dfb6ea83570e4ee571008ca5 (diff) | |
download | bcm5719-llvm-6c15ec49ede56932382b24eaaaa851f79d3cca78.tar.gz bcm5719-llvm-6c15ec49ede56932382b24eaaaa851f79d3cca78.zip |
Introducing llvm.invariant.group.barrier intrinsic
For more info for what reason it was invented, goto:
http://lists.llvm.org/pipermail/cfe-dev/2015-July/044227.html
invariant.group.barrier:
http://reviews.llvm.org/D12310
docs:
http://reviews.llvm.org/D11399
CodeGenPrepare:
http://reviews.llvm.org/D12875
llvm-svn: 247711
Diffstat (limited to 'llvm/lib/CodeGen/CodeGenPrepare.cpp')
-rw-r--r-- | llvm/lib/CodeGen/CodeGenPrepare.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/CodeGenPrepare.cpp b/llvm/lib/CodeGen/CodeGenPrepare.cpp index 9ed15fb7753..d0c8fb95d48 100644 --- a/llvm/lib/CodeGen/CodeGenPrepare.cpp +++ b/llvm/lib/CodeGen/CodeGenPrepare.cpp @@ -187,6 +187,7 @@ class TypePromotionTransaction; unsigned CreatedInstCost); bool splitBranchCondition(Function &F); bool simplifyOffsetableRelocate(Instruction &I); + void stripInvariantGroupMetadata(Instruction &I); }; } @@ -1411,6 +1412,10 @@ bool CodeGenPrepare::OptimizeCallInst(CallInst *CI, bool& ModifiedDT) { InsertedInsts.insert(ExtVal); return true; } + case Intrinsic::invariant_group_barrier: + II->replaceAllUsesWith(II->getArgOperand(0)); + II->eraseFromParent(); + return true; } if (TLI) { @@ -4421,6 +4426,7 @@ bool CodeGenPrepare::OptimizeInst(Instruction *I, bool& ModifiedDT) { return OptimizeCmpExpression(CI); if (LoadInst *LI = dyn_cast<LoadInst>(I)) { + stripInvariantGroupMetadata(*LI); if (TLI) { unsigned AS = LI->getPointerAddressSpace(); return OptimizeMemoryInst(I, I->getOperand(0), LI->getType(), AS); @@ -4429,6 +4435,7 @@ bool CodeGenPrepare::OptimizeInst(Instruction *I, bool& ModifiedDT) { } if (StoreInst *SI = dyn_cast<StoreInst>(I)) { + stripInvariantGroupMetadata(*SI); if (TLI) { unsigned AS = SI->getPointerAddressSpace(); return OptimizeMemoryInst(I, SI->getOperand(1), @@ -4827,3 +4834,8 @@ bool CodeGenPrepare::splitBranchCondition(Function &F) { } return MadeChange; } + +void CodeGenPrepare::stripInvariantGroupMetadata(Instruction &I) { + if (auto *InvariantMD = I.getMetadata("invariant.group")) + I.dropUnknownNonDebugMetadata(InvariantMD->getMetadataID()); +} |