<div dir="ltr">Yup.<div>Thanks!</div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Oct 12, 2016 at 8:30 PM, Sebastian Pop <span dir="ltr"><<a href="mailto:sebpop@gmail.com" target="_blank">sebpop@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">On Wed, Oct 12, 2016 at 10:26 PM, Daniel Berlin <<a href="mailto:dberlin@dberlin.org">dberlin@dberlin.org</a>> wrote:<br>
> You can get rid of UseInst too, MemoryLocOrCall will take a MemoryUse<br>
> directly :)<br>
<br>
</span>Yes if I add the "const MU" to the class, like so:<br>
<br>
diff --git a/lib/Transforms/Utils/<wbr>MemorySSA.cpp<br>
b/lib/Transforms/Utils/<wbr>MemorySSA.cpp<br>
index 03faffd..b02a3f5 100644<br>
--- a/lib/Transforms/Utils/<wbr>MemorySSA.cpp<br>
+++ b/lib/Transforms/Utils/<wbr>MemorySSA.cpp<br>
@@ -105,6 +105,8 @@ public:<br>
   MemoryLocOrCall() : IsCall(false) {}<br>
   MemoryLocOrCall(MemoryUseOrDef *MUD)<br>
       : MemoryLocOrCall(MUD-><wbr>getMemoryInst()) {}<br>
+  MemoryLocOrCall(const MemoryUseOrDef *MUD)<br>
+      : MemoryLocOrCall(MUD-><wbr>getMemoryInst()) {}<br>
<br>
   MemoryLocOrCall(Instruction *Inst) {<br>
     if (ImmutableCallSite(Inst)) {<br>
@@ -269,8 +271,7 @@ static bool instructionClobbersQuery(<wbr>MemoryDef<br>
*MD, const MemoryUseOrDef *MU,<br>
<span class=""> // Return true when MD may alias MU, return false otherwise.<br>
 bool defClobbersUseOrDef(MemoryDef *MD, const MemoryUseOrDef *MU,<br>
                          AliasAnalysis &AA) {<br>
</span>-  return instructionClobbersQuery(MD, MU, MemoryLocOrCall(MU-><wbr>getMemoryInst()),<br>
-                                  AA);<br>
+  return instructionClobbersQuery(MD, MU, MemoryLocOrCall(MU), AA);<br>
<div class="HOEnZb"><div class="h5"> }<br>
 }<br>
<br>
<br>
<br>
><br>
><br>
> On Wed, Oct 12, 2016 at 8:20 PM, Sebastian Pop <<a href="mailto:sebpop@gmail.com">sebpop@gmail.com</a>> wrote:<br>
>><br>
>> On Wed, Oct 12, 2016 at 10:05 PM, Daniel Berlin <<a href="mailto:dberlin@dberlin.org">dberlin@dberlin.org</a>><br>
>> wrote:<br>
>> > There is actually a much simpler fix you sholdl use.<br>
>> ><br>
>> > return instructionClobbersQuery(MD, MU MemoryLocOrCall(MU), AA);<br>
>> ><br>
>> > You need to move that version of instructionClobbersQuery up, but it was<br>
>> > built to always do the right thing.<br>
>> ><br>
>> > Also note it will properly handle a case you are not: Fences do not have<br>
>> > memorylocations, and calling get on them will also crash.<br>
>> ><br>
>><br>
>> Right. I will commit the attached patch after testing.<br>
>><br>
>> Thanks,<br>
>> Sebastian<br>
><br>
><br>
</div></div></blockquote></div><br></div>