[polly] r275174 - [SCEVAffinator] Fix assertion checking for constant divisor.

Tobias Grosser via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 12 08:49:37 PDT 2016



On Tue, Jul 12, 2016, at 05:08 PM, Michael Kruse via llvm-commits wrote:
> Author: meinersbur
> Date: Tue Jul 12 10:08:47 2016
> New Revision: 275174
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=275174&view=rev
> Log:
> [SCEVAffinator] Fix assertion checking for constant divisor.
> 
> An assertion in visitSDivInstruction() checked whether the divisor is
> constant
> by checking whether the argument is a ConstantInt. However, SCEVValidator
> allows
> the divisor to be simplified to a constant by ScalarEvolution.
> 
> We synchronize the implementation of SCEVValidator and SCEVAffinator to
> both
> accept simplified SCEV expressions.

Hi Michael,

thank you for this fix.

 
> Added:
>     polly/trunk/test/ScopInfo/scev-div-with-evaluatable-divisor.ll
> Modified:
>     polly/trunk/lib/Support/SCEVAffinator.cpp
> 
> Modified: polly/trunk/lib/Support/SCEVAffinator.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/polly/trunk/lib/Support/SCEVAffinator.cpp?rev=275174&r1=275173&r2=275174&view=diff
> ==============================================================================
> --- polly/trunk/lib/Support/SCEVAffinator.cpp (original)
> +++ polly/trunk/lib/Support/SCEVAffinator.cpp Tue Jul 12 10:08:47 2016
> @@ -535,7 +535,7 @@ __isl_give PWACtx SCEVAffinator::visitSD
>    auto *Divisor = SDiv->getOperand(1);
>    auto *DivisorSCEV = SE.getSCEVAtScope(Divisor, Scope);
>    auto DivisorPWAC = visit(DivisorSCEV);
> -  assert(isa<ConstantInt>(Divisor) &&
> +  assert(isa<SCEVConstant>(DivisorSCEV) &&
>           "SDiv is no parameter but has a non-constant RHS.");
>  
>    auto *Dividend = SDiv->getOperand(0);
> 
> Added: polly/trunk/test/ScopInfo/scev-div-with-evaluatable-divisor.ll
> URL:
> http://llvm.org/viewvc/llvm-project/polly/trunk/test/ScopInfo/scev-div-with-evaluatable-divisor.ll?rev=275174&view=auto
> ==============================================================================
> --- polly/trunk/test/ScopInfo/scev-div-with-evaluatable-divisor.ll
> (added)
> +++ polly/trunk/test/ScopInfo/scev-div-with-evaluatable-divisor.ll Tue
> Jul 12 10:08:47 2016
> @@ -0,0 +1,55 @@
> +; RUN: opt %loadPolly -polly-scops -analyze < %s
> +
> +; Derived from
> test-suite/SingleSource/UnitTests/Vector/SSE/sse.stepfft.c
> +
> +; The values %mul.i44 is simplified to constant 4 by ScalarEvolution,
> but 
> +; SCEVAffinator used to check whether the sdiv's argument was constant.

It might be useful to "CHECK:" for the access function that contains
this div to ensure this test case keeps exercising the code that
originally triggered this issue.

Best,
Tobias


More information about the llvm-commits mailing list