This is an archive of the discontinued LLVM Phabricator instance.

[WebAssembly] Fix debug locations for ExplicitLocals pass
ClosedPublic

Authored by aardappel on Oct 25 2021, 2:02 PM.

Diff Detail

Event Timeline

aardappel created this revision.Oct 25 2021, 2:02 PM
aardappel requested review of this revision.Oct 25 2021, 2:02 PM
Herald added a project: Restricted Project. · View Herald TranscriptOct 25 2021, 2:02 PM

As for the changes to DW_AT_low/high_pc the code generated for this test is:

000002 func[0] <foo>:
 000003: 01 7f                      | local[0] type=i32
 000005: 23 80 80 80 80 00          | global.get 0 <env.__stack_pointer>
 00000b: 41 10                      | i32.const 16
 00000d: 6b                         | i32.sub
 00000e: 22 01                      | local.tee 1
 000010: 20 00                      | local.get 0
 000012: 36 02 0c                   | i32.store 2 12
 000015: 20 01                      | local.get 1
 000017: 41 01                      | i32.const 1
 000019: 36 02 08                   | i32.store 2 8
 00001c: 20 01                      | local.get 1
 00001e: 41 02                      | i32.const 2
 000020: 36 02 04                   | i32.store 2 4
 000023: 20 01                      | local.get 1
 000025: 20 01                      | local.get 1
 000027: 28 02 04                   | i32.load 2 4
 00002a: 36 02 0c                   | i32.store 2 12
 00002d: 20 01                      | local.get 1
 00002f: 28 02 0c                   | i32.load 2 12
 000032: 20 01                      | local.get 1
 000034: 28 02 08                   | i32.load 2 8
 000037: 6a                         | i32.add
 000038: 0b                         | end

So it would seem the new offsets include the code from 0x23 to 0x34, which is the code the uses the alloca-ed vars, not the part that initializes them. But the old values end up pointing in the middle of an instruction? Was that ever correct?

dschuff accepted this revision.Oct 28 2021, 11:46 AM
This revision is now accepted and ready to land.Oct 28 2021, 11:46 AM
This revision was landed with ongoing or failed builds.Oct 28 2021, 12:36 PM
This revision was automatically updated to reflect the committed changes.

This change seems to have broken at least one emscripten test:

./tests/runner other.test_pthread_lsan_leak

Seems like the source map locations are off.

Maybe we can revert while we figure it out since there are other other recent llvm changes that we want to get into emscripten ASAP?

This change seems to have broken at least one emscripten test:

./tests/runner other.test_pthread_lsan_leak

Seems like the source map locations are off.

Maybe we can revert while we figure it out since there are other other recent llvm changes that we want to get into emscripten ASAP?

Link to failing integration bot: https://logs.chromium.org/logs/emscripten-releases/buildbucket/cr-buildbucket/8832019855439718609/+/steps/Emscripten_testsuite__upstream__other_/0/stdout