[PATCH] D38536: Improve lookThroughCast function.

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 16 16:14:36 PDT 2017


spatel added a comment.

In https://reviews.llvm.org/D38536#899151, @ArturGainullin wrote:

> For using constant from cmp instruction (instead of recreation) we will need to check that truncated constant is equal to lower bits of cmp constant. 
>  That is why I decided just to recreate constant  which looks like more general solution.


That is already done?

  // Make sure the cast doesn't lose any information.
    Constant *CastedBack =
        ConstantExpr::getCast(*CastOp, CastedTo, C->getType(), true);
    if (CastedBack != C)
      return nullptr;

That's why I suggested the non-splat vector test - it should be transformed too, right?


https://reviews.llvm.org/D38536





More information about the llvm-commits mailing list