[PATCH] D46760: [InstCombine] Enhance narrowUDivURem.
Bixia Zheng via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon May 14 08:45:16 PDT 2018
bixia added a comment.
Instcombine has udiv/urem narrowing without increasing the total number of ZExt instructions. Correlated-Propagation has udiv/urem narrowing that can increasing the total number of ZExt instruction. These are existing duplicated functionalities. I have considered two possible changes to this: (1) allow instcombine to increase total number of ZExt instructions (by simplify removing the m_oneuse check), this will make the same transformation in correlated-propagation redundant (can be removed). (2) as shown in this change, allow instcombine to handle one more case without increasing the total number of ZExt instructions.
I looked at other similar narrowing transformations in instcombine, and found most of them have the check to avoid increasing the total number of ZExt/SExt instructions (lshr narrowing for example), but some of them don't have such a check (shl narrowing for example). I am not sure whether these are by design or due to something else such as ignorance. Do you know about this?
Now you are proposing a third solution: (3) Add some more duplicated functionalities between instcombine and correlated-propagation, that is to make them do lshr-narrowing and and-narrowing to make my original motivated test case "work" (see my Note below}.
Can you explain why you believe approach (3) is the best among the three solutions I described?
Note: for my motivated test case, without my change here, instcombine can't narrow these code mostly due to the fact that "tmp2" have two uses:
%tmp2 = zext i32 %1 to i64
%lane_id = and i64 %tmp2, 31
%2 = lshr i64 %tmp2, 2
Repository:
rL LLVM
https://reviews.llvm.org/D46760
More information about the llvm-commits
mailing list