[PATCH] D18155: Instcombine: try to avoid wasted work in ConstantFold

Philip Reames via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 15 18:08:34 PDT 2016

reames added a comment.

In http://reviews.llvm.org/D18155#376016, @escha wrote:

> If it's already folded, why does InstCombine try to optimize it? I did this under the assumption that InstCombine was doing something reasonable (and just being redundant about it); are you saying InstCombine shouldn't be doing this at all?

This is exactly what I'm asking.  In general, our canonical form is to have constants fully folded.  Given InstCombine is iterative, we only need to do a single folding step at a time to reach an optimal fixed point.  Why does this code need to fold constantexprs specially?  Is there a reason we can't have a loop per instruction which tries to fold constexpr operands and updates the instruction operands?



More information about the llvm-commits mailing list