summaryrefslogtreecommitdiffstats
path: root/llvm/test/CodeGen/X86/foldmem_cycle.ll
blob: 78ac9f29b16d0db59d96ca777098918d6f2ce9b7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
; RUN: llc < %s -mtriple=x86_64-unknown-linux-gnu | FileCheck %s --check-prefix=X64

; The load should not be merged with the and asit causes a cycle in the DAG.

define void @foo() {
; X64-LABEL: foo:
; X64:       # %bb.0: # %entry
; X64-NEXT:    pushq %rbx
; X64-NEXT:    .cfi_def_cfa_offset 16
; X64-NEXT:    .cfi_offset %rbx, -16
; X64-NEXT:    movl (%rax), %ebx
; X64-NEXT:    callq bar
; X64-NEXT:    testl %ebx, %eax
; X64-NEXT:    jne .LBB0_2
; X64-NEXT:  # %bb.1: # %if.then
; X64-NEXT:    popq %rbx
; X64-NEXT:    retq
; X64-NEXT:  .LBB0_2: # %if.end
entry:
  %0 = load i32, i32* undef
  %call = tail call i32 @bar()
  %and = and i32 %call, %0
  %tobool = icmp eq i32 %and, 0
  br i1 %tobool, label %if.then, label %if.end

if.then:
  ret void

if.end:
  unreachable
}

declare i32 @bar()
OpenPOWER on IntegriCloud