[LLVMdev] Possible error in LegalizeDAG

Villmow, Micah Micah.Villmow at amd.com
Wed Feb 18 10:14:12 PST 2009


I'm still trying to track down some alignment issues with loads(i.e.
8/16 bit loads being turned into 32bit sign extending loads) and I
cannot for the life of me seem to figure out how to enter this section
of code:

// If this is an unaligned load and the target doesn't support it,

            // expand it.

            if (!TLI.allowsUnalignedMemoryAccesses()) {

              unsigned ABIAlignment = TLI.getTargetData()->

                getABITypeAlignment(LD->getMemoryVT().getTypeForMVT());

              if (LD->getAlignment() < ABIAlignment){

                Result =
ExpandUnalignedLoad(cast<LoadSDNode>(Result.getNode()), DAG,

                                             TLI);

                Tmp1 = Result.getOperand(0);

                Tmp2 = Result.getOperand(1);

                Tmp1 = LegalizeOp(Tmp1);

                Tmp2 = LegalizeOp(Tmp2);

              }

            }

This is from LegalizeDAG.cpp:2146

 

The problem that I see is that LD->getAlignment() is set via the call
getMVTAlignment(VT) in SelectionDAG.cpp:3385, which in turn calls
TLI.getTargetData()->getABITypeAlignment(Ty).

 

So, the statement if (LD->getALignment() < ABIAlignment) always fails
from what I can see. Even if I set in my DataLayout that i8 should have
a 32bit ABI alignment, this does not work because the load alignment is
set to the ABI alignment instead of being set based on the actual bit
size. 

 

 

Any hints would be greatly appreciated, this is a blocking issue that I
just cannot seem to resolve without modifying the LLVM codebase to
remove the extend + load -> extload combining step.

 

Micah Villmow

Systems Engineer

Advanced Technology & Performance

Advanced Micro Devices Inc.

S1-609 One AMD Place

Sunnyvale, CA. 94085

P: 408-749-3966

 

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20090218/2d66731f/attachment.html>


More information about the llvm-dev mailing list