This is an archive of the discontinued LLVM Phabricator instance.

Remove unnecessary bitvector clear
Needs ReviewPublic

Authored by trentxintong on Apr 7 2017, 5:04 PM.

Details

Summary

Remove unnecessary bitvector clear.

Event Timeline

trentxintong created this revision.Apr 7 2017, 5:04 PM
davide added a subscriber: davide.Apr 10 2017, 12:37 PM

Can you add an assertion that the bitmap is empty/has no bits set at the beginning of the function?

My understanding is only 1 class DeadMachineInstructionElim object will be constructed and used for all the functions in the module by the pass manager. However the LivePhysRegs is re-assigned at the beginning of the runOnMachineFunction for every basic block. So the LivePhysRegs.clear() is really unnecessary.

@qcolombet Quentin, can you please take a look at this one?

qcolombet edited edge metadata.Jun 27 2017, 5:10 PM

Although this is correct, I don't think that is useful. We could add functionalities to this pass that would make use of that information (e.g., a dump method that we could call from the debugger anywhere in the program) and having the state being clean, seems like a good thing to me.

Unless I am mistaken, this shouldn't have any performance implication, so the clean state seems worth it.
Am I missing something?

Although this is correct, I don't think that is useful. We could add functionalities to this pass that would make use of that information (e.g., a dump method that we could call from the debugger anywhere in the program) and having the state being clean, seems like a good thing to me.

Unless I am mistaken, this shouldn't have any performance implication, so the clean state seems worth it.
Am I missing something?

I agree that the performance implication is small. I am not sure where you want to check for whether the state is clean or not.

Sorry, that one slipped through!

I agree that the performance implication is small. I am not sure where you want to check for whether the state is clean or not.

In the debugger for instance. Nevertheless, having a clean state at the end of a pass does not seem a bad thing to me.