[llvm-commits] [llvm] r93448 - /llvm/trunk/lib/Analysis/InlineCost.cpp
Duncan Sands
baldrick at free.fr
Fri Jan 15 00:10:28 PST 2010
Hi Eric, if you check the code in SelectionDAGBuilder.cpp, you will see that
it checks more than just the name before deciding whether to change into a
SDag node. For example, here is the code for sqrt:
} else if (Name == "sqrt" || Name == "sqrtf" || Name == "sqrtl") {
if (I.getNumOperands() == 2 && // Basic sanity checks.
I.getOperand(1)->getType()->isFloatingPoint() &&
I.getType() == I.getOperand(1)->getType() &&
I.onlyReadsMemory()) {
SDValue Tmp = getValue(I.getOperand(1));
setValue(&I, DAG.getNode(ISD::FSQRT, getCurDebugLoc(),
Tmp.getValueType(), Tmp));
return;
}
Notice how it checks I.onlyReadsMemory to see if sqrt writes errno or not?
Also, your code (and that in SDag) suffers from not being turn-offable.
How about factoring the checks out of SelectionDAGBuilder.cpp and reusing
them here?
Ciao,
Duncan.
More information about the llvm-commits
mailing list