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

David Green via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 17 06:56:11 PST 2024


================
@@ -1023,8 +1176,8 @@ SmallPtrSet<const Instruction *, 2>
 SelectOptimizeImpl::getSIset(const SelectGroups &SIGroups) {
   SmallPtrSet<const Instruction *, 2> SIset;
   for (const SelectGroup &ASI : SIGroups)
-    for (const SelectInst *SI : ASI)
-      SIset.insert(SI);
+    for (SelectLike SI : ASI)
----------------
davemgreen wrote:

I was trying to keep SelectLike deliberately small - just a single pointer in size. That should allow us to use it like a pointer, and passing by reference may mean more overhead than passing by value. The same goes for adding it to arrays and maps, where it's hopefully small enough to be the same size as the existing pointer.

I can change it if you like though - the compiler will likely optimize it in either case. Let me know.

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


More information about the llvm-commits mailing list