[PATCH] D38536: Improve lookThroughCast function.
Sanjay Patel via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Oct 17 08:35:47 PDT 2017
spatel accepted this revision.
spatel added a comment.
This revision is now accepted and ready to land.
LGTM - see inline notes for a couple of changes to the code comments.
================
Comment at: lib/Analysis/ValueTracking.cpp:4312
+/// 2. As restored constant (by applying reverse cast operation) when the first
+/// value of the inital "select" is a cast operation and the second value is a
+/// constant.
----------------
typo: initial - you could just remove that word, and the comment would be better.
================
Comment at: lib/Analysis/ValueTracking.cpp:4350-4355
+ // %c = cmp iN %x, a
+ // %t = trunc iN %y to iK
+ // %sel = select i1 %c, iK %t, iK b
+ //
+ // where a and b are constants. We can always move trunc after select
+ // operation:
----------------
It's more typical to use 'C' for constant values in code and comments in LLVM, so I'd change this comment text and formula to match the code:
%cond = cmp iN %x, CmpConst
%tr = trunc iN %x to iK
%narrowsel = select i1 %cond, iK %t, iK C
-->
%cond = cmp iN %x, CmpConst
%widesel = select i1 %cond, iN %x, iN CmpConst
%tr = trunc iN %widesel to iK
https://reviews.llvm.org/D38536
More information about the llvm-commits
mailing list