forked from OSchip/llvm-project
[DomTree] Make assert more precise
Per asbirlea's comment, assert that only instructions, constants and arguments are passed to this API. Simplify returning true would not be correct for special Value subclasses like MemoryAccess.
This commit is contained in:
parent
1882568fcb
commit
c0e8c94373
|
@ -119,8 +119,9 @@ bool DominatorTree::dominates(const Value *DefV,
|
|||
const Instruction *User) const {
|
||||
const Instruction *Def = dyn_cast<Instruction>(DefV);
|
||||
if (!Def) {
|
||||
assert(!isa<BasicBlock>(DefV) && "Should not be called with basic blocks");
|
||||
return true; // Arguments, constants, globals dominate everything.
|
||||
assert((isa<Argument>(DefV) || isa<Constant>(DefV)) &&
|
||||
"Should be called with an instruction, argument or constant");
|
||||
return true; // Arguments and constants dominate everything.
|
||||
}
|
||||
|
||||
const BasicBlock *UseBB = User->getParent();
|
||||
|
@ -259,8 +260,9 @@ bool DominatorTree::dominates(const BasicBlockEdge &BBE, const Use &U) const {
|
|||
bool DominatorTree::dominates(const Value *DefV, const Use &U) const {
|
||||
const Instruction *Def = dyn_cast<Instruction>(DefV);
|
||||
if (!Def) {
|
||||
assert(!isa<BasicBlock>(DefV) && "Should not be called with basic blocks");
|
||||
return true; // Arguments, constants, globals dominate everything.
|
||||
assert((isa<Argument>(DefV) || isa<Constant>(DefV)) &&
|
||||
"Should be called with an instruction, argument or constant");
|
||||
return true; // Arguments and constants dominate everything.
|
||||
}
|
||||
|
||||
Instruction *UserInst = cast<Instruction>(U.getUser());
|
||||
|
|
Loading…
Reference in New Issue