review second parameter of create_enum_attribute #269

Open
opened 2022-04-18 18:13:50 +08:00 by sb10q · 6 comments

I haven't checked if this is a LLVM 14 breaking change or if we were generating invalid IR in the first place, but this now happens:

> ./run_demo.sh src/default_param.py

; ModuleID = 'module0'
source_filename = "module0"

%Exception.11 = type { i32, %str.10, i32, i32, %str.10, %str.10, i64, i64, i64 }
%str.10 = type { i8*, i64 }

@const = private unnamed_addr constant [1 x i8] zeroinitializer, align 1
@const.1 = private unnamed_addr constant [21 x i8] c"src/default_param.py\00", align 1
@const.2 = private unnamed_addr constant [14 x i8] c"__main__.f6.0\00", align 1
@const.3 = private unnamed_addr constant [30 x i8] c"index {0} out of bounds 0:{1}\00", align 1
@const.15 = private unnamed_addr constant [1 x i8] zeroinitializer, align 1
@const.1.16 = private unnamed_addr constant [21 x i8] c"src/default_param.py\00", align 1
@const.2.17 = private unnamed_addr constant [14 x i8] c"__main__.f7.0\00", align 1

define i32 @run() personality i32 (...)* @__nac3_personality {
init:
  call void @__main__.f1.0(i32 4)
  call void @__main__.f2.0(i64 123)
  call void @__main__.f3.0(i32 234)
  call void @__main__.f4.0({ i32, { i32, i32 }, i64 } { i32 4, { i32, i32 } { i32 5, i32 6 }, i64 7 })
  call void @__main__.f5.0(double 3.450000e+00)
  call void @__main__.f6.0({ i32*, i64 }** null)
  %default_opt_some = alloca { i32, i64 }, align 8
  %tup_val10.fca.0.gep = getelementptr inbounds { i32, i64 }, { i32, i64 }* %default_opt_some, i32 0, i32 0
  store i32 3, i32* %tup_val10.fca.0.gep, align 4
  %tup_val10.fca.1.gep = getelementptr inbounds { i32, i64 }, { i32, i64 }* %default_opt_some, i32 0, i32 1
  store i64 123, i64* %tup_val10.fca.1.gep, align 4
  call void @__main__.f7.0({ i32, i64 }* %default_opt_some)
  ret i32 0
}

declare i32 @__nac3_personality(...)

define void @__main__.f1.0(i32 %0) personality i32 (...)* @__nac3_personality {
init:
  call void @output_int32(i32 %0)
  ret void
}

declare void @output_int32(i32)

define void @__main__.f2.0(i64 %0) personality i32 (...)* @__nac3_personality {
init:
  %trunc = trunc i64 %0 to i32
  call void @output_int32(i32 %trunc)
  ret void
}

define void @__main__.f3.0(i32 %0) personality i32 (...)* @__nac3_personality {
init:
  call void @output_int32(i32 %0)
  ret void
}

define void @__main__.f4.0({ i32, { i32, i32 }, i64 } %0) personality i32 (...)* @__nac3_personality {
init:
  %.fca.0.extract = extractvalue { i32, { i32, i32 }, i64 } %0, 0
  %.fca.1.0.extract = extractvalue { i32, { i32, i32 }, i64 } %0, 1, 0
  %.fca.1.1.extract = extractvalue { i32, { i32, i32 }, i64 } %0, 1, 1
  %.fca.2.extract = extractvalue { i32, { i32, i32 }, i64 } %0, 2
  call void @output_int32(i32 %.fca.0.extract)
  %tup_elem2 = extractvalue { i32, { i32, i32 }, i64 } %0, 1
  %tup_elem3 = extractvalue { i32, i32 } %tup_elem2, 0
  call void @output_int32(i32 %tup_elem3)
  %tup_elem6 = extractvalue { i32, i32 } %tup_elem2, 1
  call void @output_int32(i32 %tup_elem6)
  %trunc = trunc i64 %.fca.2.extract to i32
  call void @output_int32(i32 %trunc)
  ret void
}

define void @__main__.f5.0(double %0) personality i32 (...)* @__nac3_personality {
init:
  %fptosi = fptosi double %0 to i32
  call void @output_int32(i32 %fptosi)
  ret void
}

define void @__main__.f6.0({ i32*, i64 }** %0) personality i32 (...)* @__nac3_personality {
init:
  %is_none = icmp eq { i32*, i64 }** %0, null
  br i1 %is_none, label %body1, label %cont

body1:                                            ; preds = %init
  %tmparr = alloca i32, i64 3, align 4
  %tmparrstr = alloca { i32*, i64 }, align 8
  %len_ptr = getelementptr inbounds { i32*, i64 }, { i32*, i64 }* %tmparrstr, i32 0, i32 1
  store i64 3, i64* %len_ptr, align 4
  %ptr_to_arr = getelementptr inbounds { i32*, i64 }, { i32*, i64 }* %tmparrstr, i32 0, i32 0
  store i32* %tmparr, i32** %ptr_to_arr, align 8
  store i32 11, i32* %tmparr, align 4
  %elem_ptr3 = getelementptr i32, i32* %tmparr, i32 1
  store i32 22, i32* %elem_ptr3, align 4
  %elem_ptr4 = getelementptr i32, i32* %tmparr, i32 2
  store i32 33, i32* %elem_ptr4, align 4
  %alloca_some = alloca { i32*, i64 }*, align 8
  store { i32*, i64 }* %tmparrstr, { i32*, i64 }** %alloca_some, align 8
  br i1 true, label %succ, label %fail, !prof !0

cont:                                             ; preds = %succ13, %init
  ret void

succ:                                             ; preds = %body1
  %load9 = load i32*, i32** %ptr_to_arr, align 8
  %load11 = load i64, i64* %len_ptr, align 4
  %adjusted = add i64 2, %load11
  %inbound = icmp ult i64 2, %load11
  br i1 %inbound, label %succ13, label %fail14, !prof !0

fail:                                             ; preds = %body1
  %alloca = alloca %Exception.11, align 8
  %exn.id = getelementptr inbounds %Exception.11, %Exception.11* %alloca, i32 0, i32 0
  store i32 0, i32* %exn.id, align 4
  %exn.msg = getelementptr inbounds %Exception.11, %Exception.11* %alloca, i32 0, i32 5
  store %str.10 { i8* getelementptr inbounds ([1 x i8], [1 x i8]* @const, i32 0, i32 0), i64 0 }, %str.10* %exn.msg, align 8
  %exn.param = getelementptr inbounds %Exception.11, %Exception.11* %alloca, i32 0, i32 6
  store i64 0, i64* %exn.param, align 4
  %exn.param6 = getelementptr inbounds %Exception.11, %Exception.11* %alloca, i32 0, i32 7
  store i64 0, i64* %exn.param6, align 4
  %exn.param7 = getelementptr inbounds %Exception.11, %Exception.11* %alloca, i32 0, i32 8
  store i64 0, i64* %exn.param7, align 4
  %file_ptr = getelementptr inbounds %Exception.11, %Exception.11* %alloca, i32 0, i32 1
  store %str.10 { i8* getelementptr inbounds ([21 x i8], [21 x i8]* @const.1, i32 0, i32 0), i64 20 }, %str.10* %file_ptr, align 8
  %row_ptr = getelementptr inbounds %Exception.11, %Exception.11* %alloca, i32 0, i32 2
  store i32 26, i32* %row_ptr, align 4
  %col_ptr = getelementptr inbounds %Exception.11, %Exception.11* %alloca, i32 0, i32 3
  store i32 30, i32* %col_ptr, align 4
  %name_ptr = getelementptr inbounds %Exception.11, %Exception.11* %alloca, i32 0, i32 4
  store %str.10 { i8* getelementptr inbounds ([14 x i8], [14 x i8]* @const.2, i32 0, i32 0), i64 13 }, %str.10* %name_ptr, align 8
  call void @__nac3_raise(%Exception.11* %alloca)
  unreachable

succ13:                                           ; preds = %succ
  %gep25 = getelementptr i32, i32* %load9, i64 2
  %load26 = load i32, i32* %gep25, align 4
  call void @output_int32(i32 %load26)
  br label %cont

fail14:                                           ; preds = %succ
  %alloca15 = alloca %Exception.11, align 8
  %exn.id16 = getelementptr inbounds %Exception.11, %Exception.11* %alloca15, i32 0, i32 0
  store i32 1, i32* %exn.id16, align 4
  %exn.msg17 = getelementptr inbounds %Exception.11, %Exception.11* %alloca15, i32 0, i32 5
  store %str.10 { i8* getelementptr inbounds ([30 x i8], [30 x i8]* @const.3, i32 0, i32 0), i64 29 }, %str.10* %exn.msg17, align 8
  %exn.param18 = getelementptr inbounds %Exception.11, %Exception.11* %alloca15, i32 0, i32 6
  store i64 2, i64* %exn.param18, align 4
  %exn.param19 = getelementptr inbounds %Exception.11, %Exception.11* %alloca15, i32 0, i32 7
  store i64 %load11, i64* %exn.param19, align 4
  %exn.param20 = getelementptr inbounds %Exception.11, %Exception.11* %alloca15, i32 0, i32 8
  store i64 0, i64* %exn.param20, align 4
  %file_ptr21 = getelementptr inbounds %Exception.11, %Exception.11* %alloca15, i32 0, i32 1
  store %str.10 { i8* getelementptr inbounds ([21 x i8], [21 x i8]* @const.1, i32 0, i32 0), i64 20 }, %str.10* %file_ptr21, align 8
  %row_ptr22 = getelementptr inbounds %Exception.11, %Exception.11* %alloca15, i32 0, i32 2
  store i32 26, i32* %row_ptr22, align 4
  %col_ptr23 = getelementptr inbounds %Exception.11, %Exception.11* %alloca15, i32 0, i32 3
  store i32 32, i32* %col_ptr23, align 4
  %name_ptr24 = getelementptr inbounds %Exception.11, %Exception.11* %alloca15, i32 0, i32 4
  store %str.10 { i8* getelementptr inbounds ([14 x i8], [14 x i8]* @const.2, i32 0, i32 0), i64 13 }, %str.10* %name_ptr24, align 8
  call void @__nac3_raise(%Exception.11* %alloca15)
  unreachable
}

; Function Attrs: vscale_range(0,1)
declare void @__nac3_raise(%Exception.11*) #0

define void @__main__.f7.0({ i32, i64 }* %0) personality i32 (...)* @__nac3_personality {
init:
  %is_some = icmp ne { i32, i64 }* %0, null
  br i1 %is_some, label %body1, label %cont

body1:                                            ; preds = %init
  br i1 true, label %succ, label %fail, !prof !0

cont:                                             ; preds = %succ, %init
  ret void

succ:                                             ; preds = %body1
  %unwrap_some_load = load { i32, i64 }, { i32, i64 }* %0, align 4
  %unwrap_some_load.fca.0.extract = extractvalue { i32, i64 } %unwrap_some_load, 0
  %unwrap_some_load.fca.1.extract = extractvalue { i32, i64 } %unwrap_some_load, 1
  call void @output_int32(i32 %unwrap_some_load.fca.0.extract)
  %trunc = trunc i64 %unwrap_some_load.fca.1.extract to i32
  call void @output_int32(i32 %trunc)
  br label %cont

fail:                                             ; preds = %body1
  %alloca = alloca %Exception.11, align 8
  %exn.id = getelementptr inbounds %Exception.11, %Exception.11* %alloca, i32 0, i32 0
  store i32 0, i32* %exn.id, align 4
  %exn.msg = getelementptr inbounds %Exception.11, %Exception.11* %alloca, i32 0, i32 5
  store %str.10 { i8* getelementptr inbounds ([1 x i8], [1 x i8]* @const.15, i32 0, i32 0), i64 0 }, %str.10* %exn.msg, align 8
  %exn.param = getelementptr inbounds %Exception.11, %Exception.11* %alloca, i32 0, i32 6
  store i64 0, i64* %exn.param, align 4
  %exn.param3 = getelementptr inbounds %Exception.11, %Exception.11* %alloca, i32 0, i32 7
  store i64 0, i64* %exn.param3, align 4
  %exn.param4 = getelementptr inbounds %Exception.11, %Exception.11* %alloca, i32 0, i32 8
  store i64 0, i64* %exn.param4, align 4
  %file_ptr = getelementptr inbounds %Exception.11, %Exception.11* %alloca, i32 0, i32 1
  store %str.10 { i8* getelementptr inbounds ([21 x i8], [21 x i8]* @const.1.16, i32 0, i32 0), i64 20 }, %str.10* %file_ptr, align 8
  %row_ptr = getelementptr inbounds %Exception.11, %Exception.11* %alloca, i32 0, i32 2
  store i32 30, i32* %row_ptr, align 4
  %col_ptr = getelementptr inbounds %Exception.11, %Exception.11* %alloca, i32 0, i32 3
  store i32 28, i32* %col_ptr, align 4
  %name_ptr = getelementptr inbounds %Exception.11, %Exception.11* %alloca, i32 0, i32 4
  store %str.10 { i8* getelementptr inbounds ([14 x i8], [14 x i8]* @const.2.17, i32 0, i32 0), i64 13 }, %str.10* %name_ptr, align 8
  call void @__nac3_raise(%Exception.11* %alloca)
  unreachable
}

attributes #0 = { vscale_range(0,1) }

!0 = !{!"branch_weights", i32 2000, i32 1}

"Attribute \'vscale_range(0,1)\' should have an Argument\nvoid (%Exception.11*)* @__nac3_raise\n"
thread '<unnamed>' panicked at 'explicit panic', /home/sb/nac3/nac3core/src/codegen/mod.rs:236:13
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Got an error: explicit panic
I haven't checked if this is a LLVM 14 breaking change or if we were generating invalid IR in the first place, but this now happens: ``` > ./run_demo.sh src/default_param.py ; ModuleID = 'module0' source_filename = "module0" %Exception.11 = type { i32, %str.10, i32, i32, %str.10, %str.10, i64, i64, i64 } %str.10 = type { i8*, i64 } @const = private unnamed_addr constant [1 x i8] zeroinitializer, align 1 @const.1 = private unnamed_addr constant [21 x i8] c"src/default_param.py\00", align 1 @const.2 = private unnamed_addr constant [14 x i8] c"__main__.f6.0\00", align 1 @const.3 = private unnamed_addr constant [30 x i8] c"index {0} out of bounds 0:{1}\00", align 1 @const.15 = private unnamed_addr constant [1 x i8] zeroinitializer, align 1 @const.1.16 = private unnamed_addr constant [21 x i8] c"src/default_param.py\00", align 1 @const.2.17 = private unnamed_addr constant [14 x i8] c"__main__.f7.0\00", align 1 define i32 @run() personality i32 (...)* @__nac3_personality { init: call void @__main__.f1.0(i32 4) call void @__main__.f2.0(i64 123) call void @__main__.f3.0(i32 234) call void @__main__.f4.0({ i32, { i32, i32 }, i64 } { i32 4, { i32, i32 } { i32 5, i32 6 }, i64 7 }) call void @__main__.f5.0(double 3.450000e+00) call void @__main__.f6.0({ i32*, i64 }** null) %default_opt_some = alloca { i32, i64 }, align 8 %tup_val10.fca.0.gep = getelementptr inbounds { i32, i64 }, { i32, i64 }* %default_opt_some, i32 0, i32 0 store i32 3, i32* %tup_val10.fca.0.gep, align 4 %tup_val10.fca.1.gep = getelementptr inbounds { i32, i64 }, { i32, i64 }* %default_opt_some, i32 0, i32 1 store i64 123, i64* %tup_val10.fca.1.gep, align 4 call void @__main__.f7.0({ i32, i64 }* %default_opt_some) ret i32 0 } declare i32 @__nac3_personality(...) define void @__main__.f1.0(i32 %0) personality i32 (...)* @__nac3_personality { init: call void @output_int32(i32 %0) ret void } declare void @output_int32(i32) define void @__main__.f2.0(i64 %0) personality i32 (...)* @__nac3_personality { init: %trunc = trunc i64 %0 to i32 call void @output_int32(i32 %trunc) ret void } define void @__main__.f3.0(i32 %0) personality i32 (...)* @__nac3_personality { init: call void @output_int32(i32 %0) ret void } define void @__main__.f4.0({ i32, { i32, i32 }, i64 } %0) personality i32 (...)* @__nac3_personality { init: %.fca.0.extract = extractvalue { i32, { i32, i32 }, i64 } %0, 0 %.fca.1.0.extract = extractvalue { i32, { i32, i32 }, i64 } %0, 1, 0 %.fca.1.1.extract = extractvalue { i32, { i32, i32 }, i64 } %0, 1, 1 %.fca.2.extract = extractvalue { i32, { i32, i32 }, i64 } %0, 2 call void @output_int32(i32 %.fca.0.extract) %tup_elem2 = extractvalue { i32, { i32, i32 }, i64 } %0, 1 %tup_elem3 = extractvalue { i32, i32 } %tup_elem2, 0 call void @output_int32(i32 %tup_elem3) %tup_elem6 = extractvalue { i32, i32 } %tup_elem2, 1 call void @output_int32(i32 %tup_elem6) %trunc = trunc i64 %.fca.2.extract to i32 call void @output_int32(i32 %trunc) ret void } define void @__main__.f5.0(double %0) personality i32 (...)* @__nac3_personality { init: %fptosi = fptosi double %0 to i32 call void @output_int32(i32 %fptosi) ret void } define void @__main__.f6.0({ i32*, i64 }** %0) personality i32 (...)* @__nac3_personality { init: %is_none = icmp eq { i32*, i64 }** %0, null br i1 %is_none, label %body1, label %cont body1: ; preds = %init %tmparr = alloca i32, i64 3, align 4 %tmparrstr = alloca { i32*, i64 }, align 8 %len_ptr = getelementptr inbounds { i32*, i64 }, { i32*, i64 }* %tmparrstr, i32 0, i32 1 store i64 3, i64* %len_ptr, align 4 %ptr_to_arr = getelementptr inbounds { i32*, i64 }, { i32*, i64 }* %tmparrstr, i32 0, i32 0 store i32* %tmparr, i32** %ptr_to_arr, align 8 store i32 11, i32* %tmparr, align 4 %elem_ptr3 = getelementptr i32, i32* %tmparr, i32 1 store i32 22, i32* %elem_ptr3, align 4 %elem_ptr4 = getelementptr i32, i32* %tmparr, i32 2 store i32 33, i32* %elem_ptr4, align 4 %alloca_some = alloca { i32*, i64 }*, align 8 store { i32*, i64 }* %tmparrstr, { i32*, i64 }** %alloca_some, align 8 br i1 true, label %succ, label %fail, !prof !0 cont: ; preds = %succ13, %init ret void succ: ; preds = %body1 %load9 = load i32*, i32** %ptr_to_arr, align 8 %load11 = load i64, i64* %len_ptr, align 4 %adjusted = add i64 2, %load11 %inbound = icmp ult i64 2, %load11 br i1 %inbound, label %succ13, label %fail14, !prof !0 fail: ; preds = %body1 %alloca = alloca %Exception.11, align 8 %exn.id = getelementptr inbounds %Exception.11, %Exception.11* %alloca, i32 0, i32 0 store i32 0, i32* %exn.id, align 4 %exn.msg = getelementptr inbounds %Exception.11, %Exception.11* %alloca, i32 0, i32 5 store %str.10 { i8* getelementptr inbounds ([1 x i8], [1 x i8]* @const, i32 0, i32 0), i64 0 }, %str.10* %exn.msg, align 8 %exn.param = getelementptr inbounds %Exception.11, %Exception.11* %alloca, i32 0, i32 6 store i64 0, i64* %exn.param, align 4 %exn.param6 = getelementptr inbounds %Exception.11, %Exception.11* %alloca, i32 0, i32 7 store i64 0, i64* %exn.param6, align 4 %exn.param7 = getelementptr inbounds %Exception.11, %Exception.11* %alloca, i32 0, i32 8 store i64 0, i64* %exn.param7, align 4 %file_ptr = getelementptr inbounds %Exception.11, %Exception.11* %alloca, i32 0, i32 1 store %str.10 { i8* getelementptr inbounds ([21 x i8], [21 x i8]* @const.1, i32 0, i32 0), i64 20 }, %str.10* %file_ptr, align 8 %row_ptr = getelementptr inbounds %Exception.11, %Exception.11* %alloca, i32 0, i32 2 store i32 26, i32* %row_ptr, align 4 %col_ptr = getelementptr inbounds %Exception.11, %Exception.11* %alloca, i32 0, i32 3 store i32 30, i32* %col_ptr, align 4 %name_ptr = getelementptr inbounds %Exception.11, %Exception.11* %alloca, i32 0, i32 4 store %str.10 { i8* getelementptr inbounds ([14 x i8], [14 x i8]* @const.2, i32 0, i32 0), i64 13 }, %str.10* %name_ptr, align 8 call void @__nac3_raise(%Exception.11* %alloca) unreachable succ13: ; preds = %succ %gep25 = getelementptr i32, i32* %load9, i64 2 %load26 = load i32, i32* %gep25, align 4 call void @output_int32(i32 %load26) br label %cont fail14: ; preds = %succ %alloca15 = alloca %Exception.11, align 8 %exn.id16 = getelementptr inbounds %Exception.11, %Exception.11* %alloca15, i32 0, i32 0 store i32 1, i32* %exn.id16, align 4 %exn.msg17 = getelementptr inbounds %Exception.11, %Exception.11* %alloca15, i32 0, i32 5 store %str.10 { i8* getelementptr inbounds ([30 x i8], [30 x i8]* @const.3, i32 0, i32 0), i64 29 }, %str.10* %exn.msg17, align 8 %exn.param18 = getelementptr inbounds %Exception.11, %Exception.11* %alloca15, i32 0, i32 6 store i64 2, i64* %exn.param18, align 4 %exn.param19 = getelementptr inbounds %Exception.11, %Exception.11* %alloca15, i32 0, i32 7 store i64 %load11, i64* %exn.param19, align 4 %exn.param20 = getelementptr inbounds %Exception.11, %Exception.11* %alloca15, i32 0, i32 8 store i64 0, i64* %exn.param20, align 4 %file_ptr21 = getelementptr inbounds %Exception.11, %Exception.11* %alloca15, i32 0, i32 1 store %str.10 { i8* getelementptr inbounds ([21 x i8], [21 x i8]* @const.1, i32 0, i32 0), i64 20 }, %str.10* %file_ptr21, align 8 %row_ptr22 = getelementptr inbounds %Exception.11, %Exception.11* %alloca15, i32 0, i32 2 store i32 26, i32* %row_ptr22, align 4 %col_ptr23 = getelementptr inbounds %Exception.11, %Exception.11* %alloca15, i32 0, i32 3 store i32 32, i32* %col_ptr23, align 4 %name_ptr24 = getelementptr inbounds %Exception.11, %Exception.11* %alloca15, i32 0, i32 4 store %str.10 { i8* getelementptr inbounds ([14 x i8], [14 x i8]* @const.2, i32 0, i32 0), i64 13 }, %str.10* %name_ptr24, align 8 call void @__nac3_raise(%Exception.11* %alloca15) unreachable } ; Function Attrs: vscale_range(0,1) declare void @__nac3_raise(%Exception.11*) #0 define void @__main__.f7.0({ i32, i64 }* %0) personality i32 (...)* @__nac3_personality { init: %is_some = icmp ne { i32, i64 }* %0, null br i1 %is_some, label %body1, label %cont body1: ; preds = %init br i1 true, label %succ, label %fail, !prof !0 cont: ; preds = %succ, %init ret void succ: ; preds = %body1 %unwrap_some_load = load { i32, i64 }, { i32, i64 }* %0, align 4 %unwrap_some_load.fca.0.extract = extractvalue { i32, i64 } %unwrap_some_load, 0 %unwrap_some_load.fca.1.extract = extractvalue { i32, i64 } %unwrap_some_load, 1 call void @output_int32(i32 %unwrap_some_load.fca.0.extract) %trunc = trunc i64 %unwrap_some_load.fca.1.extract to i32 call void @output_int32(i32 %trunc) br label %cont fail: ; preds = %body1 %alloca = alloca %Exception.11, align 8 %exn.id = getelementptr inbounds %Exception.11, %Exception.11* %alloca, i32 0, i32 0 store i32 0, i32* %exn.id, align 4 %exn.msg = getelementptr inbounds %Exception.11, %Exception.11* %alloca, i32 0, i32 5 store %str.10 { i8* getelementptr inbounds ([1 x i8], [1 x i8]* @const.15, i32 0, i32 0), i64 0 }, %str.10* %exn.msg, align 8 %exn.param = getelementptr inbounds %Exception.11, %Exception.11* %alloca, i32 0, i32 6 store i64 0, i64* %exn.param, align 4 %exn.param3 = getelementptr inbounds %Exception.11, %Exception.11* %alloca, i32 0, i32 7 store i64 0, i64* %exn.param3, align 4 %exn.param4 = getelementptr inbounds %Exception.11, %Exception.11* %alloca, i32 0, i32 8 store i64 0, i64* %exn.param4, align 4 %file_ptr = getelementptr inbounds %Exception.11, %Exception.11* %alloca, i32 0, i32 1 store %str.10 { i8* getelementptr inbounds ([21 x i8], [21 x i8]* @const.1.16, i32 0, i32 0), i64 20 }, %str.10* %file_ptr, align 8 %row_ptr = getelementptr inbounds %Exception.11, %Exception.11* %alloca, i32 0, i32 2 store i32 30, i32* %row_ptr, align 4 %col_ptr = getelementptr inbounds %Exception.11, %Exception.11* %alloca, i32 0, i32 3 store i32 28, i32* %col_ptr, align 4 %name_ptr = getelementptr inbounds %Exception.11, %Exception.11* %alloca, i32 0, i32 4 store %str.10 { i8* getelementptr inbounds ([14 x i8], [14 x i8]* @const.2.17, i32 0, i32 0), i64 13 }, %str.10* %name_ptr, align 8 call void @__nac3_raise(%Exception.11* %alloca) unreachable } attributes #0 = { vscale_range(0,1) } !0 = !{!"branch_weights", i32 2000, i32 1} "Attribute \'vscale_range(0,1)\' should have an Argument\nvoid (%Exception.11*)* @__nac3_raise\n" thread '<unnamed>' panicked at 'explicit panic', /home/sb/nac3/nac3core/src/codegen/mod.rs:236:13 note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace Got an error: explicit panic ```
Poster
Owner

Attributes look broken. It was supposed to be noreturn, not vscale_range(0,1). Likely a bug in inkwell or llvm-sys.

This can be worked around by commenting out:

           fun.add_attribute(
                 AttributeLoc::Function,
                 ctx.ctx.create_enum_attribute(Attribute::get_named_enum_kind_id("noreturn"), 1),
           );

Attributes look broken. It was supposed to be ``noreturn``, not ``vscale_range(0,1)``. Likely a bug in inkwell or llvm-sys. This can be worked around by commenting out: ``` fun.add_attribute( AttributeLoc::Function, ctx.ctx.create_enum_attribute(Attribute::get_named_enum_kind_id("noreturn"), 1), ); ```
Poster
Owner
Why are we passing 1 there? In this example it's 0: https://github.com/wasmerio/wasmer/blob/master/lib/compiler-llvm/src/translator/intrinsics.rs#L1047
Poster
Owner

And using 0 seems to fix the problem.

And using 0 seems to fix the problem.
Poster
Owner
Cc @pca006132 (e3032482)
Poster
Owner

Changed to 0 in 85f21060e4

Changed to 0 in https://git.m-labs.hk/M-Labs/nac3/commit/85f21060e46e8e6d12c6081cec68551d0c3457dd

ah I thought this is something like a bool... idk what its value should be. IIRC there are other some other attributes which may also need to change.

ah I thought this is something like a bool... idk what its value should be. IIRC there are other some other attributes which may also need to change.
sb10q changed title from LLVM 14: Attribute \'vscale_range(0,1)\' should have an Argument to review second parameter of create_enum_attribute 2022-04-18 23:53:12 +08:00
Sign in to join this conversation.
No Milestone
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: M-Labs/nac3#269
There is no content yet.