[PATCH] D88687: [InstCombine] visitTrunc - pass through undefs for trunc(shift(trunc/ext(x),c)) patterns

Simon Pilgrim via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 1 11:15:39 PDT 2020


RKSimon created this revision.
RKSimon added reviewers: lebedev.ri, nikic, spatel.
Herald added a subscriber: hiraditya.
Herald added a project: LLVM.
RKSimon requested review of this revision.

Based on the recent patches D88475 <https://reviews.llvm.org/D88475> and D88429 <https://reviews.llvm.org/D88429> where we losing undef values due to extension/comparisons.

I've added a ConstantExpr::getUndefMask method that attempts to return a bool mask that is set to true for cases where the scalar/element was UndefValue - similar to Constant::replaceUndefsWith.

I've replaced the ConstantExpr::getUMin with a ConstantExpr::getUClamp method that can optionally pass through undefs, (else set it to the minimum value).

My hope is that I can next use ConstantExpr::getUndefMask to simplify D88420 <https://reviews.llvm.org/D88420>


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D88687

Files:
  llvm/include/llvm/IR/Constants.h
  llvm/lib/IR/Constants.cpp
  llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp
  llvm/test/Transforms/InstCombine/cast.ll
  llvm/test/Transforms/InstCombine/trunc-shift-trunc.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D88687.295630.patch
Type: text/x-patch
Size: 10106 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20201001/6e7543f4/attachment.bin>


More information about the llvm-commits mailing list