[PATCH] D73907: [InstCombine] correct operands of shouldChangeType() for casted phi transform

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Feb 3 10:12:41 PST 2020


spatel created this revision.
spatel added reviewers: nikic, lebedev.ri, arsenm.
Herald added subscribers: kerbowa, hiraditya, nhaehnle, wdng, jvesely, mcrosier.
Herald added a project: LLVM.

This is a bug noted in the recent D72733 <https://reviews.llvm.org/D72733> and seen in the similar transform just above the changed source code.

I added tests with illegal types and zexts to show the bug - we could transform legal phi ops to illegal, etc. I did not add tests with trunc because we won't see any diffs on those patterns. That is because InstCombiner::SliceUpIllegalIntegerPHI() appears to do those transforms independently of datalayout. It can also create more casts than are present in existing code. I'm not sure if that is intended or not, but that might be another patch.

There are some existing regression tests that do not include a datalayout that would be altered by this fix. I assumed that the lack of a datalayout in those regression files is an oversight, so I added the minimal layout (make i32 legal) necessary to preserve behavior on those tests.


https://reviews.llvm.org/D73907

Files:
  llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp
  llvm/test/CodeGen/AMDGPU/diverge-switch-default.ll
  llvm/test/CodeGen/AMDGPU/reqd-work-group-size.ll
  llvm/test/Transforms/InstCombine/cast_phi.ll
  llvm/test/Transforms/InstCombine/icmp-div-constant.ll
  llvm/test/Transforms/InstCombine/icmp-mul-zext.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D73907.242116.patch
Type: text/x-patch
Size: 5007 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200203/bbcbeb8a/attachment.bin>


More information about the llvm-commits mailing list