diff options
| author | Evan Cheng <evan.cheng@apple.com> | 2011-07-13 19:08:16 +0000 |
|---|---|---|
| committer | Evan Cheng <evan.cheng@apple.com> | 2011-07-13 19:08:16 +0000 |
| commit | b94674b325143837f6941196f95525dee8482d2c (patch) | |
| tree | 3c83a68edc83c68284481499ec08f22b1db7dfb9 /llvm/lib | |
| parent | 9a881019a597d218f838fb1e2b92fba19258a5bd (diff) | |
| download | bcm5719-llvm-b94674b325143837f6941196f95525dee8482d2c.tar.gz bcm5719-llvm-b94674b325143837f6941196f95525dee8482d2c.zip | |
It's not safe to fold (fptrunc (sqrt (fpext x))) to (sqrtf x) if there is another use of sqrt. rdar://9763193
llvm-svn: 135058
Diffstat (limited to 'llvm/lib')
| -rw-r--r-- | llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp b/llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp index 036f0d33678..82c734e0b82 100644 --- a/llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp +++ b/llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp @@ -1216,7 +1216,8 @@ Instruction *InstCombiner::visitFPTrunc(FPTruncInst &CI) { CallInst *Call = dyn_cast<CallInst>(CI.getOperand(0)); if (Call && Call->getCalledFunction() && Call->getCalledFunction()->getName() == "sqrt" && - Call->getNumArgOperands() == 1) { + Call->getNumArgOperands() == 1 && + Call->hasOneUse()) { CastInst *Arg = dyn_cast<CastInst>(Call->getArgOperand(0)); if (Arg && Arg->getOpcode() == Instruction::FPExt && CI.getType()->isFloatTy() && |

