[PATCH] D40662: [PGO] Do not do counter promotion for loops without exit blocks ('infinite loops')

Vedant Kumar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 30 11:02:37 PST 2017


vsk added a comment.

With an IR-based test case, https://reviews.llvm.org/D40663 shouldn't be necessary --

  ; RUN opt -instrprof -S -o - <%s -do-counter-promotion=1 | FileCheck
  ; CHECK: store
  
  target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
  target triple = "x86_64-apple-macosx10.12.0"
  
  @__profn_foo = private constant [3 x i8] c"foo"
  
  define void @foo() {
  entry:
    br label %while.body
  
  while.body:                                       ; preds = %entry, %while.body
    call void @llvm.instrprof.increment(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @__profn_foo, i32 0, i32 0), i64 14813359968, i32 1, i32 0)
    call void (...) @bar() #2
    br label %while.body
  }
  
  declare void @bar(...)
  
  declare void @llvm.instrprof.increment(i8*, i64, i32, i32) #0
  
  attributes #0 = { nounwind }
  
  !llvm.module.flags = !{!0, !1}
  !llvm.ident = !{!2}
  
  !0 = !{i32 1, !"wchar_size", i32 4}
  !1 = !{i32 7, !"PIC Level", i32 2}
  !2 = !{!"clang version 6.0.0 (trunk 319373) (llvm/trunk 319391)"}


https://reviews.llvm.org/D40662





More information about the llvm-commits mailing list