1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387
|
;; Test to make sure that function's definiton and summary matches.
; RUN: split-file %s %t
; RUN: opt -thinlto-bc %t/main.ll >%t/main.o
; RUN: opt -thinlto-bc %t/b.ll >%t/b.o
; RUN: opt -thinlto-bc %t/c.ll >%t/c.o
; RUN: llvm-lto2 run %t/b.o %t/c.o %t/main.o -enable-memprof-context-disambiguation \
; RUN: -supports-hot-cold-new -o %t/a.out \
; RUN: -r=%t/main.o,main,plx \
; RUN: -r=%t/b.o,_Z1bv,plx \
; RUN: -r=%t/b.o,_Z3fooIiET_S0_S0_,plx \
; RUN: -r=%t/b.o,_Znwm \
; RUN: -r=%t/c.o,_Z1cv,plx \
; RUN: -r=%t/c.o,_Z3fooIiET_S0_S0_ \
; RUN: -r=%t/c.o,_Z3barIiET_S0_S0_,plx \
; RUN: -r=%t/c.o,_Znwm \
; RUN: -r=%t/main.o,_Z1bv \
; RUN: -r=%t/main.o,_Z1cv \
; RUN: -r=%t/main.o,_Z3fooIiET_S0_S0_
;; foo has two copys:
;; foo in b.ll is prevailing and inlines bar.
;; foo in c.ll isn't prevailing and doesn't inline bar.
;; main will import foo in c.ll and foo's summary in b.ll default.
;--- main.ll
; ModuleID = 'main.cc'
source_filename = "main.cc"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"
; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #0 {
entry:
%retval = alloca i32, align 4
store i32 0, ptr %retval, align 4
%call = call noundef i32 @_Z1bv(), !callsite !6
%call1 = call noundef i32 @_Z1cv(), !callsite !7
%add = add nsw i32 %call, %call1
%call2 = call noundef i32 @_Z3fooIiET_S0_S0_(i32 noundef 1, i32 noundef 2), !callsite !8
%add3 = add nsw i32 %add, %call2
ret i32 %add3
}
declare noundef i32 @_Z1bv() #1
declare noundef i32 @_Z1cv() #1
declare noundef i32 @_Z3fooIiET_S0_S0_(i32 noundef, i32 noundef) #1
attributes #0 = { mustprogress norecurse uwtable "frame-pointer"="all" "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { "frame-pointer"="all" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
!llvm.module.flags = !{!0, !1, !2, !3, !4}
!llvm.ident = !{!5}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{i32 7, !"frame-pointer", i32 2}
!5 = !{!"clang version 19.0.0"}
!6 = !{i64 1}
!7 = !{i64 5}
!8 = !{i64 7}
;--- c.ll
; ModuleID = 'c.cc'
source_filename = "c.cc"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"
$_Z3fooIiET_S0_S0_ = comdat any
$_Z3barIiET_S0_S0_ = comdat any
; Function Attrs: mustprogress noinline optnone uwtable
define dso_local noundef i32 @_Z1cv() #0 {
entry:
%num1 = alloca i32, align 4
%num2 = alloca i32, align 4
store i32 1, ptr %num1, align 4
store i32 1, ptr %num2, align 4
%0 = load i32, ptr %num1, align 4
%1 = load i32, ptr %num2, align 4
%call = call noundef i32 @_Z3fooIiET_S0_S0_(i32 noundef %0, i32 noundef %1), !callsite !6
ret i32 %call
}
; Function Attrs: mustprogress uwtable
define linkonce_odr dso_local noundef i32 @_Z3fooIiET_S0_S0_(i32 noundef %a, i32 noundef %b) #3 comdat {
entry:
%a.addr = alloca i32, align 4
%b.addr = alloca i32, align 4
%rtn = alloca i32, align 4
store i32 %a, ptr %a.addr, align 4
store i32 %b, ptr %b.addr, align 4
%0 = load i32, ptr %a.addr, align 4
%1 = load i32, ptr %b.addr, align 4
%call = call noundef i32 @_Z3barIiET_S0_S0_(i32 noundef %0, i32 noundef %1), !callsite !7
store i32 %call, ptr %rtn, align 4
%2 = load i32, ptr %rtn, align 4
ret i32 %2
}
; Function Attrs: mustprogress noinline optnone uwtable
define linkonce_odr dso_local noundef i32 @_Z3barIiET_S0_S0_(i32 noundef %a, i32 noundef %b) #0 comdat {
entry:
%a.addr = alloca i32, align 4
%b.addr = alloca i32, align 4
%c = alloca ptr, align 8
%d = alloca ptr, align 8
store i32 %a, ptr %a.addr, align 4
store i32 %b, ptr %b.addr, align 4
%0 = load i32, ptr %a.addr, align 4
%add = add nsw i32 %0, 1
store i32 %add, ptr %a.addr, align 4
%1 = load i32, ptr %b.addr, align 4
%add1 = add nsw i32 %1, 1
store i32 %add1, ptr %b.addr, align 4
%2 = load i32, ptr %a.addr, align 4
%add2 = add nsw i32 %2, 1
store i32 %add2, ptr %a.addr, align 4
%3 = load i32, ptr %b.addr, align 4
%add3 = add nsw i32 %3, 1
store i32 %add3, ptr %b.addr, align 4
%4 = load i32, ptr %a.addr, align 4
%add4 = add nsw i32 %4, 1
store i32 %add4, ptr %a.addr, align 4
%5 = load i32, ptr %b.addr, align 4
%add5 = add nsw i32 %5, 1
store i32 %add5, ptr %b.addr, align 4
%6 = load i32, ptr %a.addr, align 4
%add6 = add nsw i32 %6, 1
store i32 %add6, ptr %a.addr, align 4
%7 = load i32, ptr %b.addr, align 4
%add7 = add nsw i32 %7, 1
store i32 %add7, ptr %b.addr, align 4
%8 = load i32, ptr %a.addr, align 4
%add8 = add nsw i32 %8, 1
store i32 %add8, ptr %a.addr, align 4
%9 = load i32, ptr %b.addr, align 4
%add9 = add nsw i32 %9, 1
store i32 %add9, ptr %b.addr, align 4
%10 = load i32, ptr %a.addr, align 4
%add10 = add nsw i32 %10, 1
store i32 %add10, ptr %a.addr, align 4
%11 = load i32, ptr %b.addr, align 4
%add11 = add nsw i32 %11, 1
store i32 %add11, ptr %b.addr, align 4
%12 = load i32, ptr %a.addr, align 4
%add12 = add nsw i32 %12, 1
store i32 %add12, ptr %a.addr, align 4
%13 = load i32, ptr %b.addr, align 4
%add13 = add nsw i32 %13, 1
store i32 %add13, ptr %b.addr, align 4
%14 = load i32, ptr %a.addr, align 4
%add14 = add nsw i32 %14, 1
store i32 %add14, ptr %a.addr, align 4
%15 = load i32, ptr %b.addr, align 4
%add15 = add nsw i32 %15, 1
store i32 %add15, ptr %b.addr, align 4
%16 = load i32, ptr %a.addr, align 4
%add16 = add nsw i32 %16, 1
store i32 %add16, ptr %a.addr, align 4
%17 = load i32, ptr %b.addr, align 4
%add17 = add nsw i32 %17, 1
store i32 %add17, ptr %b.addr, align 4
%18 = load i32, ptr %a.addr, align 4
%add18 = add nsw i32 %18, 1
store i32 %add18, ptr %a.addr, align 4
%19 = load i32, ptr %b.addr, align 4
%add19 = add nsw i32 %19, 1
store i32 %add19, ptr %b.addr, align 4
%20 = load i32, ptr %a.addr, align 4
%add20 = add nsw i32 %20, 1
store i32 %add20, ptr %a.addr, align 4
%21 = load i32, ptr %b.addr, align 4
%add21 = add nsw i32 %21, 1
store i32 %add21, ptr %b.addr, align 4
%22 = load i32, ptr %a.addr, align 4
%add22 = add nsw i32 %22, 1
store i32 %add22, ptr %a.addr, align 4
%23 = load i32, ptr %b.addr, align 4
%add23 = add nsw i32 %23, 1
store i32 %add23, ptr %b.addr, align 4
%call = call noalias noundef nonnull ptr @_Znwm(i64 noundef 4) #2, !callsite !8
store i32 1, ptr %call, align 4
store ptr %call, ptr %c, align 8
%call24 = call noalias noundef nonnull ptr @_Znwm(i64 noundef 4) #2, !callsite !9
store i32 1, ptr %call24, align 4
store ptr %call24, ptr %d, align 8
%24 = load i32, ptr %a.addr, align 4
%25 = load i32, ptr %b.addr, align 4
%cmp = icmp sgt i32 %24, %25
br i1 %cmp, label %cond.true, label %cond.false
cond.true: ; preds = %entry
%26 = load i32, ptr %a.addr, align 4
br label %cond.end
cond.false: ; preds = %entry
%27 = load i32, ptr %b.addr, align 4
br label %cond.end
cond.end: ; preds = %cond.false, %cond.true
%cond = phi i32 [ %26, %cond.true ], [ %27, %cond.false ]
ret i32 %cond
}
; Function Attrs: nobuiltin allocsize(0)
declare noundef nonnull ptr @_Znwm(i64 noundef) #1
attributes #0 = { mustprogress noinline optnone uwtable "frame-pointer"="all" "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nobuiltin allocsize(0) "frame-pointer"="all" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { builtin allocsize(0) }
attributes #3 = { mustprogress uwtable "frame-pointer"="all" "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
!llvm.module.flags = !{!0, !1, !2, !3, !4}
!llvm.ident = !{!5}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{i32 7, !"frame-pointer", i32 2}
!5 = !{!"clang version 19.0.0"}
!6 = !{i64 6}
!7 = !{i64 3}
!8 = !{i64 4}
!9 = !{i64 9}
;--- b.ll
; ModuleID = 'b.cc'
source_filename = "b.cc"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"
$_Z3fooIiET_S0_S0_ = comdat any
; Function Attrs: mustprogress noinline optnone uwtable
define dso_local noundef i32 @_Z1bv() #0 {
entry:
%num1 = alloca i32, align 4
%num2 = alloca i32, align 4
store i32 0, ptr %num1, align 4
store i32 0, ptr %num2, align 4
%0 = load i32, ptr %num1, align 4
%1 = load i32, ptr %num2, align 4
%call = call noundef i32 @_Z3fooIiET_S0_S0_(i32 noundef %0, i32 noundef %1), !callsite !6
ret i32 %call
}
; Function Attrs: mustprogress uwtable
define linkonce_odr dso_local noundef i32 @_Z3fooIiET_S0_S0_(i32 noundef %a, i32 noundef %b) #3 comdat {
entry:
%a.addr.i = alloca i32, align 4
%b.addr.i = alloca i32, align 4
%c.i = alloca ptr, align 8
%d.i = alloca ptr, align 8
%a.addr = alloca i32, align 4
%b.addr = alloca i32, align 4
%rtn = alloca i32, align 4
store i32 %a, ptr %a.addr, align 4
store i32 %b, ptr %b.addr, align 4
%0 = load i32, ptr %a.addr, align 4
%1 = load i32, ptr %b.addr, align 4
store i32 %0, ptr %a.addr.i, align 4
store i32 %1, ptr %b.addr.i, align 4
%2 = load i32, ptr %a.addr.i, align 4
%add.i = add nsw i32 %2, 1
store i32 %add.i, ptr %a.addr.i, align 4
%3 = load i32, ptr %b.addr.i, align 4
%add1.i = add nsw i32 %3, 1
store i32 %add1.i, ptr %b.addr.i, align 4
%4 = load i32, ptr %a.addr.i, align 4
%add2.i = add nsw i32 %4, 1
store i32 %add2.i, ptr %a.addr.i, align 4
%5 = load i32, ptr %b.addr.i, align 4
%add3.i = add nsw i32 %5, 1
store i32 %add3.i, ptr %b.addr.i, align 4
%6 = load i32, ptr %a.addr.i, align 4
%add4.i = add nsw i32 %6, 1
store i32 %add4.i, ptr %a.addr.i, align 4
%7 = load i32, ptr %b.addr.i, align 4
%add5.i = add nsw i32 %7, 1
store i32 %add5.i, ptr %b.addr.i, align 4
%8 = load i32, ptr %a.addr.i, align 4
%add6.i = add nsw i32 %8, 1
store i32 %add6.i, ptr %a.addr.i, align 4
%9 = load i32, ptr %b.addr.i, align 4
%add7.i = add nsw i32 %9, 1
store i32 %add7.i, ptr %b.addr.i, align 4
%10 = load i32, ptr %a.addr.i, align 4
%add8.i = add nsw i32 %10, 1
store i32 %add8.i, ptr %a.addr.i, align 4
%11 = load i32, ptr %b.addr.i, align 4
%add9.i = add nsw i32 %11, 1
store i32 %add9.i, ptr %b.addr.i, align 4
%12 = load i32, ptr %a.addr.i, align 4
%add10.i = add nsw i32 %12, 1
store i32 %add10.i, ptr %a.addr.i, align 4
%13 = load i32, ptr %b.addr.i, align 4
%add11.i = add nsw i32 %13, 1
store i32 %add11.i, ptr %b.addr.i, align 4
%14 = load i32, ptr %a.addr.i, align 4
%add12.i = add nsw i32 %14, 1
store i32 %add12.i, ptr %a.addr.i, align 4
%15 = load i32, ptr %b.addr.i, align 4
%add13.i = add nsw i32 %15, 1
store i32 %add13.i, ptr %b.addr.i, align 4
%16 = load i32, ptr %a.addr.i, align 4
%add14.i = add nsw i32 %16, 1
store i32 %add14.i, ptr %a.addr.i, align 4
%17 = load i32, ptr %b.addr.i, align 4
%add15.i = add nsw i32 %17, 1
store i32 %add15.i, ptr %b.addr.i, align 4
%18 = load i32, ptr %a.addr.i, align 4
%add16.i = add nsw i32 %18, 1
store i32 %add16.i, ptr %a.addr.i, align 4
%19 = load i32, ptr %b.addr.i, align 4
%add17.i = add nsw i32 %19, 1
store i32 %add17.i, ptr %b.addr.i, align 4
%20 = load i32, ptr %a.addr.i, align 4
%add18.i = add nsw i32 %20, 1
store i32 %add18.i, ptr %a.addr.i, align 4
%21 = load i32, ptr %b.addr.i, align 4
%add19.i = add nsw i32 %21, 1
store i32 %add19.i, ptr %b.addr.i, align 4
%22 = load i32, ptr %a.addr.i, align 4
%add20.i = add nsw i32 %22, 1
store i32 %add20.i, ptr %a.addr.i, align 4
%23 = load i32, ptr %b.addr.i, align 4
%add21.i = add nsw i32 %23, 1
store i32 %add21.i, ptr %b.addr.i, align 4
%24 = load i32, ptr %a.addr.i, align 4
%add22.i = add nsw i32 %24, 1
store i32 %add22.i, ptr %a.addr.i, align 4
%25 = load i32, ptr %b.addr.i, align 4
%add23.i = add nsw i32 %25, 1
store i32 %add23.i, ptr %b.addr.i, align 4
%call.i = call noalias noundef nonnull ptr @_Znwm(i64 noundef 4) #2, !callsite !7
store i32 1, ptr %call.i, align 4
store ptr %call.i, ptr %c.i, align 8
%call24.i = call noalias noundef nonnull ptr @_Znwm(i64 noundef 4) #2, !callsite !8
store i32 1, ptr %call24.i, align 4
store ptr %call24.i, ptr %d.i, align 8
%26 = load i32, ptr %a.addr.i, align 4
%27 = load i32, ptr %b.addr.i, align 4
%cmp.i = icmp sgt i32 %26, %27
br i1 %cmp.i, label %cond.true.i, label %cond.false.i
cond.true.i: ; preds = %entry
%28 = load i32, ptr %a.addr.i, align 4
br label %_Z3barIiET_S0_S0_.exit
cond.false.i: ; preds = %entry
%29 = load i32, ptr %b.addr.i, align 4
br label %_Z3barIiET_S0_S0_.exit
_Z3barIiET_S0_S0_.exit: ; preds = %cond.true.i, %cond.false.i
%cond.i = phi i32 [ %28, %cond.true.i ], [ %29, %cond.false.i ]
store i32 %cond.i, ptr %rtn, align 4
%30 = load i32, ptr %rtn, align 4
ret i32 %30
}
; Function Attrs: nobuiltin allocsize(0)
declare noundef nonnull ptr @_Znwm(i64 noundef) #1
attributes #0 = { mustprogress noinline optnone uwtable "frame-pointer"="all" "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nobuiltin allocsize(0) "frame-pointer"="all" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { builtin allocsize(0) }
attributes #3 = { mustprogress uwtable "frame-pointer"="all" "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
!llvm.module.flags = !{!0, !1, !2, !3, !4}
!llvm.ident = !{!5}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{i32 7, !"frame-pointer", i32 2}
!5 = !{!"clang version 19.0.0"}
!6 = !{i64 2}
!7 = !{i64 4, i64 3}
!8 = !{i64 9, i64 3}
|