diff options
author | Sanjoy Das <sanjoy@playingwithpointers.com> | 2015-11-26 01:16:05 +0000 |
---|---|---|
committer | Sanjoy Das <sanjoy@playingwithpointers.com> | 2015-11-26 01:16:05 +0000 |
commit | bcd150362aff56aafdecb5545b36a50c00c63cd5 (patch) | |
tree | 2a33305e568d5cbc9fe1735a13e543ba22965837 /llvm/test/Feature/OperandBundles/early-cse.ll | |
parent | 5cad22519d7e70b7fd78db348e56314360b625ee (diff) | |
download | bcm5719-llvm-bcd150362aff56aafdecb5545b36a50c00c63cd5.tar.gz bcm5719-llvm-bcd150362aff56aafdecb5545b36a50c00c63cd5.zip |
[OperandBundles] Treat "deopt" operand bundles specially
Teach LLVM optimize to more precisely in the presence of "deopt" operand
bundles. "deopt" operand bundles imply that the call they're attached
to is at least `readonly` (i.e. they don't imply clobber semantics), and
they don't capture their bundle operands.
llvm-svn: 254118
Diffstat (limited to 'llvm/test/Feature/OperandBundles/early-cse.ll')
-rw-r--r-- | llvm/test/Feature/OperandBundles/early-cse.ll | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/llvm/test/Feature/OperandBundles/early-cse.ll b/llvm/test/Feature/OperandBundles/early-cse.ll index 076ce3baeab..fc201479d8c 100644 --- a/llvm/test/Feature/OperandBundles/early-cse.ll +++ b/llvm/test/Feature/OperandBundles/early-cse.ll @@ -2,8 +2,8 @@ ; While it is normally okay to do memory optimizations over calls to ; @readonly_function and @readnone_function, we cannot do that if -; they're carrying operand bundles since the presence of unknown -; operand bundles implies arbitrary memory effects. +; they're carrying unknown operand bundles since the presence of +; unknown operand bundles implies arbitrary memory effects. declare void @readonly_function() readonly nounwind declare void @readnone_function() readnone nounwind @@ -69,3 +69,21 @@ define void @test5(i32* %x) { ; CHECK: store i32 200, i32* %x ret void } + +define void @test6(i32* %x) { +; The "deopt" operand bundle does not make the call to +; @readonly_function read-write; and so the nounwind readonly call can +; be deleted. + +; CHECK-LABEL: @test6( + entry: + +; CHECK-NEXT: entry: +; CHECK-NEXT: store i32 200, i32* %x +; CHECK-NEXT: ret void + + store i32 100, i32* %x + call void @readonly_function() [ "deopt"() ] + store i32 200, i32* %x + ret void +} |