[PATCH] Rename PerBBDivCache to DivCache in BypassSlowDivision.

Tyler Nowicki via llvm-commits llvm-commits at lists.llvm.org
Wed Dec 9 08:46:40 PST 2015


Hi Justin, Hal,

It is a BB level cache. bypassSlowDivision() is executed once per BasicBlock. Notice that the DivCache is locally defined in bypassSlowDivision(). So the cache would be empty when %Ret2 is encountered.

Tyler

From: Hal Finkel
Sent: December 9, 2015 7:16 AM
To: Justin Lebar
Cc: preston gurd;llvm-commits;Tyler Nowicki
Subject: Re: [PATCH] Rename PerBBDivCache to DivCache in BypassSlowDivision.


Hi Justin,

You seem to be right, but the code does not seem to be setup correctly for a function-level cache. Specifically, it seems to be missing a dominance check before reusing the result of the previous division expansion. Thus, if we have:

%Dividend = ...
%Divisor = ...

if (%whatever) {
  %Ret = %Dividend / %Divisor;
} else {
  %Ret2 = %Dividend / %Divisor;
}

what prevents this code from "reusing" the expansion for %Ret upon encountering %Ret2?

-Hal

----- Original Message -----
> From: "Justin Lebar via llvm-commits" <llvm-commits at lists.llvm.org>
> To: "llvm-commits" <llvm-commits at lists.llvm.org>
> Cc: "preston gurd" <preston.gurd at intel.com>
> Sent: Tuesday, December 8, 2015 12:12:22 PM
> Subject: [PATCH] Rename PerBBDivCache to DivCache in BypassSlowDivision.
> 
> This hashtable is used for the whole function, not just the BB.
> 
> No functional changes.
> ---
>  lib/Transforms/Utils/BypassSlowDivision.cpp | 13 ++++++-------
>  1 file changed, 6 insertions(+), 7 deletions(-)
> 
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
> 

-- 
Hal Finkel
Assistant Computational Scientist
Leadership Computing Facility
Argonne National Laboratory


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20151209/ffe98ebc/attachment.html>


More information about the llvm-commits mailing list