[PATCH] D83598: [X86] Fix two places that appear to misuse peekThroughOneUseBitcasts
Craig Topper via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Jul 10 16:52:12 PDT 2020
craig.topper created this revision.
craig.topper added reviewers: llvm-commits, spatel.
Herald added a subscriber: hiraditya.
Herald added a project: LLVM.
peekThroughOneUseBitcasts checks the use count of the operand of the bitcast. Not the bitcast itself. So I think that means we need to do any outside haseOneUse checks before calling the function not after.
I was working on another patch where I misused the function and did a very quick audit to see if I there were other similar mistakes.
https://reviews.llvm.org/D83598
Files:
llvm/lib/Target/X86/X86ISelLowering.cpp
Index: llvm/lib/Target/X86/X86ISelLowering.cpp
===================================================================
--- llvm/lib/Target/X86/X86ISelLowering.cpp
+++ llvm/lib/Target/X86/X86ISelLowering.cpp
@@ -36461,9 +36461,9 @@
(V.getOpcode() == X86ISD::PSHUFLW ||
V.getOpcode() == X86ISD::PSHUFHW) &&
V.getOpcode() != N.getOpcode() &&
- V.hasOneUse()) {
+ V.hasOneUse() && V.getOperand(0).hasOneUse()) {
SDValue D = peekThroughOneUseBitcasts(V.getOperand(0));
- if (D.getOpcode() == X86ISD::PSHUFD && D.hasOneUse()) {
+ if (D.getOpcode() == X86ISD::PSHUFD) {
SmallVector<int, 4> VMask = getPSHUFShuffleMask(V);
SmallVector<int, 4> DMask = getPSHUFShuffleMask(D);
int NOffset = N.getOpcode() == X86ISD::PSHUFLW ? 0 : 4;
@@ -36900,10 +36900,11 @@
// insert into a zero vector. This helps get VZEXT_MOVL closer to
// scalar_to_vectors where 256/512 are canonicalized to an insert and a
// 128-bit scalar_to_vector. This reduces the number of isel patterns.
- if (N->getOpcode() == X86ISD::VZEXT_MOVL && !DCI.isBeforeLegalizeOps()) {
+ if (N->getOpcode() == X86ISD::VZEXT_MOVL && !DCI.isBeforeLegalizeOps() &&
+ N->getOperand(0).hasOneUse()) {
SDValue V = peekThroughOneUseBitcasts(N->getOperand(0));
- if (V.getOpcode() == ISD::INSERT_SUBVECTOR && V.hasOneUse() &&
+ if (V.getOpcode() == ISD::INSERT_SUBVECTOR &&
V.getOperand(0).isUndef() && isNullConstant(V.getOperand(2))) {
SDValue In = V.getOperand(1);
MVT SubVT =
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D83598.277168.patch
Type: text/x-patch
Size: 1554 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200710/81c3bb36/attachment.bin>
More information about the llvm-commits
mailing list