[llvm] [SCEV] Teach SCEVExpander to use zext nneg when possible (PR #70815)

Philip Reames via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 31 08:12:44 PDT 2023


================
@@ -1293,7 +1293,10 @@ Value *SCEVExpander::visitTruncateExpr(const SCEVTruncateExpr *S) {
 
 Value *SCEVExpander::visitZeroExtendExpr(const SCEVZeroExtendExpr *S) {
   Value *V = expand(S->getOperand());
-  return Builder.CreateZExt(V, S->getType());
+  auto *Res = Builder.CreateZExt(V, S->getType());
----------------
preames wrote:

Agreed.   Once we have a couple examples, a NFC to restructure the API might be called for.

My main point of uncertainty is what we're going to want for the ZExtOrTrunc variants.  Still waiting to see what actual idiomatic usage looks like.  

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


More information about the llvm-commits mailing list