[llvm] r258411 - Undo r258163 "Move part of an if condition into an assertion. NFC."

Manuel Jacob via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 21 09:36:15 PST 2016


Author: mjacob
Date: Thu Jan 21 11:36:14 2016
New Revision: 258411

URL: http://llvm.org/viewvc/llvm-project?rev=258411&view=rev
Log:
Undo r258163 "Move part of an if condition into an assertion.  NFC."

This undoes the change made in r258163.  The assertion fails if `Ptr` is of a
vector type.  The previous code doesn't look completely correct either, so I'll
investigate this more.

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

Modified: llvm/trunk/lib/Analysis/ConstantFolding.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/ConstantFolding.cpp?rev=258411&r1=258410&r2=258411&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/ConstantFolding.cpp (original)
+++ llvm/trunk/lib/Analysis/ConstantFolding.cpp Thu Jan 21 11:36:14 2016
@@ -731,8 +731,8 @@ static Constant *SymbolicallyEvaluateGEP
                                          Type *ResultTy, const DataLayout &DL,
                                          const TargetLibraryInfo *TLI) {
   Constant *Ptr = Ops[0];
-  assert(Ptr->getType()->isPointerTy());
-  if (!Ptr->getType()->getPointerElementType()->isSized())
+  if (!Ptr->getType()->getPointerElementType()->isSized() ||
+      !Ptr->getType()->isPointerTy())
     return nullptr;
 
   Type *IntPtrTy = DL.getIntPtrType(Ptr->getType());




More information about the llvm-commits mailing list