summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp
diff options
context:
space:
mode:
authorChen Zheng <shchenz@cn.ibm.com>2018-07-16 02:23:00 +0000
committerChen Zheng <shchenz@cn.ibm.com>2018-07-16 02:23:00 +0000
commitccc84224644e267fce8b70e32833b887f4e12a61 (patch)
treeb0de6e3467e292939aa385041e10c8c2b751e1f7 /llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp
parent734e3928b355aef644b6646741f87bc55fd2a27d (diff)
downloadbcm5719-llvm-ccc84224644e267fce8b70e32833b887f4e12a61.tar.gz
bcm5719-llvm-ccc84224644e267fce8b70e32833b887f4e12a61.zip
[InstCombine] add more SPFofSPF folding
Differential Revision: https://reviews.llvm.org/D49238 llvm-svn: 337143
Diffstat (limited to 'llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp')
-rw-r--r--llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp b/llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp
index c88270fa0ea..108d29ab0d6 100644
--- a/llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp
+++ b/llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp
@@ -810,6 +810,11 @@ static Instruction *canonicalizeAbsNabs(SelectInst &Sel, ICmpInst &Cmp,
if (SPF != SelectPatternFlavor::SPF_ABS &&
SPF != SelectPatternFlavor::SPF_NABS)
return nullptr;
+
+ // TODO: later canonicalization change will move this condition check.
+ // Without this check, following assert will be hit.
+ if (match(Cmp.getOperand(0), m_Sub(m_Value(), m_Value())))
+ return nullptr;
// Is this already canonical?
if (match(Cmp.getOperand(1), m_ZeroInt()) &&
OpenPOWER on IntegriCloud