Quoting Michael Matz <m...@suse.de>:
So, first the potentially clobbering write, then the read. And indeed in check_dependence d->exp is the write and x the read that is potentially clobbered.
Oops, you are right. I got confused because what is X in cse.c:invalidate ends up as d->exp in cse.c:check_dependence, and what is &p->canon_exp in cse.c:invalidate ends up as X in cse.c:check_dependence. I was a bit puzzled why we could have a STRICT_LOW_PART for MEM. Now it makes more sense. I also see now that both the read expression from the hash table and the write address are canonicalized, so if we have a canon_* interface, we want to use both.
Generally I would prefer simple interfaces to the query functions, dependence problems are hard enough to think about without functions needing four arguments. Does it really save much to not canonicalize the mem address for some calls?
I haven't measured it myself, but I suppose it must be there for a good reason.
Of course a simpler interface would be nice, however... When cse encounters a write, it goes through the entire hash table of expressions and checks dependencies. So for (extended?) basic blocks with lots of expressions & writes, we got O(n^2) dependency checks.