[PATCH] D140404: Patch for dbg variable instrinsics to point towards cloned values in JumpThreading

Adrian Prantl via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 1 10:02:50 PST 2023


aprantl added a comment.

In D140404#4096775 <https://reviews.llvm.org/D140404#4096775>, @Michael137 wrote:

> FYI, it looks like this broke https://green.lab.llvm.org/green/view/LLDB/job/lldb-cmake/50434/testReport/junit/lldb-api/tools_lldb-vscode_optimized/TestVSCode_optimized_py/ where we're presumably relying on a variable to have gotten optimised out but which is now not the case anymore. So not an issue with this patch necessarily, just notifying.
>
> Snippet from test:
>
>   int main(int argc, char const *argv[]) {               
>     int optimized = argc > 1 ? std::stoi(argv[1]) : 0;   
>                                                          
>     printf("argc: %d, optimized: %d\n", argc, optimized);
>
> compiled with `-glldb -O3`



In D140404#4096775 <https://reviews.llvm.org/D140404#4096775>, @Michael137 wrote:

> FYI, it looks like this broke https://green.lab.llvm.org/green/view/LLDB/job/lldb-cmake/50434/testReport/junit/lldb-api/tools_lldb-vscode_optimized/TestVSCode_optimized_py/ where we're presumably relying on a variable to have gotten optimised out but which is now not the case anymore. So not an issue with this patch necessarily, just notifying.
>
> Snippet from test:
>
>   int main(int argc, char const *argv[]) {               
>     int optimized = argc > 1 ? std::stoi(argv[1]) : 0;   
>                                                          
>     printf("argc: %d, optimized: %d\n", argc, optimized);
>
> compiled with `-glldb -O3`

If it's relying on debug info to get lost would using a `nodebug` attribute work, or does it need a variable, but without a location? In that case, we could rewrite the test to compile to LLVM IR at -O0, use sed to remote the location from the dbg.declare() and then compile the patch IR with clang. That would be cross-architecture and slightly more reliable (if still ugly) than relying on -O3 doing something specific.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D140404



More information about the llvm-commits mailing list