[llvm-commits] [PATCH - ]Bug 10747 - miscompiled extractelement instruction

Rotem, Nadav nadav.rotem at intel.com
Sat Sep 24 02:07:00 PDT 2011


Hi Eli,

Please review the patch below, which addresses pr10747.

Thanks,
Nadav

Index: lib/CodeGen/SelectionDAG/DAGCombiner.cpp
===================================================================
--- lib/CodeGen/SelectionDAG/DAGCombiner.cpp  (revision 140246)
+++ lib/CodeGen/SelectionDAG/DAGCombiner.cpp  (working copy)
@@ -6929,9 +6929,15 @@
                            DAG.getConstant(PtrOff, PtrType));
     }

-    return DAG.getLoad(LVT, N->getDebugLoc(), LN0->getChain(), NewPtr,
-                       LN0->getPointerInfo().getWithOffset(PtrOff),
-                       LN0->isVolatile(), LN0->isNonTemporal(), Align);
+    SDValue Load =  DAG.getLoad(LVT, N->getDebugLoc(), LN0->getChain(),
+                           NewPtr,
+                           LN0->getPointerInfo().getWithOffset(PtrOff),
+                           LN0->isVolatile(), LN0->isNonTemporal(), Align);
+
+    WorkListRemover DeadNodes(*this);
+    DAG.ReplaceAllUsesOfValueWith(SDValue(LN0,1), Load.getValue(1), &DeadNodes);
+    DAG.ReplaceAllUsesOfValueWith(SDValue(N, 0), Load.getValue(0), &DeadNodes);
+    return SDValue(N, 0);
   }

   return SDValue();

Index: test/CodeGen/X86/vec_extract-sse4.ll
===================================================================
--- test/CodeGen/X86/vec_extract-sse4.ll        (revision 140246)
+++ test/CodeGen/X86/vec_extract-sse4.ll        (working copy)
@@ -2,7 +2,7 @@
; RUN: not grep extractps   %t
; RUN: not grep pextrd      %t
; RUN: not grep pshufd  %t
-; RUN: grep movss   %t | count 2
+; RUN: not grep movss   %t

define void @t1(float* %R, <4 x float>* %P1) nounwind {
        %X = load <4 x float>* %P1
---------------------------------------------------------------------
Intel Israel (74) Limited

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20110924/274ec105/attachment.html>


More information about the llvm-commits mailing list