[PATCH] D82973: [InstCombine] Try to narrow expr if trunc cannot be removed.

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 1 10:15:46 PDT 2020


spatel added a comment.

In D82973#2125918 <https://reviews.llvm.org/D82973#2125918>, @RKSimon wrote:

> vector test cases? I realize for PR43580 we can get this done before vectorization


We could add tests, but I don't think we can see changes as long as we are using shouldChangeType() to guard the transform:

  bool InstCombiner::shouldChangeType(Type *From, Type *To) const {
    // TODO: This could be extended to allow vectors. Datalayout changes might be
    // needed to properly support that.
    if (!From->isIntegerTy() || !To->isIntegerTy())
      return false;



================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp:723
+      auto *NewDestTy = DestITy->getExtendedType();
+      if (shouldChangeType(SrcTy, DestTy) &&
+          canEvaluateTruncated(Src, NewDestTy, *this, &Trunc)) {
----------------
DestTy should be NewDestTy here?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D82973/new/

https://reviews.llvm.org/D82973





More information about the llvm-commits mailing list