summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target/PowerPC/PPCISelLowering.cpp
diff options
context:
space:
mode:
authorNemanja Ivanovic <nemanja.i.ibm@gmail.com>2018-11-20 04:42:31 +0000
committerNemanja Ivanovic <nemanja.i.ibm@gmail.com>2018-11-20 04:42:31 +0000
commit9b393909e236b1ca314ce047ce28d39929a25688 (patch)
tree842125b2eefc533285ac7bf5e9ebf0b5bd42d21f /llvm/lib/Target/PowerPC/PPCISelLowering.cpp
parent4954c664307d56c5aa7ed400b3bac730bd71ddb9 (diff)
downloadbcm5719-llvm-9b393909e236b1ca314ce047ce28d39929a25688.tar.gz
bcm5719-llvm-9b393909e236b1ca314ce047ce28d39929a25688.zip
[PowerPC] Don't combine to bswap store on 1-byte truncating store
Turns out that there was no check for a store that truncates down to a single byte when combining a (store (bswap...)) into a byte-swapping store. This patch just adds that check. Fixes https://bugs.llvm.org/show_bug.cgi?id=39478. llvm-svn: 347288
Diffstat (limited to 'llvm/lib/Target/PowerPC/PPCISelLowering.cpp')
-rw-r--r--llvm/lib/Target/PowerPC/PPCISelLowering.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/llvm/lib/Target/PowerPC/PPCISelLowering.cpp b/llvm/lib/Target/PowerPC/PPCISelLowering.cpp
index bfdd08b69c2..62fac4bd910 100644
--- a/llvm/lib/Target/PowerPC/PPCISelLowering.cpp
+++ b/llvm/lib/Target/PowerPC/PPCISelLowering.cpp
@@ -12604,9 +12604,10 @@ SDValue PPCTargetLowering::PerformDAGCombine(SDNode *N,
(Op1VT == MVT::i32 || Op1VT == MVT::i16 ||
(Subtarget.hasLDBRX() && Subtarget.isPPC64() && Op1VT == MVT::i64))) {
- // STBRX can only handle simple types.
+ // STBRX can only handle simple types and it makes no sense to store less
+ // two bytes in byte-reversed order.
EVT mVT = cast<StoreSDNode>(N)->getMemoryVT();
- if (mVT.isExtended())
+ if (mVT.isExtended() || mVT.getSizeInBits() < 16)
break;
SDValue BSwapOp = N->getOperand(1).getOperand(0);
OpenPOWER on IntegriCloud