[llvm] [X86] Fix duplicated compute in recursive search. (PR #130226)
Phoebe Wang via llvm-commits
llvm-commits at lists.llvm.org
Thu Mar 6 22:16:15 PST 2025
================
@@ -44745,31 +44746,59 @@ bool X86TargetLowering::isSplatValueForTargetNode(SDValue Op,
// Helper to peek through bitops/trunc/setcc to determine size of source vector.
// Allows combineBitcastvxi1 to determine what size vector generated a <X x i1>.
-static bool checkBitcastSrcVectorSize(SDValue Src, unsigned Size,
- bool AllowTruncate) {
+static bool
+checkBitcastSrcVectorSize(SDValue Src, unsigned Size, bool AllowTruncate,
+ std::map<std::tuple<SDValue, unsigned, bool>, bool>
+ &BitcastSrcVectorSizeMap) {
+ auto Tp = std::make_tuple(Src, Size, AllowTruncate);
+ if (BitcastSrcVectorSizeMap.count(Tp))
+ return BitcastSrcVectorSizeMap[Tp];
switch (Src.getOpcode()) {
case ISD::TRUNCATE:
- if (!AllowTruncate)
+ if (!AllowTruncate) {
+ BitcastSrcVectorSizeMap[Tp] = false;
----------------
phoebewang wrote:
How about define a `bool Result = false;` to avoid repeat `BitcastSrcVectorSizeMap[Tp] =`?
https://github.com/llvm/llvm-project/pull/130226
More information about the llvm-commits
mailing list