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

Eli Friedman eli.friedman at gmail.com
Fri Jul 27 11:16:49 PDT 2012


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



More information about the llvm-commits mailing list