mirror of
https://github.com/RPCS3/llvm.git
synced 2025-01-04 18:58:44 +00:00
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
This commit is contained in:
parent
94638f0081
commit
a45bfd31de
@ -4561,7 +4561,8 @@ void SelectionDAGLowering::visitCall(CallInst &I) {
|
|||||||
} else if (Name == "sin" || Name == "sinf" || Name == "sinl") {
|
} else if (Name == "sin" || Name == "sinf" || Name == "sinl") {
|
||||||
if (I.getNumOperands() == 2 && // Basic sanity checks.
|
if (I.getNumOperands() == 2 && // Basic sanity checks.
|
||||||
I.getOperand(1)->getType()->isFloatingPoint() &&
|
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));
|
SDValue Tmp = getValue(I.getOperand(1));
|
||||||
setValue(&I, DAG.getNode(ISD::FSIN, getCurDebugLoc(),
|
setValue(&I, DAG.getNode(ISD::FSIN, getCurDebugLoc(),
|
||||||
Tmp.getValueType(), Tmp));
|
Tmp.getValueType(), Tmp));
|
||||||
@ -4570,7 +4571,8 @@ void SelectionDAGLowering::visitCall(CallInst &I) {
|
|||||||
} else if (Name == "cos" || Name == "cosf" || Name == "cosl") {
|
} else if (Name == "cos" || Name == "cosf" || Name == "cosl") {
|
||||||
if (I.getNumOperands() == 2 && // Basic sanity checks.
|
if (I.getNumOperands() == 2 && // Basic sanity checks.
|
||||||
I.getOperand(1)->getType()->isFloatingPoint() &&
|
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));
|
SDValue Tmp = getValue(I.getOperand(1));
|
||||||
setValue(&I, DAG.getNode(ISD::FCOS, getCurDebugLoc(),
|
setValue(&I, DAG.getNode(ISD::FCOS, getCurDebugLoc(),
|
||||||
Tmp.getValueType(), Tmp));
|
Tmp.getValueType(), Tmp));
|
||||||
@ -4579,7 +4581,8 @@ void SelectionDAGLowering::visitCall(CallInst &I) {
|
|||||||
} else if (Name == "sqrt" || Name == "sqrtf" || Name == "sqrtl") {
|
} else if (Name == "sqrt" || Name == "sqrtf" || Name == "sqrtl") {
|
||||||
if (I.getNumOperands() == 2 && // Basic sanity checks.
|
if (I.getNumOperands() == 2 && // Basic sanity checks.
|
||||||
I.getOperand(1)->getType()->isFloatingPoint() &&
|
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));
|
SDValue Tmp = getValue(I.getOperand(1));
|
||||||
setValue(&I, DAG.getNode(ISD::FSQRT, getCurDebugLoc(),
|
setValue(&I, DAG.getNode(ISD::FSQRT, getCurDebugLoc(),
|
||||||
Tmp.getValueType(), Tmp));
|
Tmp.getValueType(), Tmp));
|
||||||
|
Loading…
Reference in New Issue
Block a user