diff options
| author | James Molloy <james.molloy@arm.com> | 2012-03-01 14:32:18 +0000 |
|---|---|---|
| committer | James Molloy <james.molloy@arm.com> | 2012-03-01 14:32:18 +0000 |
| commit | f6298e928177a6282a159c6cadd45582513e9cef (patch) | |
| tree | b05b4ce0492942bf9e523f1fff75c5809cdc1627 /llvm/test | |
| parent | e39d7ac3963d8d95f9fad0edec6c22e64dcdbd0b (diff) | |
| download | bcm5719-llvm-f6298e928177a6282a159c6cadd45582513e9cef.tar.gz bcm5719-llvm-f6298e928177a6282a159c6cadd45582513e9cef.zip | |
Fix a codegen fault in which log2 or exp2 could be dead-code eliminated even though they could have sideeffects.
Only allow log2/exp2 to be converted to an intrinsic if they are declared "readnone".
llvm-svn: 151807
Diffstat (limited to 'llvm/test')
| -rw-r--r-- | llvm/test/CodeGen/ARM/log2_not_readnone.ll | 15 | ||||
| -rw-r--r-- | llvm/test/CodeGen/X86/log2_not_readnone.ll | 15 |
2 files changed, 30 insertions, 0 deletions
diff --git a/llvm/test/CodeGen/ARM/log2_not_readnone.ll b/llvm/test/CodeGen/ARM/log2_not_readnone.ll new file mode 100644 index 00000000000..4d567eda65d --- /dev/null +++ b/llvm/test/CodeGen/ARM/log2_not_readnone.ll @@ -0,0 +1,15 @@ +; RUN: llc -march arm %s -o - | FileCheck %s + +; Log2 and exp2 are string-matched to intrinsics. If they are not declared +; readnone, they can't be changed to intrinsics (because they can change errno). + +declare double @log2(double) +declare double @exp2(double) + +define void @f() { + ; CHECK: bl log2 + %1 = call double @log2(double 0.000000e+00) + ; CHECK: bl exp2 + %2 = call double @exp2(double 0.000000e+00) + ret void +} diff --git a/llvm/test/CodeGen/X86/log2_not_readnone.ll b/llvm/test/CodeGen/X86/log2_not_readnone.ll new file mode 100644 index 00000000000..a971b0b442f --- /dev/null +++ b/llvm/test/CodeGen/X86/log2_not_readnone.ll @@ -0,0 +1,15 @@ +; RUN: llc -march x86 %s -o - | FileCheck %s + +; Log2 and exp2 are string-matched to intrinsics. If they are not declared +; readnone, they can't be changed to intrinsics (because they can change errno). + +declare double @log2(double) +declare double @exp2(double) + +define void @f() { + ; CHECK: calll log2 + %1 = call double @log2(double 0.000000e+00) + ; CHECK: calll exp2 + %2 = call double @exp2(double 0.000000e+00) + ret void +} |

