[polly] r261790 - Add assertions checking def dominates use. NFC.
Michael Kruse via llvm-commits
llvm-commits at lists.llvm.org
Wed Feb 24 14:08:14 PST 2016
Author: meinersbur
Date: Wed Feb 24 16:08:14 2016
New Revision: 261790
URL: http://llvm.org/viewvc/llvm-project?rev=261790&view=rev
Log:
Add assertions checking def dominates use. NFC.
This is also be caught by the function verifier, but disconnected from
the place that produced it. Catch it already at creation to be able to
reason more directly about the cause.
Modified:
polly/trunk/lib/CodeGen/BlockGenerators.cpp
Modified: polly/trunk/lib/CodeGen/BlockGenerators.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/CodeGen/BlockGenerators.cpp?rev=261790&r1=261789&r2=261790&view=diff
==============================================================================
--- polly/trunk/lib/CodeGen/BlockGenerators.cpp (original)
+++ polly/trunk/lib/CodeGen/BlockGenerators.cpp Wed Feb 24 16:08:14 2016
@@ -403,6 +403,10 @@ void BlockGenerator::generateScalarLoads
continue;
auto *Address = getOrCreateAlloca(*MA);
+ assert((!isa<Instruction>(Address) ||
+ DT.dominates(cast<Instruction>(Address)->getParent(),
+ Builder.GetInsertBlock())) &&
+ "Domination violation");
BBMap[MA->getBaseAddr()] =
Builder.CreateLoad(Address, Address->getName() + ".reload");
}
@@ -435,6 +439,14 @@ void BlockGenerator::generateScalarStore
auto *Address = getOrCreateAlloca(*MA);
Val = getNewValue(Stmt, Val, BBMap, LTS, L);
+ assert((!isa<Instruction>(Val) ||
+ DT.dominates(cast<Instruction>(Val)->getParent(),
+ Builder.GetInsertBlock())) &&
+ "Domination violation");
+ assert((!isa<Instruction>(Address) ||
+ DT.dominates(cast<Instruction>(Address)->getParent(),
+ Builder.GetInsertBlock())) &&
+ "Domination violation");
Builder.CreateStore(Val, Address);
}
}
@@ -1266,6 +1278,14 @@ void RegionGenerator::generateScalarStor
Value *NewVal = getExitScalar(MA, LTS, BBMap);
Value *Address = getOrCreateAlloca(*MA);
+ assert((!isa<Instruction>(NewVal) ||
+ DT.dominates(cast<Instruction>(NewVal)->getParent(),
+ Builder.GetInsertBlock())) &&
+ "Domination violation");
+ assert((!isa<Instruction>(Address) ||
+ DT.dominates(cast<Instruction>(Address)->getParent(),
+ Builder.GetInsertBlock())) &&
+ "Domination violation");
Builder.CreateStore(NewVal, Address);
}
}
More information about the llvm-commits
mailing list