Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(28)

Issue 1166253003: SimplifyAllocas: search through more bitcasts to find alloca for llvm.dbg.declare. (Closed)

Created:
5 years, 6 months ago by jvoung (off chromium)
Modified:
5 years, 6 months ago
Reviewers:
Derek Schuff
CC:
native-client-reviews_googlegroups.com
Base URL:
https://chromium.googlesource.com/native_client/pnacl-llvm.git@master
Target Ref:
refs/heads/master
Visibility:
Public.

Description

SimplifyAllocas: search through more bitcasts to find alloca for llvm.dbg.declare. The webp/snes9x build was generating more intermediate bitcasts than expected, so the fixup for making llvm.dbg.declare's first argument be an alloca was sometimes failing to find the alloca. I.e., some earlier pass like instcombine was already violating the contract that llvm.dbg.declare's first argument be an alloca or a function argument. Try to be more resilient and loop through more casts if needed. Technically llvm.dbg.declare's first argument doesn't *have* to be an alloca: http://lists.cs.uiuc.edu/pipermail/llvmdev/2015-June/086647.html However, ReplacePtrsWithInts does not handle converting llvm.dbg.declare parameters which are bitcasts, and ends up erasing the bitcasts. This causes us to drop debug info. An alternative is to fix up ReplacePtrsWithInts (TODO), but we need to make that work with DCE. That is, the conversions inserted by ReplacePtrsWithInts must not be used solely by llvm.dbg.declare, otherwise DCE will delete those conversions and leave us with a null argument to llvm.dbg.declare. Example program state prior to SimplifyAllocas: ; Function Attrs: nounwind readonly define internal fastcc i32 @png_sig_cmp(i8* readonly %sig, i32 %start, i32 %num_to_check) #3 { entry: %png_signature = alloca i64, align 8, !dbg !68085 %tmpcast = bitcast i64* %png_signature to [8 x i8]*, !dbg !68085 call void @llvm.dbg.declare(metadata [8 x i8]* %tmpcast, metadata !68092, metadata !45244), !dbg !68085 store i64 727905341920923785, i64* %png_signature, align 8, !dbg !68085 %cmp = icmp ugt i32 %num_to_check, 8, !dbg !68093 br i1 %cmp, label %if.end3, label %if.else, !dbg !68095 // ... if.end6: // ... %gep_int6 = ptrtoint [8 x i8]* %tmpcast to i32, !dbg !68108 // ... BUG= https://code.google.com/p/nativeclient/issues/detail?id=4203 R=dschuff@chromium.org Committed: https://chromium.googlesource.com/native_client/pnacl-llvm/+/7aaca4671623197b185445558109f20f883d66fa

Patch Set 1 #

Total comments: 2

Patch Set 2 : report_fatal_error #

Unified diffs Side-by-side diffs Delta from patch set Stats (+45 lines, -14 lines) Patch
M lib/Transforms/NaCl/SimplifyAllocas.cpp View 1 3 chunks +19 lines, -3 lines 0 comments Download
M test/Transforms/NaCl/simplify-allocas.ll View 1 chunk +26 lines, -11 lines 0 comments Download

Messages

Total messages: 10 (1 generated)
jvoung (off chromium)
Hmm it seems like an earlier pass is already putting bitcasts in the 1st argument. ...
5 years, 6 months ago (2015-06-09 01:07:08 UTC) #2
Derek Schuff
On 2015/06/09 01:07:08, jvoung wrote: > Hmm it seems like an earlier pass is already ...
5 years, 6 months ago (2015-06-09 16:01:12 UTC) #3
jvoung (off chromium)
On 2015/06/09 16:01:12, Derek Schuff wrote: > On 2015/06/09 01:07:08, jvoung wrote: > > Hmm ...
5 years, 6 months ago (2015-06-10 21:58:20 UTC) #4
Derek Schuff
I'm hitting what appears to be this problem when switching the IRT to a full-debug ...
5 years, 6 months ago (2015-06-11 17:12:18 UTC) #5
jvoung (off chromium)
On 2015/06/11 17:12:18, Derek Schuff wrote: > I'm hitting what appears to be this problem ...
5 years, 6 months ago (2015-06-11 17:39:31 UTC) #6
Derek Schuff
ok lets do this for now then. https://codereview.chromium.org/1166253003/diff/1/lib/Transforms/NaCl/SimplifyAllocas.cpp File lib/Transforms/NaCl/SimplifyAllocas.cpp (right): https://codereview.chromium.org/1166253003/diff/1/lib/Transforms/NaCl/SimplifyAllocas.cpp#newcode130 lib/Transforms/NaCl/SimplifyAllocas.cpp:130: ValueAsMetadata::get(Alloca))); what ...
5 years, 6 months ago (2015-06-11 17:43:12 UTC) #7
jvoung (off chromium)
https://codereview.chromium.org/1166253003/diff/1/lib/Transforms/NaCl/SimplifyAllocas.cpp File lib/Transforms/NaCl/SimplifyAllocas.cpp (right): https://codereview.chromium.org/1166253003/diff/1/lib/Transforms/NaCl/SimplifyAllocas.cpp#newcode130 lib/Transforms/NaCl/SimplifyAllocas.cpp:130: ValueAsMetadata::get(Alloca))); On 2015/06/11 17:43:12, Derek Schuff wrote: > what ...
5 years, 6 months ago (2015-06-11 17:52:20 UTC) #8
Derek Schuff
lgtm
5 years, 6 months ago (2015-06-11 17:53:06 UTC) #9
jvoung (off chromium)
5 years, 6 months ago (2015-06-11 19:48:06 UTC) #10
Message was sent while issue was closed.
Committed patchset #2 (id:20001) manually as
7aaca4671623197b185445558109f20f883d66fa (presubmit successful).

Powered by Google App Engine
This is Rietveld 408576698