[llvm] r342906 - [Analysis] add comment to generalize finding a scalar op from vector; NFC

Sanjay Patel via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 24 10:18:33 PDT 2018


Author: spatel
Date: Mon Sep 24 10:18:32 2018
New Revision: 342906

URL: http://llvm.org/viewvc/llvm-project?rev=342906&view=rev
Log:
[Analysis] add comment to generalize finding a scalar op from vector; NFC

Modified:
    llvm/trunk/lib/Analysis/VectorUtils.cpp

Modified: llvm/trunk/lib/Analysis/VectorUtils.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/VectorUtils.cpp?rev=342906&r1=342905&r2=342906&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/VectorUtils.cpp (original)
+++ llvm/trunk/lib/Analysis/VectorUtils.cpp Mon Sep 24 10:18:32 2018
@@ -280,9 +280,10 @@ Value *llvm::findScalarElement(Value *V,
   }
 
   // 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);
 




More information about the llvm-commits mailing list