summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp
diff options
context:
space:
mode:
authorSanjay Patel <spatel@rotateright.com>2018-03-25 21:16:33 +0000
committerSanjay Patel <spatel@rotateright.com>2018-03-25 21:16:33 +0000
commit93e64dd9a1e2ed5e31881994cdde5e6ef94ddc79 (patch)
tree5867bafd5f56667416d68c5575768f8f61f58c67 /llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp
parent68a8fbc1021cd612bb69bb6d50bcb9763ad00f00 (diff)
downloadbcm5719-llvm-93e64dd9a1e2ed5e31881994cdde5e6ef94ddc79.tar.gz
bcm5719-llvm-93e64dd9a1e2ed5e31881994cdde5e6ef94ddc79.zip
[PatternMatch] allow undef elements when matching vector FP +0.0
This continues the FP constant pattern matching improvements from: https://reviews.llvm.org/rL327627 https://reviews.llvm.org/rL327339 https://reviews.llvm.org/rL327307 Several integer constant matchers also have this ability. I'm separating matching of integer/pointer null from FP positive zero and renaming/commenting to make the functionality clearer. llvm-svn: 328461
Diffstat (limited to 'llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp')
-rw-r--r--llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp b/llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp
index ff682acd3fd..d6d046f0185 100644
--- a/llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp
+++ b/llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp
@@ -1579,10 +1579,10 @@ Instruction *InstCombiner::visitSelectInst(SelectInst &SI) {
if (match(FCI->getOperand(1), m_AnyZeroFP()) && FCI->hasNoNaNs()) {
// (X <= +/-0.0) ? (0.0 - X) : X --> fabs(X)
// (X > +/-0.0) ? X : (0.0 - X) --> fabs(X)
- if ((X == FalseVal && match(TrueVal, m_FSub(m_Zero(), m_Specific(X))) &&
- Pred == FCmpInst::FCMP_OLE) ||
- (X == TrueVal && match(FalseVal, m_FSub(m_Zero(), m_Specific(X))) &&
- Pred == FCmpInst::FCMP_OGT)) {
+ if ((X == FalseVal && Pred == FCmpInst::FCMP_OLE &&
+ match(TrueVal, m_FSub(m_PosZeroFP(), m_Specific(X)))) ||
+ (X == TrueVal && Pred == FCmpInst::FCMP_OGT &&
+ match(FalseVal, m_FSub(m_PosZeroFP(), m_Specific(X))))) {
Value *Fabs = Builder.CreateIntrinsic(Intrinsic::fabs, { X }, FCI);
return replaceInstUsesWith(SI, Fabs);
}
OpenPOWER on IntegriCloud