This is an archive of the discontinued LLVM Phabricator instance.

GVN-hoist: disable hoisting stores past calls (PR30499)
AbandonedPublic

Authored by sebpop on Sep 22 2016, 2:35 PM.

Details

Reviewers
dberlin
Summary

MemoryLocation::get() does not support CallInst and it errors with llvm_unreachable("unsupported memory instruction");
The current patch avoids calling get() with CallInst.

Diff Detail

Event Timeline

sebpop updated this revision to Diff 72213.Sep 22 2016, 2:35 PM
sebpop retitled this revision from to GVN-hoist: disable hoisting stores past calls (PR30499).
sebpop updated this object.
sebpop added a reviewer: dberlin.
sebpop added a subscriber: llvm-commits.
dberlin edited edge metadata.Sep 22 2016, 2:48 PM

It also will not work for InvokeInst.

This is what the whole MemoryLocOrCall stuff does in MemorySSA.cpp.
You also need to handle fenceinst, etc

You can resolve this by using getModRefInfo, which has versions for calls and not calls

Just explose MemoryLocOrCall and InstructionClobbersQuery from MemorySSA for now and use that.

hfinkel added inline comments.
llvm/lib/Transforms/Scalar/GVNHoist.cpp
368

You could do something like:

if (AA->getModRef(Insn, DefLoc) != MRI_NoModRef)
  return true;

and that should handle calls.

sebpop abandoned this revision.Oct 11 2016, 7:50 AM