[PATCH] D87490: [MachineInstr] return mayAlias for not mayLoadOrStore instructions.

ChenZheng via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 10 21:25:55 PDT 2020


shchenz created this revision.
shchenz added reviewers: Kayjukh, efriedma, qcolombet, hfinkel.
Herald added subscribers: llvm-commits, hiraditya.
Herald added a project: LLVM.
shchenz requested review of this revision.

This is a typo fix for `bool MachineInstr::mayAlias()` function.

We should not call this function for not `mayLoadOrStore` instructions. But Iif we do so by mistake, we should return conservative value.

For example:
For now `mayAlias(CallInstruction, LoadInstruction)` always returns `false` (NoAlias), this is not right. `CallInstruction` may alert the memory where the LoadInstruction operates on.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D87490

Files:
  llvm/lib/CodeGen/MachineInstr.cpp


Index: llvm/lib/CodeGen/MachineInstr.cpp
===================================================================
--- llvm/lib/CodeGen/MachineInstr.cpp
+++ llvm/lib/CodeGen/MachineInstr.cpp
@@ -1241,7 +1241,7 @@
 
   // Both instructions must be memory operations to be able to alias.
   if (!mayLoadOrStore() || !Other.mayLoadOrStore())
-    return false;
+    return true;
 
   // Let the target decide if memory accesses cannot possibly overlap.
   if (TII->areMemAccessesTriviallyDisjoint(*this, Other))


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D87490.291123.patch
Type: text/x-patch
Size: 503 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200911/10dcf68e/attachment.bin>


More information about the llvm-commits mailing list