1; RUN: opt < %s -inline -S | FileCheck %s 2 3; InlineCost used to have problems with the ptrtoint, leading to 4; crashes when visiting the trunc in pr47969_help and the icmp in 5; pr38500_help. 6 7target datalayout = "p:16:16" 8target triple = "x86_64-unknown-linux-gnu" 9 10define void @pr47969_help(i16* %p) { 11 %cast = ptrtoint i16* %p to i32 12 %sub = sub i32 %cast, %cast 13 %conv = trunc i32 %sub to i16 14 ret void 15} 16 17define void @pr47969(i16* %x) { 18 call void @pr47969_help(i16* %x) 19 ret void 20} 21 22; CHECK-LABEL: @pr47969(i16* %x) 23; CHECK-NOT: call 24; CHECK: ret void 25 26define void @pr38500_help(i16* %p) { 27 %cast = ptrtoint i16* %p to i32 28 %sub = sub i32 %cast, %cast 29 %cmp = icmp eq i32 %sub, 0 30 ret void 31} 32 33define void @pr38500(i16* %x) { 34 call void @pr38500_help(i16* %x) 35 ret void 36} 37 38; CHECK-LABEL: @pr38500(i16* %x) 39; CHECK-NOT: call 40; CHECK: ret void 41