This is an archive of the discontinued LLVM Phabricator instance.

Fix bug in memdep's load clobber analysis
AbandonedPublic

Authored by dberlin on Mar 12 2015, 9:20 AM.

Details

Reviewers
nlewycky
hfinkel
Summary

This patch fixes a currently untriggerable bug in GVN.
In particular, GVN happily calls analyzeLoadFromLoadClobber on any loads given to it by MemDep.
It is supposed to be doing legality checking as to whether it can widen the load.
In particular, it can only widen overaligned integer loads.
The first function it calls in analyzeLoadFromClobberingLoad has no idea this is the case,
and is just being asked to give an offset inside of the load.
It will happily say "sure, we can coerce this load" even when it requires widening.

It has code to check the legality (below the current code), that does in fact, check that it will
later be able to widen it, but this does not get called in a lot of cases

The reason this is untriggerable is because, due to the incestuous relationship GVN has with memdep, memdep
does some GVN legality checking before deciding something is a clobber, because it knows what GVN can widen.
(IE it checks whether it is an overaligned, integer load.)
Whether memdep should do this, etc, not going to fix in this fix.

This bug was found by reusing this code in something that doesn't use memdep :)

Diff Detail

Event Timeline

dberlin retitled this revision from to Fix bug in memdep's load clobber analysis.
dberlin updated this object.
dberlin edited the test plan for this revision. (Show Details)
dberlin added reviewers: hfinkel, nlewycky.
dberlin added a subscriber: Unknown Object (MLST).
dberlin abandoned this revision.Jul 6 2016, 9:24 PM