[llvm] [GlobalIsel] Combine logic of icmps (PR #77855)

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 11 20:16:40 PST 2024


================
@@ -6643,3 +6644,178 @@ bool CombinerHelper::matchSelect(MachineInstr &MI, BuildFnTy &MatchInfo) {
 
   return false;
 }
+
+/// Fold (icmp Pred1 V1, C1) && (icmp Pred2 V2, C2)
+/// or   (icmp Pred1 V1, C1) || (icmp Pred2 V2, C2)
+/// into a single comparison using range-based reasoning.
+/// see InstCombinerImpl::foldAndOrOfICmpsUsingRanges.
----------------
arsenm wrote:

I'd think this would be possible just using tablegen patterns? Is there a way to plug the trickier ConstantRange handling at the end of the precondition into a mostly-tablegened pattern @Pierre-vh 

https://github.com/llvm/llvm-project/pull/77855


More information about the llvm-commits mailing list