27 lines · plain
1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 22; Regression test for PR51200.3;4; RUN: opt < %s -passes=instcombine -S | FileCheck %s5;6; This transformation requires the pointer size, as it assumes that size_t is7; the size of a pointer.8 9@percent_s = constant [3 x i8] c"%s\00"10 11declare i32 @sprintf(ptr, ptr, ...)12 13define i32 @PR51200(ptr %p, ptr %p2) {14; CHECK-LABEL: define i32 @PR5120015; CHECK-SAME: (ptr [[P:%.*]], ptr [[P2:%.*]]) {16; CHECK-NEXT: [[STPCPY:%.*]] = call ptr @stpcpy(ptr [[P]], ptr [[P2]])17; CHECK-NEXT: [[TMP1:%.*]] = ptrtoint ptr [[STPCPY]] to i6418; CHECK-NEXT: [[TMP2:%.*]] = ptrtoint ptr [[P]] to i6419; CHECK-NEXT: [[TMP3:%.*]] = sub i64 [[TMP1]], [[TMP2]]20; CHECK-NEXT: [[CALL:%.*]] = trunc i64 [[TMP3]] to i3221; CHECK-NEXT: ret i32 [[CALL]]22;23; Don't check anything, just expect the test to compile successfully.24 %call = call i32 (ptr, ptr, ...) @sprintf(ptr %p, ptr @percent_s, ptr %p2)25 ret i32 %call26}27