Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
ping :) @nikic can you please review this revision to make sure it is what you want in https://github.com/llvm/llvm-project/issues/54561#issuecomment-1079460876 ?
(I'm new to around this, so those comments are just my opinions.)
llvm/lib/Transforms/InstCombine/InstCombinePHI.cpp | ||
---|---|---|
1307–1308 | IMHO, duplicating SuccForValue map for each casts seems a little redundant. I like collecting incoming phi values in the front and checking correspondences to unify those maps. Then we can also early return if the values don't correspond. | |
1384–1386 | Inverting can't be determined on these lines. If you do so, these comments look obsolete, and better to be modified | |
1387–1408 | IMHO, this checking, which is done when creating maps, seems a bit redundant, it's better to hold conditions in some way. |
llvm/lib/Transforms/InstCombine/InstCombinePHI.cpp | ||
---|---|---|
1307–1308 | Thanks for the feedback!
Can you elaborate your solution? Here are my worries: Here we are going to find a operation that maps branch condition in to corresponding phi values. Not an operation that maps phi values back to branch condition. I think I have to left "sext"/"zext"ed values here because we must know the result of the branch condition after "s/zext". That's different from truncating from PHI values. i.e. s/zext information is not recoverable. Truncating phi values to branch condition does not imply we can z/sext the branch condition back to "phi values". | |
1384–1386 | Nice catch! I'd like to fixup this after all "functional change" reviews. |
llvm/lib/Transforms/InstCombine/InstCombinePHI.cpp | ||
---|---|---|
1307–1308 | Sorry for my vague comments. The idea was unifying later inverting checking and these casting checking. Finding SExt or ZExt is similar to decide an inversion
I just thought it'll be neat to reverse the roll between Succ/Cond and Pred/Phi. Then we don't need to hold candidate values. But I feel this might be too detailed and optional, this requires the dominant condition reversed. (I just tried to write actually, but ugly wip https://github.com/llvm/llvm-project/compare/main...khei4:llvm-project:wip/khei4-sext |
IMHO, duplicating SuccForValue map for each casts seems a little redundant. I like collecting incoming phi values in the front and checking correspondences to unify those maps. Then we can also early return if the values don't correspond.