[llvm] InstSimplify: lookthru casts, binops in folding shuffles (PR #92668)

Yingwei Zheng via llvm-commits llvm-commits at lists.llvm.org
Sun May 19 08:11:19 PDT 2024


================
@@ -48,7 +48,7 @@ using namespace llvm::PatternMatch;
 
 #define DEBUG_TYPE "instsimplify"
 
-enum { RecursionLimit = 3 };
+static unsigned RecursionLimit = 5;
----------------
dtcxzyw wrote:

```suggestion
static constexpr unsigned RecursionLimit = 5;
```

@nikic Can you test the compile-time impact?

TBH I don't like increasing the recursion limit for all root instructions.
If necessary, it would be better to only increase the limit for `shufflevector`:
```
/// Given operands for a ShuffleVectorInst, fold the result or return null.
Value *llvm::simplifyShuffleVectorInst(Value *Op0, Value *Op1,
                                       ArrayRef<int> Mask, Type *RetTy,
                                       const SimplifyQuery &Q) {
  static constexpr ShuffleRecursionLimit = 5;
  return ::simplifyShuffleVectorInst(Op0, Op1, Mask, RetTy, Q, ShuffleRecursionLimit);
}
```


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


More information about the llvm-commits mailing list