]> granicus.if.org Git - llvm/commit
[X86][AArch64][DAGCombine] Unfold 'check for [no] signed truncation' pattern
authorRoman Lebedev <lebedev.ri@gmail.com>
Mon, 16 Jul 2018 12:44:10 +0000 (12:44 +0000)
committerRoman Lebedev <lebedev.ri@gmail.com>
Mon, 16 Jul 2018 12:44:10 +0000 (12:44 +0000)
commit0c94a3b5119ee90ddf0fba2a49a806fc80235f1b
tree41ace512673c78a4e33d905eff089a0750700c55
parent84ab5c258acf44e55634e7a970e90bfe664a55b0
[X86][AArch64][DAGCombine] Unfold 'check for [no] signed truncation' pattern

Summary:

[[ https://bugs.llvm.org/show_bug.cgi?id=38149 | PR38149 ]]

As discussed in https://reviews.llvm.org/D49179#1158957 and later,
the IR for 'check for [no] signed truncation' pattern can be improved:
https://rise4fun.com/Alive/gBf
^ that pattern will be produced by Implicit Integer Truncation sanitizer,
https://reviews.llvm.org/D48958 https://bugs.llvm.org/show_bug.cgi?id=21530
in signed case, therefore it is probably a good idea to improve it.

But the IR-optimal patter does not lower efficiently, so we want to undo it..

This handles the simple pattern.
There is a second pattern with predicate and constants inverted.

NOTE: we do not check uses here. we always do the transform.

Reviewers: spatel, craig.topper, RKSimon, javed.absar

Reviewed By: spatel

Subscribers: kristof.beyls, llvm-commits

Differential Revision: https://reviews.llvm.org/D49266

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@337166 91177308-0d34-0410-b5e6-96231b3b80d8
include/llvm/CodeGen/TargetLowering.h
lib/CodeGen/SelectionDAG/TargetLowering.cpp
lib/Target/AArch64/AArch64ISelLowering.h
lib/Target/X86/X86ISelLowering.h
test/CodeGen/AArch64/lack-of-signed-truncation-check.ll
test/CodeGen/AArch64/signed-truncation-check.ll
test/CodeGen/X86/lack-of-signed-truncation-check.ll
test/CodeGen/X86/signed-truncation-check.ll