[PATCH] D31609: [SystemZ] Fix bitcast of load translation to preserve alignment.

Ulrich Weigand via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 4 08:54:49 PDT 2017


uweigand added a comment.

In https://reviews.llvm.org/D31609#718149, @niravd wrote:

> I was slightly incorrectl it's not the alignment. I mixed up the various getLoads in my tracing. It's an issue with offset. I just pulled the corresponding call from the visitBITCAST since it's doing the same operation.
>
> The original was indirectly calling:
>
>   SDValue getLoad(ISD::MemIndexedMode AM, ISD::LoadExtType ExtType, EVT VT,
>                     const SDLoc &dl, SDValue Chain, SDValue Ptr, SDValue Offset,
>                     EVT MemVT, MachineMemOperand *MMO);
>
> with Offset set to undef which seems wrong. I suspect it should be zero.


According to the comments and assertions in ::getLoad, Offset must be Undef for non-indexed loads.

> The new version calls:
> 
>   SDValue getLoad(EVT VT, const SDLoc &dl, SDValue Chain, SDValue Ptr,
>                    MachinePointerInfo PtrInfo, unsigned Alignment = 0,
>                    MachineMemOperand::Flags MMOFlags = MachineMemOperand::MONone,
>                    const AAMDNodes &AAInfo = AAMDNodes(),
>                    const MDNode *Ranges = nullptr);

This likewise forwards to another version of getLoad specifying an unindexed load and an Offset of Undef, so I'm afraid I still don't see any difference:

  SDValue SelectionDAG::getLoad(EVT VT, const SDLoc &dl, SDValue Chain,
                                SDValue Ptr, MachinePointerInfo PtrInfo,
                                unsigned Alignment,
                                MachineMemOperand::Flags MMOFlags,
                                const AAMDNodes &AAInfo, const MDNode *Ranges) {
    SDValue Undef = getUNDEF(Ptr.getValueType());
    return getLoad(ISD::UNINDEXED, ISD::NON_EXTLOAD, VT, dl, Chain, Ptr, Undef,
                   PtrInfo, VT, Alignment, MMOFlags, AAInfo, Ranges);
  }


I'm not trying to be difficult here :-)  I'd just like to understand what's going on to make sure there is no problem lurking with any of the other getLoad calls in the SystemZ back-end ...


https://reviews.llvm.org/D31609





More information about the llvm-commits mailing list