Closed
Description
IR PGO is disabled on Windows right now, see #2474
@Hardcode84 found a testcase, demonstrating (most likely) a bug in LLVM:
// File: main.d
int foo()
{
return 42;
}
ldc2 main -output-ll
output:
; ModuleID = 'main.d'
source_filename = "main.d"
target datalayout = "e-m:w-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-windows-msvc"
%0 = type { i32, i32, [5 x i8] }
%object.ModuleInfo = type { i32, i32 }
$_D4main3fooFZi = comdat any
$_D4main12__ModuleInfoZ = comdat any
@_D4main12__ModuleInfoZ = global %0 { i32 -2147483644, i32 0, [5 x i8] c"main\00" }, comdat ; [#uses = 1]
@_D4main11__moduleRefZ = linkonce_odr global %object.ModuleInfo* bitcast (%0* @_D4main12__ModuleInfoZ to %object.ModuleInfo*), section ".minfo" ; [#uses = 1]
@llvm.used = appending global [1 x i8*] [i8* bitcast (%object.ModuleInfo** @_D4main11__moduleRefZ to i8*)], section "llvm.metadata" ; [#uses = 0]
; [#uses = 0]
; Function Attrs: uwtable
define i32 @_D4main3fooFZi() #0 comdat {
ret i32 42
}
attributes #0 = { uwtable "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "target-cpu"="x86-64" "target-features"="+cx16" "unsafe-fp-math"="false" }
!llvm.linker.options = !{}
!llvm.ident = !{!0}
!0 = !{!"ldc version 1.7.0git-43c02ce-dirty"}
opt -pgo-instr-gen -instrprof -verify main.ll -S
output:
comdat global value has private linkage
[1 x i64]* @__profc__D4main3fooFZi
LLVM ERROR: Broken module found, compilation aborted!
Error goes away if comdat is removed from foo
.
Metadata
Metadata
Assignees
Labels
No labels