psamolysov added a comment.

I tried to triage a bit. The test 
`lldb\test\API\functionalities\unused-inlined-parameters\TestUnusedInlinedParameters.py`
 compiles the code in `main.c` with `-O1` and generates the following IR for 
the `@f` function:

  ; Function Attrs: alwaysinline nounwind uwtable
  define dso_local void @f(ptr nocapture noundef readnone %unused1, i32 noundef 
%used, i32 noundef %unused2) local_unnamed_addr #1 {
  entry:
    tail call void @use(i32 noundef %used)
    ret void
  }

With the reverted patch, the IR looks like the follow:

  ; Function Attrs: alwaysinline nounwind uwtable
  define dso_local void @f(ptr nocapture readnone %unused1, i32 noundef %used, 
i32 %unused2) local_unnamed_addr #1 {
  entry:
    tail call void @use(i32 noundef %used)
    ret void
  }

So, as we can see, the attribute `readnone` is present for the first unused 
argument for which an additional piece of the DWARF code is generated in both 
IRs but the `noundef` attribute is omitted in the second case (so, this 
attribute is introduces by some changes in the patch and this is "documented" 
by the changes in the `llvm/test/Transforms/InstCombine/unused-nonnull.ll` 
test).


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D128830/new/

https://reviews.llvm.org/D128830

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to