mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-22 18:54:02 +01:00
[PGO] Skip counter promotion for infinite loops
Differential Revision: http://reviews.llvm.org/D40662 llvm-svn: 319462
This commit is contained in:
parent
f0ba71f375
commit
c9f71e7ca6
@ -245,6 +245,9 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool run(int64_t *NumPromoted) {
|
bool run(int64_t *NumPromoted) {
|
||||||
|
// Skip 'infinite' loops:
|
||||||
|
if (ExitBlocks.size() == 0)
|
||||||
|
return false;
|
||||||
unsigned MaxProm = getMaxNumOfPromotionsInLoop(&L);
|
unsigned MaxProm = getMaxNumOfPromotionsInLoop(&L);
|
||||||
if (MaxProm == 0)
|
if (MaxProm == 0)
|
||||||
return false;
|
return false;
|
||||||
|
21
test/Transforms/PGOProfile/infinite_loop.ll
Normal file
21
test/Transforms/PGOProfile/infinite_loop.ll
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
; RUN: opt < %s -instrprof -S -o - -do-counter-promotion=1 | FileCheck %s
|
||||||
|
; CHECK: store
|
||||||
|
|
||||||
|
@__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 }
|
||||||
|
|
Loading…
Reference in New Issue
Block a user