StackLifetime class collects lifetime marker of an alloca by collect
the user of BitCast who is the user of the alloca. However, either
the alloca itself could be used with the lifetime marker or the BitCast
of the alloca could be transformed to other instructions. (e.g.,
it may be transformed to all zero reps in InstCombine pass).
This patch tries to fix this process in collectMarkers functions.
Details
Details
Diff Detail
Diff Detail
Event Timeline
This comment was removed by ChuanqiXu.
Comment Actions
Sorry, it's my fault to forget to update the test case. I update it now. The IR in the test file is generated by command clang -O2 -S -emit-llvm for the following code:
typedef struct { char a[500]; } char_array; void consume(char_array); void simple(int cond) { if (cond) { char_array a; consume(a); } else { char_array b; consume(b); } }
Comment Actions
This function was changed
Is this issue still relevant?
If this is still needed, could you please make this a regular lit test?
Comment Actions
Thanks for your comment. This issue is fixed by the new commit. I don't know how to add this a regular lit test because StackLifetime module won't provide a pass interface, which means I can call it from opt.
Comment Actions
The test is still could be useful
Maybe something like this llvm/test/Analysis/StackSafetyAnalysis/lifetime.ll ?
Comment Actions
Oh, I find here is StackLifetimePrinterPass which I can use for tests. I updated the diff about test case to lifetime.ll for now.