[llvm] d066080 - [X86] Fix aliasing check between TargetFrameIndex and FrameIndex

Nabeel Omer via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 17 02:48:26 PDT 2023


Author: Nabeel Omer
Date: 2023-08-17T10:48:08+01:00
New Revision: d06608060c8f9d315f98314372110b7b3473f1b3

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

LOG: [X86] Fix aliasing check between TargetFrameIndex and FrameIndex

Compare slot indices instead of comparing pointer values.

Closes #63645

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

Added: 
    

Modified: 
    llvm/lib/CodeGen/SelectionDAG/SelectionDAGAddressAnalysis.cpp
    llvm/test/CodeGen/X86/pr63645.ll

Removed: 
    


################################################################################
diff  --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGAddressAnalysis.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGAddressAnalysis.cpp
index a432d8e92bca5e..39a1e09e83c594 100644
--- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGAddressAnalysis.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGAddressAnalysis.cpp
@@ -130,7 +130,7 @@ bool BaseIndexOffset::computeAliasing(const SDNode *Op0,
       MachineFrameInfo &MFI = DAG.getMachineFunction().getFrameInfo();
       // If the base are the same frame index but the we couldn't find a
       // constant offset, (indices are 
diff erent) be conservative.
-      if (A != B && (!MFI.isFixedObjectIndex(A->getIndex()) ||
+      if (A->getIndex() != B->getIndex() && (!MFI.isFixedObjectIndex(A->getIndex()) ||
                      !MFI.isFixedObjectIndex(B->getIndex()))) {
         IsAlias = false;
         return true;

diff  --git a/llvm/test/CodeGen/X86/pr63645.ll b/llvm/test/CodeGen/X86/pr63645.ll
index c1e3d1224d4617..7ee418565ee634 100644
--- a/llvm/test/CodeGen/X86/pr63645.ll
+++ b/llvm/test/CodeGen/X86/pr63645.ll
@@ -17,6 +17,8 @@ define i32 @main() #1 {
 ; CHECK:       # %bb.0: # %entry
 ; CHECK-NEXT:    movl $0, c(%rip)
 ; CHECK-NEXT:    movq $64, p(%rip)
+; CHECK-NEXT:    movabsq $214787019555673, %rax # imm = 0xC3590000C359
+; CHECK-NEXT:    movq %rax, -{{[0-9]+}}(%rsp)
 ; CHECK-NEXT:    cmpl $42828, -{{[0-9]+}}(%rsp) # imm = 0xA74C
 ; CHECK-NEXT:    jg .LBB0_2
 ; CHECK-NEXT:  # %bb.1: # %if.then.1.i


        


More information about the llvm-commits mailing list