[PATCH] D71833: [PowerPC] if value type is changed after folding rlwinm, stop folding
ChenZheng via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Dec 25 18:06:37 PST 2019
shchenz updated this revision to Diff 235309.
shchenz added a comment.
fix result mask MB > ME cases.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D71833/new/
https://reviews.llvm.org/D71833
Files:
llvm/lib/Target/PowerPC/PPCMIPeephole.cpp
llvm/test/CodeGen/PowerPC/fold-rlwinm.mir
Index: llvm/test/CodeGen/PowerPC/fold-rlwinm.mir
===================================================================
--- llvm/test/CodeGen/PowerPC/fold-rlwinm.mir
+++ llvm/test/CodeGen/PowerPC/fold-rlwinm.mir
@@ -77,6 +77,21 @@
BLR8 implicit $lr8, implicit $rm
...
---
+name: testFoldRLWINMResultWrapped
+#CHECK : name : testFoldRLWINMResultWrapped
+tracksRegLiveness: true
+body: |
+ bb.0.entry:
+ liveins: $x3
+ %0:g8rc = COPY $x3
+ %1:gprc = COPY %0.sub_32:g8rc
+ %2:gprc = RLWINM %1:gprc, 10, 20, 10
+ ; CHECK: %2:gprc = RLWINM %1, 10, 20, 10
+ %3:gprc = RLWINM %2:gprc, 10, 0, 31
+ ; CHECK: %3:gprc = RLWINM %2, 10, 0, 31
+ BLR8 implicit $lr8, implicit $rm
+...
+---
name: testFoldRLWINMMultipleUses
#CHECK : name : testFoldRLWINMMultipleUses
tracksRegLiveness: true
Index: llvm/lib/Target/PowerPC/PPCMIPeephole.cpp
===================================================================
--- llvm/lib/Target/PowerPC/PPCMIPeephole.cpp
+++ llvm/lib/Target/PowerPC/PPCMIPeephole.cpp
@@ -919,8 +919,12 @@
LLVM_DEBUG(dbgs() << "With: ");
LLVM_DEBUG(MI.dump());
- } else if (isRunOfOnes((unsigned)(FinalMask.getZExtValue()), NewMB,
- NewME) || SrcMaskFull) {
+ } else if ((isRunOfOnes((unsigned)(FinalMask.getZExtValue()), NewMB,
+ NewME) && NewMB <= NewME)|| SrcMaskFull) {
+ // Here we only handle MBMI <= MEMI cases, so NewMB must be not bigger
+ // than NewME. Otherwise we get a 64 bit value after folding, but MI
+ // return a 32 bit value.
+
// If FoldingReg has only one use and it it not RLWINMo and
// RLWINM8o, safe to delete its def SrcMI. Otherwise keep it.
if (MRI->hasOneNonDBGUse(FoldingReg) &&
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D71833.235309.patch
Type: text/x-patch
Size: 1799 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20191226/0ee32343/attachment.bin>
More information about the llvm-commits
mailing list