[PATCH] D79116: [InstCombine] fold fpext into Xitofp

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 29 12:23:43 PDT 2020


spatel created this revision.
spatel added reviewers: pcordes, RKSimon, scanon, zhengyangl, aqjune, nlopes, regehr.
Herald added subscribers: hiraditya, mcrosier.
Herald added a project: LLVM.

We can combine a floating-point extension cast with a conversion from integer if we know the earlier cast is exact. For example:
fpext (sitofp (fptosi half F to iN) to float) to double --> sitofp (fptosi half F to iN) to double

This is an optimization suggested in PR36617:
https://bugs.llvm.org/show_bug.cgi?id=36617#c19

I left the mismatched unsigned -> signed pattern out of this patch just in case there's some weird type combo that I'm not seeing. I can add that here if there's no concern.

This gives us another opportunity to test-drive Alive2 with FP ops:
http://volta.cs.utah.edu:8080/z/NfYne7


https://reviews.llvm.org/D79116

Files:
  llvm/include/llvm/IR/PatternMatch.h
  llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp
  llvm/test/Transforms/InstCombine/fpextend.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D79116.260983.patch
Type: text/x-patch
Size: 5830 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200429/329daf26/attachment.bin>


More information about the llvm-commits mailing list