[PATCH] D14271: [CVP] Fold return values if possible
Philip Reames via llvm-commits
llvm-commits at lists.llvm.org
Mon Nov 2 17:38:18 PST 2015
reames created this revision.
reames added reviewers: sanjoy, hfinkel, nlewycky.
reames added a subscriber: llvm-commits.
In my previous change to CVP (251606), I made CVP much more aggressive about trying to constant fold comparisons. This patch is a reversal in direction. Rather than being agressive about every compare, we restore the non-block local restriction for most, and then try hard for compares feeding returns.
The motivation for this is two fold:
1) The more I thought about it, the less comfortable I got with the possible compile time impact of the other approach. There have been no reported issues, but after talking to a couple of folks, I've come to the conclusion the time probably isn't justified.
2) It turns out we need to know the context to leverage the full power of LVI. In particular, asking about something at the end of it's block (the use of a compare in a return) will frequently get more precise results than something in the middle of a block. This is an implementation detail, but it's also hard to get around since mid-block queries have to reason about possible throwing instructions and don't get to use most of LVI's block focused infrastructure. This will become particular important when combined with http://reviews.llvm.org/D14263.
http://reviews.llvm.org/D14271
Files:
lib/Transforms/Scalar/CorrelatedValuePropagation.cpp
test/Transforms/CorrelatedValuePropagation/select.ll
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D14271.39011.patch
Type: text/x-patch
Size: 3698 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20151103/e8eceacd/attachment.bin>
More information about the llvm-commits
mailing list