[llvm] [LV] Avoid bailing on SCEVUnknown in uniformity-rew (PR #160144)

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Sat Sep 27 11:54:19 PDT 2025


================
@@ -528,14 +528,6 @@ class SCEVAddRecForUniformityRewriter
     return SCEVRewriteVisitor<SCEVAddRecForUniformityRewriter>::visit(S);
   }
 
-  const SCEV *visitUnknown(const SCEVUnknown *S) {
----------------
fhahn wrote:

Hmm, I don't think removing all checks for SCEVUnknown is safe.

The rewriter is used to rewrite a SCEV expression for each lane, and checks if the result is the same SCEV for all lanes.

I think with this change, SCEVUnknown would always be treated as uniform, but they could be any load instruction for example, which may or may not read a different value from memory on every iteration? (needs a test case I think).

We might be able to refine the checks to handle additional cases, e.g. read-only loops?

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


More information about the llvm-commits mailing list