[PATCH] D47928: [SimplifyIndVars] Eliminate redundant truncs
Max Kazantsev via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Jun 12 18:43:44 PDT 2018
mkazantsev added inline comments.
================
Comment at: lib/Transforms/Utils/SimplifyIndVar.cpp:514
+ HasSignedComparisonUser = true;
+ else
+ HasUnsignedComparisonUser = true;
----------------
reames wrote:
> This appears to be treating eq/ne as unsigned? Is that intentional? If so, probably worth a comment.
Yes it is, we prefer `zext` over `sext` for canonicalization needs in case if there is no difference, as well as we prefer unsigned comparison over signed.
================
Comment at: lib/Transforms/Utils/SimplifyIndVar.cpp:580
+ if (auto *TI = dyn_cast<TruncInst>(UseInst))
+ if (eliminateTrunc(TI))
----------------
reames wrote:
> I'm missing something. Why do this via a new Trunc specific routine that has to look at users instead of just looking at the icmp directly? We do end up processing it don't we?
No, we never process this `icmp(trunc(iv), constant)`.
https://reviews.llvm.org/D47928
More information about the llvm-commits
mailing list