diff options
author | Dale Johannesen <dalej@apple.com> | 2009-09-25 18:00:35 +0000 |
---|---|---|
committer | Dale Johannesen <dalej@apple.com> | 2009-09-25 18:00:35 +0000 |
commit | a45bfd31de14321262dd5f5123d04fc953a79ff1 (patch) | |
tree | e02657368fd156634af51ad1431ed74eeaa2b7c9 | |
parent | 94638f0081b6ec8c7cc5ad9fec8ddbdd6824d90d (diff) | |
download | external_llvm-a45bfd31de14321262dd5f5123d04fc953a79ff1.zip external_llvm-a45bfd31de14321262dd5f5123d04fc953a79ff1.tar.gz external_llvm-a45bfd31de14321262dd5f5123d04fc953a79ff1.tar.bz2 |
Make sure sin, cos, sqrt calls are marked readonly
before producing FSIN, FCOS, FSQRT. If they aren't
so marked we have to assume they might set errno.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82781 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp b/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp index 8431e20..a27fbe6 100644 --- a/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp +++ b/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp @@ -4561,7 +4561,8 @@ void SelectionDAGLowering::visitCall(CallInst &I) { } else if (Name == "sin" || Name == "sinf" || Name == "sinl") { if (I.getNumOperands() == 2 && // Basic sanity checks. I.getOperand(1)->getType()->isFloatingPoint() && - I.getType() == I.getOperand(1)->getType()) { + I.getType() == I.getOperand(1)->getType() && + I.onlyReadsMemory()) { SDValue Tmp = getValue(I.getOperand(1)); setValue(&I, DAG.getNode(ISD::FSIN, getCurDebugLoc(), Tmp.getValueType(), Tmp)); @@ -4570,7 +4571,8 @@ void SelectionDAGLowering::visitCall(CallInst &I) { } else if (Name == "cos" || Name == "cosf" || Name == "cosl") { if (I.getNumOperands() == 2 && // Basic sanity checks. I.getOperand(1)->getType()->isFloatingPoint() && - I.getType() == I.getOperand(1)->getType()) { + I.getType() == I.getOperand(1)->getType() && + I.onlyReadsMemory()) { SDValue Tmp = getValue(I.getOperand(1)); setValue(&I, DAG.getNode(ISD::FCOS, getCurDebugLoc(), Tmp.getValueType(), Tmp)); @@ -4579,7 +4581,8 @@ void SelectionDAGLowering::visitCall(CallInst &I) { } 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.getType() == I.getOperand(1)->getType() && + I.onlyReadsMemory()) { SDValue Tmp = getValue(I.getOperand(1)); setValue(&I, DAG.getNode(ISD::FSQRT, getCurDebugLoc(), Tmp.getValueType(), Tmp)); |