[LLVMbugs] [Bug 9267] New: vector ZExt code generation bug

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Sat Feb 19 12:50:05 PST 2011


           Summary: vector ZExt code generation bug
           Product: libraries
           Version: trunk
          Platform: PC
        OS/Version: Windows NT
            Status: NEW
          Severity: normal
          Priority: P
         Component: Common Code Generator Code
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: nadav.rotem at intel.com
                CC: llvmbugs at cs.uiuc.edu

According to the LangRef, vector Zext are not supported by the spec. However,
we would like to enable them. Currently, most vector zext instructions would
crash the codegen in various places. For example:

llc: XXX/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:3914: llvm::SDValue
llvm::SelectionDAG::getLoad(llvm::ISD::MemIndexedMode, llvm::ISD::LoadExtType,
llvm::EVT, llvm::DebugLoc, llvm::SDValue, llvm::SDValue, llvm::SDValue,
llvm::EVT, llvm::MachineMemOperand*): Assertion `VT.isVector() ==
MemVT.isVector() && "Cannot use trunc store to convert to or from a vector!"'

vector zext is properly expanded to any_extend, except for cases where it is
combined with the load operation. The problem is with the DAGcombining pass. In
the first round, where it is okay to create illegal types and operations, it
creates a complex-zext load. The problem is that there is no legalizer to
legalize the newly load in the following stages. 

Here is a patch against 2.8. It works on a bunch of test cases that I

Index: DAGCombiner.cpp
--- DAGCombiner.cpp    (revision XXX)
+++ DAGCombiner.cpp    (working copy)
@@ -3685,8 +3685,7 @@

   // fold (zext (load x)) -> (zext (truncate (zextload x)))
   if (ISD::isNON_EXTLoad(N0.getNode()) &&
-      ((!LegalOperations && !cast<LoadSDNode>(N0)->isVolatile()) ||
-       TLI.isLoadExtLegal(ISD::ZEXTLOAD, N0.getValueType()))) {
+      (TLI.isLoadExtLegal(ISD::ZEXTLOAD, N0.getValueType()))) {
     bool DoXform = true;
     SmallVector<SDNode*, 4> SetCCs;
     if (!N0.hasOneUse())

Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.

More information about the llvm-bugs mailing list