[llvm] [SelectOpt] Add handling for Select-like operations. (PR #77284)

David Sherwood via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 15 07:20:51 PST 2024


================
@@ -129,6 +124,151 @@ class SelectOptimizeImpl {
     Scaled64 NonPredCost;
   };
 
+  /// SelectLike is an abstraction over SelectInst and other operations that can
+  /// act like selects. For example Or(Zext(icmp), X) can be treated like
+  /// select(icmp, X|1, X).
+  class SelectLike {
+  private:
+    SelectLike(Instruction *SI) : SI(SI) {}
+
+    Instruction *SI;
----------------
david-arm wrote:

The name, and the routines below (getSI, etc.) do suggest that this is a SelectInst so could that be a little confusing? I don't know what the alternative would be though - perhaps SLI (Select-Like Instruction) or even just `I`?

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


More information about the llvm-commits mailing list