llvm/llvm/test/Transforms/InstCombine/apint-call-cast-target.ll

; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
; RUN: opt < %s -passes=instcombine -S | FileCheck %s

target datalayout = "e-p:32:32"
target triple = "i686-pc-linux-gnu"

define i32 @main2() {
; CHECK-LABEL: @main2(
; CHECK-NEXT:    ret i32 0
;
  ret i32 0
}

define ptr @ctime2(ptr %p) {
; CHECK-LABEL: @ctime2(
; CHECK-NEXT:    ret ptr [[P:%.*]]
;
  ret ptr %p
}

define ptr @ctime(ptr) {
; CHECK-LABEL: @ctime(
; CHECK-NEXT:  entry:
; CHECK-NEXT:    [[I0:%.*]] = call i32 @main2()
; CHECK-NEXT:    [[TMP1:%.*]] = inttoptr i32 [[I0]] to ptr
; CHECK-NEXT:    ret ptr [[TMP1]]
;
entry:
  %i0 = call ptr @main2( )
  ret ptr %i0
}

define i32 @main() {
; CHECK-LABEL: @main(
; CHECK-NEXT:  entry:
; CHECK-NEXT:    [[I1:%.*]] = call ptr @ctime2(ptr null)
; CHECK-NEXT:    [[TMP0:%.*]] = ptrtoint ptr [[I1]] to i32
; CHECK-NEXT:    ret i32 [[TMP0]]
;
entry:
  %i1 = call i32 @ctime2( ptr null )
  ret i32 %i1
}