Skip to content
Snippets Groups Projects
Commit 9bf8d530 authored by Simon Peyton Jones's avatar Simon Peyton Jones Committed by Marge Bot
Browse files

Eliminate unnecessary unsafeEqualityProof

This patch addresses #20143, which wants to discard unused calls to
unsafeEqualityProof.

There are two parts:

* In exprOkForSideEffects, we want to know that unsafeEqualityProof
  indeed terminates, without any exceptions etc

* But we can only discard the case if we know that the coercion
  variable is not used, which means we have to gather accurate
  occurrence info for CoVars.  Previously OccurAnal only did a half
  hearted job of doing so; this patch finishes the job.

  See Note [Gather occurrences of coercion variables] in OccurAnal.

Because the occurrence analyser does more work, there is a small
compile-time cost but it's pretty small.  The compiler perf tests
are usually 0.0% but occasionally up to 0.3% increase.  I'm just
going to accept this -- gathering accurate occurrence information
really seems like the Right Thing to do.

There is an increase in `compile_time/peak_megabytes_allocated`, for
T11545, or around 14%; but I can't reproduce it on my machine (it's
the same before and after), and the peak-usage stats are vulnerable to
when exactly the GC takes place, so I'm just going to accept it.

Metric Increase:
    T11545
parent 6d2846f7
No related branches found
No related tags found
No related merge requests found
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment