aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Analysis/VectorUtils.cpp
diff options
context:
space:
mode:
authorSanjay Patel <spatel@rotateright.com>2018-09-24 17:18:32 +0000
committerSanjay Patel <spatel@rotateright.com>2018-09-24 17:18:32 +0000
commit3413a66c384f91f08185e1f88dad9adca6189586 (patch)
tree737290fc9ceb322386a2c8e248796d3babf8b338 /llvm/lib/Analysis/VectorUtils.cpp
parent7b86bc22de3dbe617f69d2c6d7c24cf2fbe82bc0 (diff)
downloadllvm-3413a66c384f91f08185e1f88dad9adca6189586.zip
llvm-3413a66c384f91f08185e1f88dad9adca6189586.tar.gz
llvm-3413a66c384f91f08185e1f88dad9adca6189586.tar.bz2
[Analysis] add comment to generalize finding a scalar op from vector; NFC
llvm-svn: 342906
Diffstat (limited to 'llvm/lib/Analysis/VectorUtils.cpp')
-rw-r--r--llvm/lib/Analysis/VectorUtils.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/llvm/lib/Analysis/VectorUtils.cpp b/llvm/lib/Analysis/VectorUtils.cpp
index 2f4f72a..c639f36 100644
--- a/llvm/lib/Analysis/VectorUtils.cpp
+++ b/llvm/lib/Analysis/VectorUtils.cpp
@@ -280,9 +280,10 @@ Value *llvm::findScalarElement(Value *V, unsigned EltNo) {
}
// Extract a value from a vector add operation with a constant zero.
- Value *Val = nullptr; Constant *Con = nullptr;
- if (match(V, m_Add(m_Value(Val), m_Constant(Con))))
- if (Constant *Elt = Con->getAggregateElement(EltNo))
+ // TODO: Use getBinOpIdentity() to generalize this.
+ Value *Val; Constant *C;
+ if (match(V, m_Add(m_Value(Val), m_Constant(C))))
+ if (Constant *Elt = C->getAggregateElement(EltNo))
if (Elt->isNullValue())
return findScalarElement(Val, EltNo);