[llvm-branch-commits] [llvm-branch] r142094 - in /llvm/branches/release_30: ./ include/llvm/Analysis/ScalarEvolutionExpander.h lib/Analysis/ScalarEvolutionExpander.cpp test/Transforms/LoopStrengthReduce/2011-10-14-IntPtr.ll

Bill Wendling isanbard at gmail.com
Sat Oct 15 18:47:12 PDT 2011


Author: void
Date: Sat Oct 15 20:47:12 2011
New Revision: 142094

URL: http://llvm.org/viewvc/llvm-project?rev=142094&view=rev
Log:
------------------------------------------------------------------------
r142058 | atrick | 2011-10-14 23:19:55 -0700 (Fri, 14 Oct 2011) | 7 lines

Fix SCEVExpander assert during LSR: "argument of incompatible type".

Just because we're dealing with a GEP doesn't mean we can assert the
SCEV has a pointer type. The fix is simply to ignore the SCEV pointer
type, which we really didn't need.
Fixes PR11138 webkit crash.

------------------------------------------------------------------------

Added:
    llvm/branches/release_30/test/Transforms/LoopStrengthReduce/2011-10-14-IntPtr.ll
      - copied unchanged from r142058, llvm/trunk/test/Transforms/LoopStrengthReduce/2011-10-14-IntPtr.ll
Modified:
    llvm/branches/release_30/   (props changed)
    llvm/branches/release_30/include/llvm/Analysis/ScalarEvolutionExpander.h
    llvm/branches/release_30/lib/Analysis/ScalarEvolutionExpander.cpp

Propchange: llvm/branches/release_30/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Sat Oct 15 20:47:12 2011
@@ -1,2 +1,3 @@
 /llvm/branches/Apple/Pertwee:110850,110961
 /llvm/branches/type-system-rewrite:133420-134817
+/llvm/trunk:142058

Modified: llvm/branches/release_30/include/llvm/Analysis/ScalarEvolutionExpander.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/release_30/include/llvm/Analysis/ScalarEvolutionExpander.h?rev=142094&r1=142093&r2=142094&view=diff
==============================================================================
--- llvm/branches/release_30/include/llvm/Analysis/ScalarEvolutionExpander.h (original)
+++ llvm/branches/release_30/include/llvm/Analysis/ScalarEvolutionExpander.h Sat Oct 15 20:47:12 2011
@@ -237,8 +237,7 @@
 
     bool isNormalAddRecExprPHI(PHINode *PN, Instruction *IncV, const Loop *L);
 
-    bool isExpandedAddRecExprPHI(PHINode *PN, Instruction *IncV, const Loop *L,
-                                 Type *ExpandTy);
+    bool isExpandedAddRecExprPHI(PHINode *PN, Instruction *IncV, const Loop *L);
 
     Value *expandAddRecExprLiterally(const SCEVAddRecExpr *);
     PHINode *getAddRecExprPHILiterally(const SCEVAddRecExpr *Normalized,

Modified: llvm/branches/release_30/lib/Analysis/ScalarEvolutionExpander.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/release_30/lib/Analysis/ScalarEvolutionExpander.cpp?rev=142094&r1=142093&r2=142094&view=diff
==============================================================================
--- llvm/branches/release_30/lib/Analysis/ScalarEvolutionExpander.cpp (original)
+++ llvm/branches/release_30/lib/Analysis/ScalarEvolutionExpander.cpp Sat Oct 15 20:47:12 2011
@@ -881,7 +881,7 @@
 /// should match any patterns generated by getAddRecExprPHILiterally and
 /// expandAddtoGEP.
 bool SCEVExpander::isExpandedAddRecExprPHI(PHINode *PN, Instruction *IncV,
-                                           const Loop *L, Type *ExpandTy) {
+                                           const Loop *L) {
   switch (IncV->getOpcode()) {
   // Check for a simple Add/Sub or GEP of a loop invariant step.
   case Instruction::Add:
@@ -904,7 +904,7 @@
       // i1* is used by the expander to represent an address-size element.
       if (IncV->getNumOperands() != 2)
         return false;
-      unsigned AS = cast<PointerType>(ExpandTy)->getAddressSpace();
+      unsigned AS = cast<PointerType>(IncV->getType())->getAddressSpace();
       if (IncV->getType() != Type::getInt1PtrTy(SE.getContext(), AS)
           && IncV->getType() != Type::getInt8PtrTy(SE.getContext(), AS))
         return false;
@@ -954,7 +954,7 @@
         cast<Instruction>(PN->getIncomingValueForBlock(LatchBlock));
 
       if (LSRMode) {
-        if (!isExpandedAddRecExprPHI(PN, IncV, L, ExpandTy))
+        if (!isExpandedAddRecExprPHI(PN, IncV, L))
           continue;
       }
       else {
@@ -1547,9 +1547,8 @@
         cast<Instruction>(Phi->getIncomingValueForBlock(LatchBlock));
 
       // If this phi is more canonical, swap it with the original.
-      if (!isExpandedAddRecExprPHI(OrigPhiRef, OrigInc, L,
-                                   OrigPhiRef->getType())
-          && isExpandedAddRecExprPHI(Phi, IsomorphicInc, L, Phi->getType())) {
+      if (!isExpandedAddRecExprPHI(OrigPhiRef, OrigInc, L)
+          && isExpandedAddRecExprPHI(Phi, IsomorphicInc, L)) {
         std::swap(OrigPhiRef, Phi);
         std::swap(OrigInc, IsomorphicInc);
       }





More information about the llvm-branch-commits mailing list