abg-ir.cc: Refactor operator== methods with helper function
Many of the operator== definitions in this source file follow the same
pattern:
- First, canonical comparison is attempted if canonical types are
present.
- Otherwise, the comparison is performed structurally using the
'equals' function.
This commit refactors the common logic into a templated helper
function named "try_canonical_compare".