[PATCH] D65094: [PowerPC] Combine address computation to favour selecting DForm instructions

Qing Shan Zhang via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 16 02:27:06 PDT 2019


steven.zhang requested changes to this revision.
steven.zhang added a comment.
This revision now requires changes to proceed.

We need to double check the base offset we select to avoid exceeding the 16-bit as much as possible



================
Comment at: lib/Target/PowerPC/PPCISelDAGToDAG.cpp:5655
+        SDLoc dl(Addr->getNode());
+        int64_t NewOffset =
+            cast<ConstantSDNode>(Addr->getOperand(1))->getSExtValue() -
----------------
If the offset exceed the 16-bit, we should try to scale it into 16-bit.
```
; Function Attrs: norecurse nounwind readonly
define dso_local signext i32 @foo(i8* nocapture readonly %p) local_unnamed_addr #0 {
entry:
  %add.ptr = getelementptr inbounds i8, i8* %p, i64 69340
  %0 = bitcast i8* %add.ptr to i32*
  %1 = load i32, i32* %0, align 4, !tbaa !2
  %add.ptr1 = getelementptr inbounds i8, i8* %p, i64 69344
  %2 = bitcast i8* %add.ptr1 to i32*
  %3 = load i32, i32* %2, align 4, !tbaa !2
  %cmp = icmp eq i32 %1, %3
  %conv = zext i1 %cmp to i32
  ret i32 %conv
}
``` 


Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D65094/new/

https://reviews.llvm.org/D65094





More information about the llvm-commits mailing list