[LVI] Constant-propagate a zero extension of the switch condition value through case...
authorHiroshi Yamauchi <yamauchi@google.com>
Thu, 3 Aug 2017 21:11:30 +0000 (21:11 +0000)
committerHiroshi Yamauchi <yamauchi@google.com>
Thu, 3 Aug 2017 21:11:30 +0000 (21:11 +0000)
commit144ee2b4d772e38ec5f183cb2e015417d9af5c57
tree79b1a09f33ca30da0b10d3e96bedbaefb3809653
parent424c88c381f99aa1acac9a2eef67ab06d41ab427
[LVI] Constant-propagate a zero extension of the switch condition value through case edges

Summary:
(This is a second attempt as https://reviews.llvm.org/D34822 was reverted.)

LazyValueInfo currently computes the constant value of the switch condition through case edges, which allows the constant value to be propagated through the case edges.

But we have seen a case where a zero-extended value of the switch condition is used past case edges for which the constant propagation doesn't occur.

This patch adds a small logic to handle such a case in getEdgeValueLocal().

This is motivated by the Python 2.7 eval loop in PyEval_EvalFrameEx() where the lack of the constant propagation causes longer live ranges and more spill code than necessary.

With this patch, we see that the code size of PyEval_EvalFrameEx() decreases by ~5.4% and a performance test improves by ~4.6%.

Reviewers: sanjoy

Reviewed By: sanjoy

Subscribers: llvm-commits

Differential Revision: https://reviews.llvm.org/D36247

llvm-svn: 309986
llvm/lib/Analysis/LazyValueInfo.cpp
llvm/test/Transforms/CorrelatedValuePropagation/range.ll