[PATCH] D111237: [TypePromotion] Promote PHI + [SZ]Ext
Andre Vieira via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Dec 6 08:41:24 PST 2021
avieira added a comment.
Thanks for the suggestion @samparker . I hadn't look too much into it after I found that the ICmp promotion leaves the code in a somewhat 'dirty' state.
For instance if you take the motivating example from Snappy, the BB before the one with the PHI + ZEXT has an icmp that feeds into the relevant PHI node and it ends up yielding:
%tag.0.in10 = phi i32 [ %2, %for.body ], [ %0, %for.body.preheader ]
%1 = trunc i32 %tag.0.in10 to i8
%tag.0 = zext i8 %1 to i64
Which ofc gets cleaned up later, removing the trunc, but it would mean I'd need to account for stuff like that when pattern matching PHI + Ext. I found it was easier to do the transformation I wanted before doing the ICmp transformations. I could alternatively try to avoid generating the trunc, but I haven't looked at why it does this yet and I don't know whether it does so by design...
I realized I didn't actually include a testcase that showcases this... I'll make sure to add one.
@dmgreen Thanks for the comments, I'm looking into those.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D111237/new/
https://reviews.llvm.org/D111237
More information about the llvm-commits
mailing list