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

Sebastian Pop via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 12 18:43:59 PDT 2016


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 --------------
A non-text attachment was scrubbed...
Name: D25542.74465.patch
Type: text/x-patch
Size: 767 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20161013/68517d46/attachment.bin>


More information about the llvm-commits mailing list