[PATCH] D18841: [InstCombine] Canonicalize icmp instructions based on dominating conditions.
Balaram Makam via llvm-commits
llvm-commits at lists.llvm.org
Thu Apr 28 14:50:16 PDT 2016
bmakam added a comment.
In http://reviews.llvm.org/D18841#415959, @majnemer wrote:
> Generally speaking, InstCombine canonicalization helps out down stream analysis by simplifying the IR or exposes further opportunities for canonicalization. i'm not entirely sure that this transform fits that bill.
FWIW, the examples listed in the testcases demonstrate that it helps out by simplifying the IR. In my tests on spec2006 benchmarks it has reduced more than 3000 static instructions in xalancbmk and 100s of static instructions in gcc and several other benchmarks. This is similar to the transformations done in FoldAndOfICmps except that here we consider dominating condition as the LHS. I have constrained this only to the first predecessor to find the dominating icmp and could still remove several static instructions which should improve the code quality and compile time.
> I wonder if a more appropriate place for this to live is in CodeGenPrepare seeing as how sensitive this transform is to the peculiarities of the target ISA, perhaps with a TargetLowering check which verifies that it would make sense to perform on such a target.
I am not totally against moving this to the backend and infact I started off by implementing it at the very end of the pipeline in http://reviews.llvm.org/D18572, but realized that it would catch more such cases and might help other downstream optimizations when we do this transform in instcombine. What do you think?
http://reviews.llvm.org/D18841
More information about the llvm-commits
mailing list