ir_opt/verification_pass: Eliminate redundant GetArg()
Given the same argument is used inside the condition's body if it's true, we can just utilize the local to cut out a GetArg() operation. Avoids redundant internal assertion checking.
This commit is contained in:
parent
f4990a5f6b
commit
fc9c59d056
1 changed files with 3 additions and 2 deletions
|
@ -31,8 +31,9 @@ void VerificationPass(const IR::Block& block) {
|
||||||
std::map<IR::Inst*, size_t> actual_uses;
|
std::map<IR::Inst*, size_t> actual_uses;
|
||||||
for (const auto& inst : block) {
|
for (const auto& inst : block) {
|
||||||
for (size_t i = 0; i < inst.NumArgs(); i++) {
|
for (size_t i = 0; i < inst.NumArgs(); i++) {
|
||||||
if (!inst.GetArg(i).IsImmediate()) {
|
const auto arg = inst.GetArg(i);
|
||||||
actual_uses[inst.GetArg(i).GetInst()]++;
|
if (!arg.IsImmediate()) {
|
||||||
|
actual_uses[arg.GetInst()]++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue