[llvm-commits] [llvm] r45167 - in /llvm/trunk: lib/CodeGen/SelectionDAG/SelectionDAG.cpp test/CodeGen/X86/2007-12-18-LoadCSEBug.ll

Evan Cheng evan.cheng at apple.com
Tue Dec 18 11:38:14 PST 2007


Author: evancheng
Date: Tue Dec 18 13:38:14 2007
New Revision: 45167

URL: http://llvm.org/viewvc/llvm-project?rev=45167&view=rev
Log:
Fix PR1872: SrcValue and SrcValueOffset should not be used to compute load / store node id.

Added:
    llvm/trunk/test/CodeGen/X86/2007-12-18-LoadCSEBug.ll
Modified:
    llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp

Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp?rev=45167&r1=45166&r2=45167&view=diff

==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Tue Dec 18 13:38:14 2007
@@ -372,8 +372,6 @@
     ID.AddInteger(LD->getAddressingMode());
     ID.AddInteger(LD->getExtensionType());
     ID.AddInteger((unsigned int)(LD->getLoadedVT()));
-    ID.AddPointer(LD->getSrcValue());
-    ID.AddInteger(LD->getSrcValueOffset());
     ID.AddInteger(LD->getAlignment());
     ID.AddInteger(LD->isVolatile());
     break;
@@ -383,8 +381,6 @@
     ID.AddInteger(ST->getAddressingMode());
     ID.AddInteger(ST->isTruncatingStore());
     ID.AddInteger((unsigned int)(ST->getStoredVT()));
-    ID.AddPointer(ST->getSrcValue());
-    ID.AddInteger(ST->getSrcValueOffset());
     ID.AddInteger(ST->getAlignment());
     ID.AddInteger(ST->isVolatile());
     break;
@@ -639,16 +635,12 @@
     ID.AddInteger(LD->getAddressingMode());
     ID.AddInteger(LD->getExtensionType());
     ID.AddInteger((unsigned int)(LD->getLoadedVT()));
-    ID.AddPointer(LD->getSrcValue());
-    ID.AddInteger(LD->getSrcValueOffset());
     ID.AddInteger(LD->getAlignment());
     ID.AddInteger(LD->isVolatile());
   } else if (const StoreSDNode *ST = dyn_cast<StoreSDNode>(N)) {
     ID.AddInteger(ST->getAddressingMode());
     ID.AddInteger(ST->isTruncatingStore());
     ID.AddInteger((unsigned int)(ST->getStoredVT()));
-    ID.AddPointer(ST->getSrcValue());
-    ID.AddInteger(ST->getSrcValueOffset());
     ID.AddInteger(ST->getAlignment());
     ID.AddInteger(ST->isVolatile());
   }
@@ -2330,8 +2322,6 @@
   ID.AddInteger(ISD::UNINDEXED);
   ID.AddInteger(ISD::NON_EXTLOAD);
   ID.AddInteger((unsigned int)VT);
-  ID.AddPointer(SV);
-  ID.AddInteger(SVOffset);
   ID.AddInteger(Alignment);
   ID.AddInteger(isVolatile);
   void *IP = 0;
@@ -2385,8 +2375,6 @@
   ID.AddInteger(ISD::UNINDEXED);
   ID.AddInteger(ExtType);
   ID.AddInteger((unsigned int)EVT);
-  ID.AddPointer(SV);
-  ID.AddInteger(SVOffset);
   ID.AddInteger(Alignment);
   ID.AddInteger(isVolatile);
   void *IP = 0;
@@ -2413,8 +2401,6 @@
   ID.AddInteger(AM);
   ID.AddInteger(LD->getExtensionType());
   ID.AddInteger((unsigned int)(LD->getLoadedVT()));
-  ID.AddPointer(LD->getSrcValue());
-  ID.AddInteger(LD->getSrcValueOffset());
   ID.AddInteger(LD->getAlignment());
   ID.AddInteger(LD->isVolatile());
   void *IP = 0;
@@ -2454,8 +2440,6 @@
   ID.AddInteger(ISD::UNINDEXED);
   ID.AddInteger(false);
   ID.AddInteger((unsigned int)VT);
-  ID.AddPointer(SV);
-  ID.AddInteger(SVOffset);
   ID.AddInteger(Alignment);
   ID.AddInteger(isVolatile);
   void *IP = 0;
@@ -2502,8 +2486,6 @@
   ID.AddInteger(ISD::UNINDEXED);
   ID.AddInteger(1);
   ID.AddInteger((unsigned int)SVT);
-  ID.AddPointer(SV);
-  ID.AddInteger(SVOffset);
   ID.AddInteger(Alignment);
   ID.AddInteger(isVolatile);
   void *IP = 0;
@@ -2529,8 +2511,6 @@
   ID.AddInteger(AM);
   ID.AddInteger(ST->isTruncatingStore());
   ID.AddInteger((unsigned int)(ST->getStoredVT()));
-  ID.AddPointer(ST->getSrcValue());
-  ID.AddInteger(ST->getSrcValueOffset());
   ID.AddInteger(ST->getAlignment());
   ID.AddInteger(ST->isVolatile());
   void *IP = 0;

Added: llvm/trunk/test/CodeGen/X86/2007-12-18-LoadCSEBug.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/2007-12-18-LoadCSEBug.ll?rev=45167&view=auto

==============================================================================
--- llvm/trunk/test/CodeGen/X86/2007-12-18-LoadCSEBug.ll (added)
+++ llvm/trunk/test/CodeGen/X86/2007-12-18-LoadCSEBug.ll Tue Dec 18 13:38:14 2007
@@ -0,0 +1,28 @@
+; RUN: llvm-as < %s | llc -march=x86 | grep {(%esp)} | count 2
+; PR1872
+
+	%struct.c34007g__designated___XUB = type { i32, i32, i32, i32 }
+	%struct.c34007g__pkg__parent = type { i32*, %struct.c34007g__designated___XUB* }
+
+define void @_ada_c34007g() {
+entry:
+	%x8 = alloca %struct.c34007g__pkg__parent, align 8		; <%struct.c34007g__pkg__parent*> [#uses=2]
+	%tmp1272 = getelementptr %struct.c34007g__pkg__parent* %x8, i32 0, i32 0		; <i32**> [#uses=1]
+	%x82167 = bitcast %struct.c34007g__pkg__parent* %x8 to i64*		; <i64*> [#uses=1]
+	br i1 true, label %bb4668, label %bb848
+
+bb4668:		; preds = %bb4648
+	%tmp5464 = load i64* %x82167, align 8		; <i64> [#uses=1]
+	%tmp5467 = icmp ne i64 0, %tmp5464		; <i1> [#uses=1]
+	%tmp5470 = load i32** %tmp1272, align 8		; <i32*> [#uses=1]
+	%tmp5471 = icmp eq i32* %tmp5470, null		; <i1> [#uses=1]
+	%tmp5475 = or i1 %tmp5471, %tmp5467		; <i1> [#uses=1]
+	%tmp5497 = or i1 %tmp5475, false		; <i1> [#uses=1]
+	br i1 %tmp5497, label %bb848, label %bb5507
+
+bb848:		; preds = %entry
+	ret void
+
+bb5507:		; preds = %bb4668
+	ret void
+}





More information about the llvm-commits mailing list