[PATCH] D25542: GVN-hoist: avoid calling MemoryLocation::get() on a call (PR30499)

Daniel Berlin via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 12 20:05:59 PDT 2016


There is actually a much simpler fix you sholdl use.

return instructionClobbersQuery(MD, MU MemoryLocOrCall(MU), AA);

You need to move that version of instructionClobbersQuery up, but it was
built to always do the right thing.

Also note it will properly handle a case you are not: Fences do not have
memorylocations, and calling get on them will also crash.



On Wed, Oct 12, 2016 at 6:43 PM, Sebastian Pop <sebpop at gmail.com> wrote:

> sebpop created this revision.
> sebpop added a reviewer: dberlin.
> sebpop added a subscriber: llvm-commits.
>
> For some reason in the cleanup or in the change I did to use the
> MemorySSA.cpp interface, I introduced more calls to MemoryLocation::get()
> without checking whether the instruction was a call.
> I will apply this patch on top of yesterday's fix (that got reverted.)
> This should fix the ICE in Chromium builds.
>
>
> https://reviews.llvm.org/D25542
>
> Files:
>   lib/Transforms/Utils/MemorySSA.cpp
>
>
> Index: lib/Transforms/Utils/MemorySSA.cpp
> ===================================================================
> --- lib/Transforms/Utils/MemorySSA.cpp
> +++ lib/Transforms/Utils/MemorySSA.cpp
> @@ -257,8 +257,13 @@
>  // Return true when MD may alias MU, return false otherwise.
>  bool defClobbersUseOrDef(MemoryDef *MD, const MemoryUseOrDef *MU,
>                           AliasAnalysis &AA) {
> -  Instruction *Insn = MU->getMemoryInst();
> -  return instructionClobbersQuery(MD, MemoryLocation::get(Insn), Insn,
> AA);
> +  Instruction *UseInst = MU->getMemoryInst();
> +  MemoryLocation UseLoc;
> +  if (ImmutableCallSite(UseInst))
> +    UseLoc = MemoryLocation();
> +  else
> +    UseLoc = MemoryLocation::get(UseInst);
> +  return instructionClobbersQuery(MD, UseLoc, UseInst, AA);
>  }
>  }
>
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20161012/4bd6cb2e/attachment.html>


More information about the llvm-commits mailing list