Does Proguard use Common Subexpression Elimination optimization

Hey, I was wondering if Proguard uses the Common Subexpresison Elimination optimization. It’s a fast, useful optimization but I didn’t see it noted in any of the documentation and the source code doesn’t have anything that is neatly labeled with this name.

Hi @justinwei,

Thanks for asking this question! ProGuard does not perform traditional CSE, but we do publish a full list of the optimizations we perform here: ProGuard Manual: Optimizations | Guardsquare.

To expand on this a bit;

  • There are some steps in the optimization passes that would be handled by typical CSE implementations; Referred to as code merging.
  • Code Merging removes some common code in branch targets.

I hope this helps, and have a great day!
Jesse