[llvm] [SimplifyCFG] Convert switch to cmp/select sequence (PR #82795)

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 10 03:25:40 PDT 2024


================
@@ -6197,6 +6197,268 @@ static bool trySwitchToSelect(SwitchInst *SI, IRBuilder<> &Builder,
   return true;
 }
 
+// The first field contains the value that the switch produces when a certain
+// case group is selected, and the second field is a vector containing the
+// cases composing the case group.
+using SwitchCaseResultVectorTy2 =
+    SmallVector<std::pair<Value *, SmallVector<Value *, 4>>, 2>;
+
+// The first field contains the phi node that generates a result of the switch
+// and the second field contains the value generated for a certain case in the
+// switch for that PHI.
+using SwitchCaseResultsTy2 = SmallVector<std::pair<PHINode *, Value *>, 4>;
----------------
arsenm wrote:

Something better than a "2" suffix on the name

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


More information about the llvm-commits mailing list