[PATCH] D152278: [SCEV] Compute SCEV for ashr(add(shl(x, n), c), m) instr triplet
Vedant Paranjape via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Aug 24 00:24:12 PDT 2023
vedant-amd added inline comments.
================
Comment at: llvm/lib/Analysis/ScalarEvolution.cpp:7907
+ if (ShlAmt > AShrAmt)
+ AddTruncateExpr = getTruncateExpr(ShlOp0SCEV, TruncTy);
+ else
----------------
efriedma wrote:
> Instead of checking `if (ShlAmt > AShrAmt)` here, can you just unconditionally do `AddTruncateExpr = getTruncateExpr(ShlOp0SCEV, TruncTy);`, then add an `if (L->getOpcode() != Instruction::Shl)` check to the equal shift amount case?
>
> Or better, just unify the `ShlAmt > AShrAmt` and `ShlAmt == AShrAmt` cases; the logic for the `ShlAmt > AShrAmt` case should just work for the `ShlAmt == AShrAmt` case (it ends up multiplying by a constant 1, which simplifies to exactly the same thing as the existing `ShlAmt == AShrAmt` code).
I have implemented the second suggestion, refactored and cleaned up the comments. Now the code looks in good shape. Please give a final review for the same.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D152278/new/
https://reviews.llvm.org/D152278
More information about the llvm-commits
mailing list