[llvm] ed46e84 - [MachineInstr] exclude call instruction in mayAlias

Chen Zheng via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 6 21:19:11 PDT 2020


Author: Chen Zheng
Date: 2020-10-07T00:12:21-04:00
New Revision: ed46e84c7aaffd847656ac559acb06089096ec33

URL: https://github.com/llvm/llvm-project/commit/ed46e84c7aaffd847656ac559acb06089096ec33
DIFF: https://github.com/llvm/llvm-project/commit/ed46e84c7aaffd847656ac559acb06089096ec33.diff

LOG: [MachineInstr] exclude call instruction in mayAlias

we now get noAlias result for a call instruction and other
load/store/call instructions if we query mayAlias.
This is not right as call instruction is not with mayloadorstore,
but it may alter the memory.

This patch fixes this wrong alias query.

Differential Revision: https://reviews.llvm.org/D87490

Added: 
    

Modified: 
    llvm/lib/CodeGen/MachineInstr.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/CodeGen/MachineInstr.cpp b/llvm/lib/CodeGen/MachineInstr.cpp
index ebae5eb380de..c5c3f8c1186e 100644
--- a/llvm/lib/CodeGen/MachineInstr.cpp
+++ b/llvm/lib/CodeGen/MachineInstr.cpp
@@ -1236,6 +1236,11 @@ bool MachineInstr::mayAlias(AAResults *AA, const MachineInstr &Other,
   const TargetInstrInfo *TII = MF->getSubtarget().getInstrInfo();
   const MachineFrameInfo &MFI = MF->getFrameInfo();
 
+  // Execulde call instruction which may alter the memory but can not be handled
+  // by this function.
+  if (isCall() || Other.isCall())
+    return true;
+
   // If neither instruction stores to memory, they can't alias in any
   // meaningful way, even if they read from the same address.
   if (!mayStore() && !Other.mayStore())


        


More information about the llvm-commits mailing list