[llvm-commits] [llvm] r159969 - /llvm/trunk/lib/Analysis/ScalarEvolution.cpp

Chris Lattner clattner at apple.com
Mon Jul 9 17:18:34 PDT 2012


On Jul 9, 2012, at 4:51 PM, Dan Gohman wrote:

> Author: djg
> Date: Mon Jul  9 18:51:20 2012
> New Revision: 159969
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=159969&view=rev
> Log:
> Delete code for folding undefs in ScalarEvolution. It's invalid in
> obscure ways, and it isn't actually important in the real world.

Can't it just fold to zero?

-Chris

> 
> Modified:
>    llvm/trunk/lib/Analysis/ScalarEvolution.cpp
> 
> Modified: llvm/trunk/lib/Analysis/ScalarEvolution.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/ScalarEvolution.cpp?rev=159969&r1=159968&r2=159969&view=diff
> ==============================================================================
> --- llvm/trunk/lib/Analysis/ScalarEvolution.cpp (original)
> +++ llvm/trunk/lib/Analysis/ScalarEvolution.cpp Mon Jul  9 18:51:20 2012
> @@ -878,13 +878,6 @@
>     return getAddRecExpr(Operands, AddRec->getLoop(), SCEV::FlagAnyWrap);
>   }
> 
> -  // As a special case, fold trunc(undef) to undef. We don't want to
> -  // know too much about SCEVUnknowns, but this special case is handy
> -  // and harmless.
> -  if (const SCEVUnknown *U = dyn_cast<SCEVUnknown>(Op))
> -    if (isa<UndefValue>(U->getValue()))
> -      return getSCEV(UndefValue::get(Ty));
> -
>   // The cast wasn't folded; create an explicit cast node. We can reuse
>   // the existing insert position since if we get here, we won't have
>   // made any changes which would invalidate it.
> @@ -1344,13 +1337,6 @@
>     return getAddRecExpr(Ops, AR->getLoop(), SCEV::FlagNW);
>   }
> 
> -  // As a special case, fold anyext(undef) to undef. We don't want to
> -  // know too much about SCEVUnknowns, but this special case is handy
> -  // and harmless.
> -  if (const SCEVUnknown *U = dyn_cast<SCEVUnknown>(Op))
> -    if (isa<UndefValue>(U->getValue()))
> -      return getSCEV(UndefValue::get(Ty));
> -
>   // If the expression is obviously signed, use the sext cast value.
>   if (isa<SCEVSMaxExpr>(Op))
>     return SExt;
> 
> 
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits




More information about the llvm-commits mailing list