[llvm-dev] Cost model is missing in InstCombiner
Mehdi Amini via llvm-dev
llvm-dev at lists.llvm.org
Thu Aug 18 09:05:35 PDT 2016
> On Aug 17, 2016, at 3:48 AM, Shixiong Xu via llvm-dev <llvm-dev at lists.llvm.org> wrote:
> I think canEvaluateTruncated() in InstCombiner needs use cost model to decide whether perform optimization or not.
I’ve always seen InstCombine as doing “canonicalization” of the IR and not “optimization”. So the output of InstCombine should be in a form that is the most suitable for further analyses and transformations.
I’m not sure how this view fits with TTI, I may not be incompatible if used within some limits I guess?
> Without cost model from TargetTransformInfo, aggressively optimizing IR in vector types according to the number of bits demanded may lead to scalarization of vector operations. For example, if the input IR is:
> %wide.load25 = load <32 x i8>, <32 x i8>* %231, align 1
> %232 = zext <32 x i8> %wide.load25 to <32 x i16>
> %233 = mul nuw nsw <32 x i16> %232, %164
> %237 = trunc <32 x i16> %233 to <32 x i8>
> store <32 x i8> %237, <32 x i8>* %236, align 1
> ICE: EvaluateInDifferentType converting expression type to avoid cast: %9 = trunc <32 x i16> %6 to <32 x i8>
> IC: ADD: %6 = mul <32 x i8> %wide.load25, %wide.load
> IC: Replacing %10 = trunc <32 x i16> %7 to <32 x i8>
> with %6 = mul <32 x i8> %wide.load25, %wide.load
> If the target doesn’t have support for mul <32 x i8>, the inst combiner will yield less profitable code.
> Shixiong (Jason) Xu
> LLVM Developers mailing list
> llvm-dev at lists.llvm.org <mailto:llvm-dev at lists.llvm.org>
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev <http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev>
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the llvm-dev