mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-10-19 02:52:53 +02:00
[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
a827007b92
commit
edaf326d53
@ -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
Block a user