xref: /llvm-project/llvm/test/Transforms/EarlyCSE/int_sideeffect.ll (revision ac696ac4530fb3df626195e94e83649bf7114754)
1*ac696ac4SBjorn Pettersson; RUN: opt -S < %s -passes=early-cse -earlycse-debug-hash | FileCheck %s
2cee313d2SEric Christopher
3cee313d2SEric Christopherdeclare void @llvm.sideeffect()
4cee313d2SEric Christopher
5cee313d2SEric Christopher; Store-to-load forwarding across a @llvm.sideeffect.
6cee313d2SEric Christopher
7cee313d2SEric Christopher; CHECK-LABEL: s2l
8cee313d2SEric Christopher; CHECK-NOT: load
93c514d31SNikita Popovdefine float @s2l(ptr %p) {
103c514d31SNikita Popov    store float 0.0, ptr %p
11cee313d2SEric Christopher    call void @llvm.sideeffect()
123c514d31SNikita Popov    %t = load float, ptr %p
13cee313d2SEric Christopher    ret float %t
14cee313d2SEric Christopher}
15cee313d2SEric Christopher
16cee313d2SEric Christopher; Redundant load elimination across a @llvm.sideeffect.
17cee313d2SEric Christopher
18cee313d2SEric Christopher; CHECK-LABEL: rle
19cee313d2SEric Christopher; CHECK: load
20cee313d2SEric Christopher; CHECK-NOT: load
213c514d31SNikita Popovdefine float @rle(ptr %p) {
223c514d31SNikita Popov    %r = load float, ptr %p
23cee313d2SEric Christopher    call void @llvm.sideeffect()
243c514d31SNikita Popov    %s = load float, ptr %p
25cee313d2SEric Christopher    %t = fadd float %r, %s
26cee313d2SEric Christopher    ret float %t
27cee313d2SEric Christopher}
28