blob: 2717228f7ee1db2b7871ebe8c9a23b82d00d6521 [file] [log] [blame]
Joel Jones9e02e2c2012-05-18 16:24:01 +00001; RUN: opt < %s -simplify-libcalls -S | FileCheck %s
Nick Lewycky4c498412009-02-13 15:31:46 +00002
Nick Lewycky02b6a6a2009-02-13 17:08:33 +00003; Test that we add nocapture to the declaration, and to the second call only.
Nick Lewycky4c498412009-02-13 15:31:46 +00004
Joel Jones9e02e2c2012-05-18 16:24:01 +00005; CHECK: declare float @strtol(i8*, i8** nocapture, i32) nounwind
Nick Lewycky02b6a6a2009-02-13 17:08:33 +00006declare float @strtol(i8* %s, i8** %endptr, i32 %base)
Nick Lewycky4c498412009-02-13 15:31:46 +00007
8define void @foo(i8* %x, i8** %endptr) {
Joel Jones9e02e2c2012-05-18 16:24:01 +00009; CHECK: call float @strtol(i8* %x, i8** %endptr, i32 10)
Nick Lewycky02b6a6a2009-02-13 17:08:33 +000010 call float @strtol(i8* %x, i8** %endptr, i32 10)
Joel Jones9e02e2c2012-05-18 16:24:01 +000011; CHECK: %2 = call float @strtol(i8* nocapture %x, i8** null, i32 10)
Nick Lewycky02b6a6a2009-02-13 17:08:33 +000012 call float @strtol(i8* %x, i8** null, i32 10)
Nick Lewycky4c498412009-02-13 15:31:46 +000013 ret void
14}