[llvm-commits] [PATCH]IDIV->DIVB Atom Optimization

Nowicki, Tyler tyler.nowicki at intel.com
Tue Jul 31 13:25:20 PDT 2012


Thanks for the review. Good catch on the missing check, I've also made use of DenseMap as suggested. Test cases omitted from the previously patch are in place again and a test case for the missing check you found has been added.

Please review my corrections.

Tyler Nowicki
Intel

> -----Original Message-----
> From: Eli Friedman [mailto:eli.friedman at gmail.com]
> Sent: Friday, July 27, 2012 2:17 PM
> To: Nowicki, Tyler
> Cc: Sean Silva; llvm-commits at cs.uiuc.edu
> Subject: Re: [llvm-commits] [PATCH]IDIV->DIVB Atom Optimization
> 
> On Fri, Jul 27, 2012 at 8:35 AM, Nowicki, Tyler <tyler.nowicki at intel.com>
> wrote:
> > This patch has not yet been reviewed. Could someone take a look at it?
> 
> +    typedef std::pair<Value *, Value *> DivBOperands; //Dividend
> Value, Divisor Value
> +    typedef std::pair<PHINode *, PHINode *> DivBPhiNodes; //Quotient
> PHI, Remainder Phi
> +    typedef std::map<DivBOperands, DivBPhiNodes> DivBCacheTy;
> 
> llvm::DenseMap?
> 
> +  // Replace operation value with previously generated phi node
> + DivBPhiNodes Value = CacheI->second;  if (UseDivOp) {
> +    // Replace all uses of div instruction with quotient phi node
> +    J->replaceAllUsesWith(Value.first);
> +  } else {
> +    // Replace all uses of rem instruction with remainder phi node
> +    J->replaceAllUsesWith(Value.second);
> +  }
> 
> Looks like there's a missing check for UseSignedOp here.
> 
> The patch doesn't appear to include any testcases.
> 
> -Eli
-------------- next part --------------
A non-text attachment was scrubbed...
Name: idivtodivb-svn.patch
Type: application/octet-stream
Size: 19604 bytes
Desc: idivtodivb-svn.patch
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20120731/c5c9f358/attachment.obj>


More information about the llvm-commits mailing list