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:
Lioncash 2019-05-04 19:07:41 -04:00
parent 161f0ba2fa
commit bd0ed7ee79
No known key found for this signature in database
GPG Key ID: 4E3C3CC1031BA9C7

View File

@ -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()]++;
}
}
}