[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:12 PST 2024


================
@@ -945,7 +1103,7 @@ bool SelectOptimizeImpl::computeLoopCosts(
     // Cost of the loop's critical path.
     CostInfo &MaxCost = LoopCost[Iter];
     for (BasicBlock *BB : L->getBlocks()) {
-      for (const Instruction &I : *BB) {
+      for (Instruction &I : *BB) {
----------------
davemgreen wrote:

It is the SelectLike::match that takes a non-const pointer, as it should create a SelectLike and that SelectLike holds a non-const pointer to the instruction. I have tried to change SIset to a SImap so that it can get the existing SI without re-matching it. I'm not sure if that is a huge amount better, but we can keep the const and avoids having to re-match the SI again.

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


More information about the llvm-commits mailing list