-
Notifications
You must be signed in to change notification settings - Fork 160
Closed
Labels
enhancementNew feature or requestNew feature or requestgood first issueGood for newcomersGood for newcomers
Description
Hi,
I noticed that we miss target triple and function attributes when we lower C code to Clang IR and then LLVM IR. Do you know how can I preserve this information?
Example:
C code:
int foo() { return 0; }
When I run command clang -S -emit-llvm test.c -o -
I got the following LLVM IR:
source_filename = "test.c"
target datalayout = "e-m:e-p270:32:32-p(...)"
target triple = "x86_64-unknown-linux-gnu"
define dso_local i32 @foo() #0 {
entry:
ret i32 0
}
attributes #0 = { noinline nounwind 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"="+cx8,+fxsr,+mmx,+sse, +sse2,+x87" "tune-cpu"="generic" }
When I run mlir code gen, then I miss information about function attributes and target triple:
bin/clang -fclangir-enable t.c -emit-cir -o - | bin/cir-tool -cir-to-llvm -o - | bin/mlir-translate -mlir-to-llvmir -o -
Output is as follows:
source_filename = "LLVMDialectModule"
;No target triple information
define i32 @foo() {
;some LLMV IR instructions
}
;no function attributes for foo function
bcardosolopes
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or requestgood first issueGood for newcomersGood for newcomers