diff options
author | Sanjay Patel <spatel@rotateright.com> | 2019-11-26 17:35:10 -0500 |
---|---|---|
committer | Sanjay Patel <spatel@rotateright.com> | 2019-11-26 17:35:10 -0500 |
commit | e177c5a00da34ba61b762e2b32bd96e33b0c10b4 (patch) | |
tree | 9a5c874676bb8f9f6947977383f494a9f400a9bd /llvm/lib/Analysis | |
parent | 48a3a1e090611d1a71cb3c027e9316d048a67324 (diff) | |
download | bcm5719-llvm-e177c5a00da34ba61b762e2b32bd96e33b0c10b4.tar.gz bcm5719-llvm-e177c5a00da34ba61b762e2b32bd96e33b0c10b4.zip |
[InstSimplify] fold copysign with same args to the arg
This is correct for any value including NaN/inf.
We don't have this fold directly in the backend either,
but x86 manages to get it after converting things to bitops.
Diffstat (limited to 'llvm/lib/Analysis')
-rw-r--r-- | llvm/lib/Analysis/InstructionSimplify.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/llvm/lib/Analysis/InstructionSimplify.cpp b/llvm/lib/Analysis/InstructionSimplify.cpp index d997acb365c..7942cb09e84 100644 --- a/llvm/lib/Analysis/InstructionSimplify.cpp +++ b/llvm/lib/Analysis/InstructionSimplify.cpp @@ -5086,6 +5086,11 @@ static Value *simplifyBinaryIntrinsic(Function *F, Value *Op0, Value *Op1, return Op0; } break; + case Intrinsic::copysign: + // copysign X, X --> X + if (Op0 == Op1) + return Op0; + break; case Intrinsic::maxnum: case Intrinsic::minnum: case Intrinsic::maximum: |