brintos

brintos / llvm-project-archived public Read only

0
0
Text · 4.5 KiB · 18def1d Raw
123 lines · plain
1;; Similar to funcassigncloning.ll but hand modified to add another allocation2;; whose pruned cold context only includes an immediate caller node that itself3;; doesn't need cloning, but calls a cloned allocating function, and is in a4;; function that gets cloned multiple times for a different callsite. This test5;; makes sure the non-cloned callsite is correctly updated in all function6;; clones. This case was missed because, due to context pruning, we don't have7;; any caller edges for the first callsite, so the handling that kicks in to8;; "reclone" other callsites in cloned functions was being missed.9 10; RUN: opt -passes=memprof-context-disambiguation -supports-hot-cold-new \11; RUN:  -memprof-verify-ccg -memprof-verify-nodes \12; RUN:  -pass-remarks=memprof-context-disambiguation \13; RUN:  %s -S 2>&1 | FileCheck %s --check-prefix=IR --check-prefix=REMARKS14 15 16target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"17target triple = "x86_64-unknown-linux-gnu"18 19;; Eventually this function will be cloned several times (for the calls to new20;; for the various callers). However, function blah() includes an allocation21;; whose cold context was trimmed above here. We therefore should assume that22;; every caller of this function should call the same version of blah (which23;; will be the cloned ".memprof.1" version.24define internal void @_Z1EPPcS0_(ptr %buf1, ptr %buf2) #0 {25entry:26  call void @blah(), !callsite !1927  %call = call noalias noundef nonnull ptr @_Znam(i64 noundef 10) #6, !memprof !0, !callsite !728  %call1 = call noalias noundef nonnull ptr @_Znam(i64 noundef 10) #6, !memprof !8, !callsite !1529  ret void30}31 32; REMARKS: created clone blah.memprof.133; REMARKS: call in clone _Z1EPPcS0_ assigned to call function clone blah.memprof.134; REMARKS: call in clone _Z1EPPcS0_.memprof.1 assigned to call function clone blah.memprof.135; REMARKS: call in clone _Z1EPPcS0_.memprof.2 assigned to call function clone blah.memprof.136; REMARKS: call in clone _Z1EPPcS0_.memprof.3 assigned to call function clone blah.memprof.137 38; IR: define {{.*}} @_Z1EPPcS0_39; IR:   call {{.*}} @blah.memprof.1()40; IR: define {{.*}} @_Z1EPPcS0_.memprof.141; IR:   call {{.*}} @blah.memprof.1()42; IR: define {{.*}} @_Z1EPPcS0_.memprof.243; IR:   call {{.*}} @blah.memprof.1()44; IR: define {{.*}} @_Z1EPPcS0_.memprof.345; IR:   call {{.*}} @blah.memprof.1()46 47declare ptr @_Znam(i64) #148 49define internal void @_Z1BPPcS0_(ptr %0, ptr %1) {50entry:51  call void @_Z1EPPcS0_(ptr noundef %0, ptr noundef %1), !callsite !1652  ret void53}54 55; Function Attrs: noinline56define internal void @_Z1CPPcS0_(ptr %0, ptr %1) #2 {57entry:58  call void @_Z1EPPcS0_(ptr noundef %0, ptr noundef %1), !callsite !1759  ret void60}61 62define internal void @_Z1DPPcS0_(ptr %0, ptr %1) #3 {63entry:64  call void @_Z1EPPcS0_(ptr noundef %0, ptr noundef %1), !callsite !1865  ret void66}67 68define internal void @blah() #0 {69entry:70  %call = call noalias noundef nonnull ptr @_Znam(i64 noundef 10) #6, !memprof !22, !callsite !2171  ret void72}73 74define internal void @foo() #0 {75entry:76  call void @blah(), !callsite !2077  ret void78}79 80; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)81declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #482 83declare i32 @sleep() #584 85; uselistorder directives86uselistorder ptr @_Znam, { 1, 0, 2 }87 88attributes #0 = { "target-features"="+cx8,+fxsr,+mmx,+sse,+sse2,+x87" }89attributes #1 = { "no-trapping-math"="true" }90attributes #2 = { noinline }91attributes #3 = { "frame-pointer"="all" }92attributes #4 = { nocallback nofree nounwind willreturn memory(argmem: write) }93attributes #5 = { "disable-tail-calls"="true" }94attributes #6 = { builtin }95 96!0 = !{!1, !3, !5}97!1 = !{!2, !"cold"}98!2 = !{i64 -3461278137325233666, i64 -7799663586031895603}99!3 = !{!4, !"notcold"}100!4 = !{i64 -3461278137325233666, i64 -3483158674395044949}101!5 = !{!6, !"notcold"}102!6 = !{i64 -3461278137325233666, i64 -2441057035866683071}103!7 = !{i64 -3461278137325233666}104!8 = !{!9, !11, !13}105!9 = !{!10, !"notcold"}106!10 = !{i64 -1415475215210681400, i64 -2441057035866683071}107!11 = !{!12, !"cold"}108!12 = !{i64 -1415475215210681400, i64 -3483158674395044949}109!13 = !{!14, !"notcold"}110!14 = !{i64 -1415475215210681400, i64 -7799663586031895603}111!15 = !{i64 -1415475215210681400}112!16 = !{i64 -2441057035866683071}113!17 = !{i64 -3483158674395044949}114!18 = !{i64 -7799663586031895603}115!19 = !{i64 123}116!20 = !{i64 234}117!21 = !{i64 345}118!22 = !{!23, !25}119!23 = !{!24, !"cold"}120!24 = !{i64 345, i64 123}121!25 = !{!26, !"notcold"}122!26 = !{i64 345, i64 234}123