[PATCH] D51988: [PowerPC] Folding XForm to DForm loads requires alignment for some DForm loads.

Stefan Pintilie via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 12 07:28:36 PDT 2018


stefanp created this revision.
stefanp added reviewers: nemanjai, kbarton, hfinkel, syzaara, sfertile, lei.
Herald added a subscriber: hiraditya.

Going from LDX to LD requires that the LDX be word aligned in the first place. This is a requirement of the LD instruction bot not of the LDX instruction. If we are not word aligned we must leave the load as LDX.
This bug is causing a compile-time failure in the benchmark h264ref.


https://reviews.llvm.org/D51988

Files:
  llvm/lib/Target/PowerPC/PPCInstrInfo.cpp


Index: llvm/lib/Target/PowerPC/PPCInstrInfo.cpp
===================================================================
--- llvm/lib/Target/PowerPC/PPCInstrInfo.cpp
+++ llvm/lib/Target/PowerPC/PPCInstrInfo.cpp
@@ -3063,6 +3063,11 @@
   RegMO = &DefMI.getOperand(1);
   ImmMO = &DefMI.getOperand(2);
 
+  // Going from XForm to DForm loads means that the load must be word aligned.
+  // XForm loads do not have this restriction.
+  if (ImmMO->isGlobal() && ImmMO->getGlobal()->getAlignment() < 4)
+    return false;
+
   // This DefMI is elgible for forwarding if it is:
   // 1. add inst
   // 2. one of the operands is Imm/CPI/Global.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D51988.165082.patch
Type: text/x-patch
Size: 633 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180912/9e0f1ca7/attachment.bin>


More information about the llvm-commits mailing list