Bug 20811

This is my first time contributing to the llvm project, I took up bug #20811 [https://bugs.llvm.org/show_bug.cgi?id=20811]. From my understanding, what I had to do was to assign an undef to a variable if it is loading from a pointer after its lifetime has ended (please correct me if I am wrong.) I would like to ask for help on how could I check if a variable has been assigned undef to verify my changes.

Thanks in advance :slight_smile:

Hi Chouhan,

From a brief inspection of the bug report and the attached IR (lifetime-end.ll), you have a couple of options:

1- You can run opt lifetime-end.ll -basicaa -gvn -S. If your change did what it’s supposed to, you should see that ret i8 %0 was replaced with ret i8 undef.

2- The IR attached in the case is in the form of a LIT. You can read more about it here: https://www.llvm.org/docs/TestingGuide.html#writing-new-regression-tests

You would probably commit it as a test with your patch. This test should fail without your change and pass with your change. To run it, you can call lit lifetime-end.ll and examine the output of the command.