[llvm] 3c9123a - [X86] isShuffleFoldableLoad - ensure the load has one use.

Simon Pilgrim via llvm-commits llvm-commits at lists.llvm.org
Sat Jun 18 06:52:09 PDT 2022


Author: Simon Pilgrim
Date: 2022-06-18T14:51:55+01:00
New Revision: 3c9123af9fdd475a2827586424df7acecc738e09

URL: https://github.com/llvm/llvm-project/commit/3c9123af9fdd475a2827586424df7acecc738e09
DIFF: https://github.com/llvm/llvm-project/commit/3c9123af9fdd475a2827586424df7acecc738e09.diff

LOG: [X86] isShuffleFoldableLoad - ensure the load has one use.

We'll only fold the load if has one use. Makes no difference to existing tests but will be necessary for an upcoming patch to improve load folding as part of canonicalizeShuffleWithBinOps.

Added: 
    

Modified: 
    llvm/lib/Target/X86/X86ISelLowering.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Target/X86/X86ISelLowering.cpp b/llvm/lib/Target/X86/X86ISelLowering.cpp
index 17f64d3d39b39..e0ac61c055e4f 100644
--- a/llvm/lib/Target/X86/X86ISelLowering.cpp
+++ b/llvm/lib/Target/X86/X86ISelLowering.cpp
@@ -14064,8 +14064,8 @@ static SDValue getScalarValueForVectorElement(SDValue V, int Idx,
 /// This is particularly important because the set of instructions varies
 /// significantly based on whether the operand is a load or not.
 static bool isShuffleFoldableLoad(SDValue V) {
-  V = peekThroughBitcasts(V);
-  return ISD::isNON_EXTLoad(V.getNode());
+  return V->hasOneUse() &&
+         ISD::isNON_EXTLoad(peekThroughOneUseBitcasts(V).getNode());
 }
 
 /// Try to lower insertion of a single element into a zero vector.


        


More information about the llvm-commits mailing list