[llvm] [IPSCCP] Variable not visible at Og: (PR #77901)

Stephen Tozer via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 28 07:46:45 PDT 2024


================
@@ -52,13 +52,35 @@
 ; CHECK:     = !DIGlobalVariableExpression(var: ![[DBG_FLOAT_UNDEF:.+]], expr: !DIExpression())
 ; CHECK-DAG: ![[DBG_FLOAT_UNDEF]]  = distinct !DIGlobalVariable(name: "g_float_undef"
 
+; CHECK: ![[G8:[0-9]+]] = !DIGlobalVariableExpression(var: ![[DBG8:[0-9]+]], expr: !DIExpression(DW_OP_constu, 22136, DW_OP_stack_value))
+; CHECK-DAG: ![[DBG8]] = distinct !DIGlobalVariable(name: "g_88", {{.*}}
+; CHECK: ![[G9:[0-9]+]] = !DIGlobalVariableExpression(var: ![[DBG9:[0-9]+]], expr: !DIExpression(DW_OP_constu, 23726, DW_OP_stack_value))
+; CHECK-DAG: ![[DBG9]] = distinct !DIGlobalVariable(name: "g_99", {{.*}}
+
+; CHECK-DAG: ![[DBGA:[0-9]+]] = distinct !DIGlobalVariable(name: "g_i32_undef"
+; CHECK-DAG: ![[GA:[0-9]+]] = !DIGlobalVariableExpression(var: ![[DBGA]], expr: !DIExpression())
+; CHECK-DAG: ![[DBGB:[0-9]+]] = distinct !DIGlobalVariable(name: "g_ptr_undef"
+; CHECK-DAG: ![[GB:[0-9]+]] = !DIGlobalVariableExpression(var: ![[DBGB]], expr: !DIExpression())
+
+; CHECK: ![[G10:[0-9]+]] = !DIGlobalVariableExpression(var: ![[DBG10:[0-9]+]], expr: !DIExpression(DW_OP_constu, 17293822569102704640, DW_OP_stack_value))
+; CHECK-DAG: ![[DBG10]] = distinct !DIGlobalVariable(name: "g_1010", {{.*}}
+; CHECK: ![[G11:[0-9]+]] = !DIGlobalVariableExpression(var: ![[DBG11:[0-9]+]], expr: !DIExpression(DW_OP_constu, 17293822569102704640, DW_OP_stack_value))
+; CHECK-DAG: ![[DBG11]] = distinct !DIGlobalVariable(name: "g_1111", {{.*}}
+; CHECK: ![[G12:[0-9]+]] = !DIGlobalVariableExpression(var: ![[DBG12:[0-9]+]], expr: !DIExpression(DW_OP_constu, 14480694097861998592, DW_OP_stack_value))
+; CHECK-DAG: ![[DBG12]] = distinct !DIGlobalVariable(name: "g_1212", {{.*}}
----------------
SLTozer wrote:

The values for the >64bit FP values look wrong: the constants for fp128 and ppc_fp128, for example, are equivalent to `0xF000000000000000`, just the upper 64 bits of the original value, and for x86_FP80 the value is `0xC8F5C28F5C28F800`, just the lower 64 bits of the original value (possibly the implementation gives us the last complete 64-bit word?). If there's not a reliable way to make this work for constant values that don't fit in 64 bits, I think it'd be best to drop them.

NB: Off the top of my head DWARF does have representation for values of arbitrary length, but we don't produce them in LLVM until the point where we emit DWARF; either DW_OP_piece (which we exclusively represent with DW_OP_LLVM_fragment until emission) or `DW_OP_implicit_value`, which we emit for DBG_VALUEs with constant values and non-complex expressions. The best choice here would probably be to use `DW_OP_implicit_value`, but I'm not sure how/if we can represent it well in a `!DIExpression` or whether trying to do so could cause errors.

https://github.com/llvm/llvm-project/pull/77901


More information about the llvm-commits mailing list