aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Transforms/Utils/LoopRotationUtils.cpp
diff options
context:
space:
mode:
authorNikita Popov <nikita.ppv@gmail.com>2021-01-24 16:22:09 +0100
committerNikita Popov <nikita.ppv@gmail.com>2021-01-24 16:24:11 +0100
commit8b9df70bf7e7b812715a3dc9772719188e0df06c (patch)
tree99ea2f8160153b9211bb68401bc69b1d4ffb137e /llvm/lib/Transforms/Utils/LoopRotationUtils.cpp
parent4cc94b731345aa494e0e364846ba9550f5dd5105 (diff)
downloadllvm-8b9df70bf7e7b812715a3dc9772719188e0df06c.zip
llvm-8b9df70bf7e7b812715a3dc9772719188e0df06c.tar.gz
llvm-8b9df70bf7e7b812715a3dc9772719188e0df06c.tar.bz2
[Utils] Use NoAliasScopeDeclInst in a few more places (NFC)
In the cloning infrastructure, only track an MDNode mapping, without explicitly storing the Metadata mapping, same as is done during inlining. This makes things slightly simpler.
Diffstat (limited to 'llvm/lib/Transforms/Utils/LoopRotationUtils.cpp')
-rw-r--r--llvm/lib/Transforms/Utils/LoopRotationUtils.cpp11
1 files changed, 5 insertions, 6 deletions
diff --git a/llvm/lib/Transforms/Utils/LoopRotationUtils.cpp b/llvm/lib/Transforms/Utils/LoopRotationUtils.cpp
index 8192092..b678efd 100644
--- a/llvm/lib/Transforms/Utils/LoopRotationUtils.cpp
+++ b/llvm/lib/Transforms/Utils/LoopRotationUtils.cpp
@@ -404,7 +404,7 @@ bool LoopRotate::rotateLoop(Loop *L, bool SimplifiedLatch) {
// Remember the local noalias scope declarations in the header. After the
// rotation, they must be duplicated and the scope must be cloned. This
// avoids unwanted interaction across iterations.
- SmallVector<Instruction *, 6> NoAliasDeclInstructions;
+ SmallVector<NoAliasScopeDeclInst *, 6> NoAliasDeclInstructions;
for (Instruction &I : *OrigHeader)
if (auto *Decl = dyn_cast<NoAliasScopeDeclInst>(&I))
NoAliasDeclInstructions.push_back(Decl);
@@ -493,7 +493,7 @@ bool LoopRotate::rotateLoop(Loop *L, bool SimplifiedLatch) {
// Clone the llvm.experimental.noalias.decl again for the NewHeader.
Instruction *NewHeaderInsertionPoint = &(*NewHeader->getFirstNonPHI());
- for (Instruction *NAD : NoAliasDeclInstructions) {
+ for (NoAliasScopeDeclInst *NAD : NoAliasDeclInstructions) {
LLVM_DEBUG(dbgs() << " Cloning llvm.experimental.noalias.scope.decl:"
<< *NAD << "\n");
Instruction *NewNAD = NAD->clone();
@@ -505,10 +505,9 @@ bool LoopRotate::rotateLoop(Loop *L, bool SimplifiedLatch) {
{
auto &Context = NewHeader->getContext();
- SmallVector<MetadataAsValue *, 8> NoAliasDeclScopes;
- for (Instruction *NAD : NoAliasDeclInstructions)
- NoAliasDeclScopes.push_back(cast<MetadataAsValue>(
- NAD->getOperand(Intrinsic::NoAliasScopeDeclScopeArg)));
+ SmallVector<MDNode *, 8> NoAliasDeclScopes;
+ for (NoAliasScopeDeclInst *NAD : NoAliasDeclInstructions)
+ NoAliasDeclScopes.push_back(NAD->getScopeList());
LLVM_DEBUG(dbgs() << " Updating OrigHeader scopes\n");
cloneAndAdaptNoAliasScopes(NoAliasDeclScopes, {OrigHeader}, Context,