[LLVMbugs] [Bug 6338] New: LegalizeDag: ExpandVectorBuildThroughStack incorrectly compares value types causing getTruncStore to assert .

bugzilla-daemon at cs.uiuc.edu bugzilla-daemon at cs.uiuc.edu
Wed Feb 17 18:23:51 PST 2010


http://llvm.org/bugs/show_bug.cgi?id=6338

           Summary: LegalizeDag:ExpandVectorBuildThroughStack incorrectly
                    compares value types causing getTruncStore to assert.
           Product: libraries
           Version: trunk
          Platform: PC
        OS/Version: Windows NT
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Common Code Generator Code
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: micah.villmow at amd.com
                CC: llvmbugs at cs.uiuc.edu


ExpandVectorBuildThroughStack is checking when to truncate or just to store.
For example, @ line 1539 there is a check if (EltVT.bitsLT(OpVT)) which checks
if the bitsize of the value type operand is larger than the bitsize of the
element. This is incorrect and it needs to compare the result of
EltVT.bitsLT(OpVT.getScalarType()).

In this specific example, the output of Concat_vector is a v4i32 and the input
arguments are 2 v2i32.
So, looking at this section of code:
EVT VT = Node->getValueType(0);
EVT OpVT = Node->getOperand(0).getValueType();
EVT EltVT = VT.getVectorElementType();

And this instruction
V4i32 = concat_vector v2i32 v2i32

VT = v4i32
OpVT = v2i32
EltVT = i32

OpVT.getTypeSizeInBits() = 64
EltVT.getTypeSizeInBits() = 32

The only time the if conditional will return false is when the first operand is
a scalar assuming the base types are equal. In every other case it will return
true. This is wrong.

This is why it is wrong. The getTruncStore function in argument three gets
Node->getOperand(i) and the sevent argument gets EltVT get mapped eventually to
Val/SVT respectively.

In the assert(SVT.getScalarType().bitsLT(VT.getScalarType()) && …);

SVT is a v2i32, scalar type returns an i32
VT is a i32, scalar type returns itself, an i32, so we assert.

We have contradicting conditionals. Either the assert is wrong or the condition
to call getTruncStore is wrong. I assert that the conditional to call
getTruncStore is incorrect.

The correct condition should be
If (EltVT.bitsLT(Node->getOperand(i).getValueType().getScalarType()))


-- 
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