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

Jonas Paulsson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 5 06:40:50 PDT 2017


jonpa added a comment.

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

> In https://reviews.llvm.org/D31609#718978, @uweigand wrote:
>
> > Ah, I think the problem is simply that this piece of code in lowerBITCAST does not expect to be handling extending loads at all, and does the wrong thing for them.  It probably just should verify this, and fall through to the rest of the code if the load is actually an extending one ...
>
>
> This seems reasonable. We can change line 2794 to check isNormalLoad(N) and from my quick look at SystemZISelLowering it looks like Extended Loads have no direct realization.


Yes - I just tried

- return DAG.getLoad(ResVT, DL, LoadN->getChain(), LoadN->getBasePtr(),
- LoadN->getMemOperand());

+    if (LoadN->getExtensionType() == ISD::NON_EXTLOAD)
+      return DAG.getLoad(ResVT, DL, LoadN->getChain(), LoadN->getBasePtr(),
+                         LoadN->getMemOperand());

And also had to add the -mcpu=zEC12 to the test (at least on my x86 laptop):
+; RUN: llc -mtriple=s390x-linux-gnu -mcpu=zEC12 -o - %s | FileCheck %s

We should basically not get a new Load SDNode if the load is extending.

/Jonas


https://reviews.llvm.org/D31609





More information about the llvm-commits mailing list