[polly] r287272 - Probably overwritten loads should not be considered hoistable

Friedman, Eli via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 17 15:13:50 PST 2016


On 11/17/2016 2:25 PM, Johannes Doerfert via llvm-commits wrote:
> Author: jdoerfert
> Date: Thu Nov 17 16:25:17 2016
> New Revision: 287272
>
> URL: http://llvm.org/viewvc/llvm-project?rev=287272&view=rev
> Log:
> Probably overwritten loads should not be considered hoistable
>
> Do not assume a load to be hoistable/invariant if the pointer is used by
> another instruction in the SCoP that might write to memory and that is
> always executed.
>
> Modified:
>      polly/trunk/include/polly/Support/ScopHelper.h
>      polly/trunk/lib/Analysis/ScopDetection.cpp
>      polly/trunk/lib/Support/ScopHelper.cpp
>      polly/trunk/test/ScopInfo/complex-successor-structure.ll

It looks like this is missing a testcase.

> Modified: polly/trunk/lib/Support/ScopHelper.cpp
> URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/Support/ScopHelper.cpp?rev=287272&r1=287271&r2=287272&view=diff
> ==============================================================================
> --- polly/trunk/lib/Support/ScopHelper.cpp (original)
> +++ polly/trunk/lib/Support/ScopHelper.cpp Thu Nov 17 16:25:17 2016
> @@ -436,15 +436,35 @@ Value *polly::getConditionFromTerminator
>   }
>   
>   bool polly::isHoistableLoad(LoadInst *LInst, Region &R, LoopInfo &LI,
> -                            ScalarEvolution &SE) {
> +                            ScalarEvolution &SE, const DominatorTree &DT) {
>     Loop *L = LI.getLoopFor(LInst->getParent());
> -  const SCEV *PtrSCEV = SE.getSCEVAtScope(LInst->getPointerOperand(), L);
> +  auto *Ptr = LInst->getPointerOperand();
> +  const SCEV *PtrSCEV = SE.getSCEVAtScope(Ptr, L);
>     while (L && R.contains(L)) {
>       if (!SE.isLoopInvariant(PtrSCEV, L))
>         return false;
>       L = L->getParentLoop();
>     }
>   
> +  for (auto *User : Ptr->users()) {

Please add a comment here describing the heuristic.

Iterating over the use-list of a ConstantData is (will be? I forget) not 
allowed; see 
http://lists.llvm.org/pipermail/llvm-dev/2016-September/105157.html .

-Eli

-- 
Employee of Qualcomm Innovation Center, Inc.
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project



More information about the llvm-commits mailing list