[llvm] [GlobalISel] Fold G_ICMP if possible (PR #86357)
Matt Arsenault via llvm-commits
llvm-commits at lists.llvm.org
Fri Mar 29 00:29:56 PDT 2024
================
@@ -174,6 +174,20 @@ MachineInstrBuilder CSEMIRBuilder::buildInstr(unsigned Opc,
switch (Opc) {
default:
break;
+ case TargetOpcode::G_ICMP: {
+ assert(SrcOps.size() == 3 && "Invalid sources");
+ assert(DstOps.size() == 1 && "Invalid dsts");
+ LLT SrcTy = SrcOps[1].getLLTTy(*getMRI());
+
+ if (std::optional<SmallVector<APInt>> Cst =
----------------
arsenm wrote:
I don't see the point of using APInt in this interface. You're discarding the used result type here, and then forcing it into a 1-bit APInt. Either preserve the original result type, or just return a bool?
https://github.com/llvm/llvm-project/pull/86357
More information about the llvm-commits
mailing list