[llvm-commits] [llvm] r65123 - /llvm/trunk/lib/Transforms/Utils/Mem2Reg.cpp
Zhou Sheng
zhousheng00 at gmail.com
Fri Feb 20 10:04:10 PST 2009
Hi Chris,
2009/2/21 Chris Lattner <clattner at apple.com>
> On Feb 20, 2009, at 8:31 AM, Zhou Sheng wrote:
>
> Author: sheng
>> Date: Fri Feb 20 10:31:35 2009
>> New Revision: 65123
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=65123&view=rev
>> Log:
>> patch to update the line number information in pass -mem2reg.
>> Currently this pass will delete the variable declaration info,
>> and keep the line number info. But the kept line number info is not
>> updated,
>> and some is redundant or not correct, this patch just updates those info.
>>
>
> Hi Sheng,
>
> High level question: why do you want mem2reg to do this? Doesn't
> instcombine already do it? If not, it should.
Yes, instcombine already can do this. Sorry for the stupid check in, just
rolled back
>
>
> +/// Remove the invalid or redundant debug information.
>> +static void CleanDbgInfo(Function& F) {
>> + std::vector<Instruction*> DeadDbgs;
>> + for (Function::iterator BBI = F.begin(), BBE = F.end(); BBI != BBE;
>> ++BBI) {
>> + if (BBI->size() <= 1)
>> + continue;
>>
>
> size() is O(n), please don't call it here.
>
>
>> + for (BasicBlock::iterator I = BBI->begin(), E = BBI->getTerminator();
>> + I != E; ++I) {
>> + BasicBlock::iterator NextI = I;
>> + ++NextI;
>> + if (isa<DbgStopPointInst>(I) && isa<DbgStopPointInst>(NextI))
>> + DeadDbgs.push_back(I);
>>
>
> You don't need the temporary vector, just preincrement the iterator.
>
>
>> + else if (isa<DbgStopPointInst>(I) && isa<BranchInst>(NextI))
>> + DeadDbgs.push_back(I);
>> + }
>>
>
> Deleting stoppoints before branches isn't correct. You can have control
> flow within a line (e.g. ?: expressions) and the intermediate blocks need to
> get that stoppoint.
>
> -Chris
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20090221/a9d51e8a/attachment.html>
More information about the llvm-commits
mailing list