[PATCH] D48763: [SimplifyIndVar] Canonicalize comparisons to unsigned while eliminating truncs
David Greene via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Jul 12 17:01:28 PDT 2018
greened added a comment.
LGTM.
================
Comment at: lib/Transforms/Utils/SimplifyIndVar.cpp:563
+ };
+ auto CanUseZExt = [&](ICmpInst *ICI) {
+ // Unsigned comparison can be widened as unsigned.
----------------
mkazantsev wrote:
> greened wrote:
> > Does this need to be a lambda? Seems unnecessarily complicated.
> It is the simplest way to avoid something like `if (Cond1 || (!Cond2 && Cond3 && Cond4))` which is harder to understand.
Actually, I was wondering if it should be a freestanding function, but thinking about it now it seems like a good idea to define it where it's used. It's acting like a nested function in that sense, so I think this is fine. Thanks.
https://reviews.llvm.org/D48763
More information about the llvm-commits
mailing list