[PATCH] D35994: Debug info for variables whose type is shrinked to bool
Adrian Prantl via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Aug 28 09:36:27 PDT 2017
aprantl accepted this revision.
aprantl added a comment.
This revision is now accepted and ready to land.
In https://reviews.llvm.org/D35994#854146, @NikolaPrica wrote:
> >>
> >>
> >> val * (ValOther - ValInit) + ValInit:
> >
> > If we are doing this expression, there should be an assertion in the code that `ValInit < ValOther`.
>
> I have tested this for edge cases such as both negative values, LONG_MAX, LONG_INT etc and there was no problem for this values. Only flaw for this is ugly long DW_AT_location expression for long values.
Cool. Thanks for checking!
>
>
>>> DW_OP_deref DW_OP_constu <ValMinus>
>>> DW_OP_mul DW_OP_constu <ValInit> DW_OP_plus DW_OP_stack_value
>>
>> Why does `Val` need to be dereferenced?
>
> DW_OP_deref needs to be used because we have address of new variable on stack, not its value.
Oh, because it is a global variable! Makes sense.
>
>
>> Apart from the DW_OP_deref, this seems very good, I'm slightly worried about the assumption that the init value will always be the smaller one.
>> What happens if any of the two values is negative (because of the typeless DWARF <5 expression stack — not sure if this will be a problem).
>
> For dwarf versions lower than 4 gdb reads value of DW_AT_location expression as address giving message "Cannot access memory at address 0x1e". This may be a problem but it is still better than optimized-out?
That makes sense. I'm fine with not attempting to fix this.
================
Comment at: test/Transforms/GlobalOpt/integer-bool-dwarf.ll:43
+
+attributes #0 = { noinline nounwind optnone uwtable "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf" "no-infs-fp-math"="false" "no-jump-tables"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+fxsr,+mmx,+sse,+sse2,+x87" "unsafe-fp-math"="false" "use-soft-float"="false" }
+attributes #1 = { nounwind readnone speculatable }
----------------
please strip out all non-essential attributes (everything in quotes)
https://reviews.llvm.org/D35994
More information about the llvm-commits
mailing list