xref: /llvm-project/llvm/test/CodeGen/X86/2008-12-02-dagcombine-2.ll (revision 2f448bf509432c1a19ec46ab8cbc7353c03c6280)
1; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2; RUN: llc < %s | FileCheck %s
3target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128"
4target triple = "i386-apple-darwin9.5"
5; a - a should be found and removed, leaving refs to only L and P
6define ptr @test(ptr %a, ptr %L, ptr %P) nounwind {
7; CHECK-LABEL: test:
8; CHECK:       ## %bb.0: ## %entry
9; CHECK-NEXT:    movl {{[0-9]+}}(%esp), %eax
10; CHECK-NEXT:    subl {{[0-9]+}}(%esp), %eax
11; CHECK-NEXT:    retl
12entry:
13        %0 = ptrtoint ptr %a to i32
14        %1 = ptrtoint ptr %P to i32
15        %2 = sub i32 %1, %0
16        %3 = ptrtoint ptr %L to i32
17	%4 = sub i32 %2, %3         	; <i32> [#uses=1]
18	%5 = getelementptr i8, ptr %a, i32 %4		; <ptr> [#uses=1]
19	br label %return
20
21return:		; preds = %bb3
22	ret ptr %5
23}
24