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
161f0ba2fa
commit
bd0ed7ee79
@ -33,8 +33,9 @@ void VerificationPass(const IR::Block& block) {
|
||||
for (const auto& inst : block) {
|
||||
const size_t num_args = inst.NumArgs();
|
||||
for (size_t i = 0; i < num_args; i++) {
|
||||
if (!inst.GetArg(i).IsImmediate()) {
|
||||
actual_uses[inst.GetArg(i).GetInst()]++;
|
||||
const auto arg = inst.GetArg(i);
|
||||
if (!arg.IsImmediate()) {
|
||||
actual_uses[arg.GetInst()]++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user