[llvm] [GlobalIsel] combine extract vector element (PR #91922)
Matt Arsenault via llvm-commits
llvm-commits at lists.llvm.org
Mon May 13 02:40:32 PDT 2024
Thorsten =?utf-8?q?Schütt?= <schuett at gmail.com>
Message-ID:
In-Reply-To: <llvm.org/llvm/llvm-project/pull/91922 at github.com>
================
@@ -453,3 +453,162 @@ bool CombinerHelper::matchInsertVectorElementOOB(MachineInstr &MI,
return false;
}
+
+bool CombinerHelper::isConstantAtOffset(Register Src, const APInt &Index,
+ unsigned Depth) {
+ assert(MRI.getType(Src).isVector() && "expected a vector as input");
+ if (Depth == 2)
+ return false;
+
+ // We use the look through variant for higher hit rate and to increase the
+ // likelyhood of constant folding. The actual value is ignored. We only test
+ // *whether* there is a constant.
+
+ MachineInstr *SrcMI = getDefIgnoringCopies(Src, MRI);
----------------
arsenm wrote:
But this should be taken care of by copy->copy folding? I think we should mostly be removing all the getDefIgnoringCopies calls
https://github.com/llvm/llvm-project/pull/91922
More information about the llvm-commits
mailing list