[llvm-bugs] [Bug 24469] clang crashes at -Os and above on x86_64-linux-gnu

via llvm-bugs llvm-bugs at lists.llvm.org
Sun Aug 16 22:54:34 PDT 2015


https://llvm.org/bugs/show_bug.cgi?id=24469

karthik <kv.bhat at samsung.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |kv.bhat at samsung.com
         Resolution|---                         |FIXED

--- Comment #3 from karthik <kv.bhat at samsung.com> ---
Hi David,
Thanks for the reduced test case. This should be fixed in r245195.

The problem was in handleNonLocalStoreDeletion were we had a call to
DeleteDeadInstruction.

DeleteDeadInstruction can delete the next basic block iterator which is
supposed to be processed. Not handling this case was resulting in the above
crash.
For e.g. in the above test code-
While processing the intruction "store i32 0, i32* @b, align 4"
"store i32 %g.02, i32* @b, align 4" is concluded to be dead as the store is
overwritten by  store i32 0, i32* @b, align 4 in loop exit.
This results in "%g.02 = phi i32 [ undef, %entry ], [ %0, %for.cond.1.loopexit
]" and "%0 = load i32, i32* @a, align 4".
Now the iterator points to "%0 = load i32, i32* @a, align 4" which has been
deleted by DeleteDeadInstruction. This was resulting in the above crash.

Fixed this by resetting the Basic block iterator after a call to
DeleteDeadInstruction. 

For reference this is done in few other places in DSE as well.

Thanks
Karthik Bhat

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20150817/98bf93d4/attachment.html>


More information about the llvm-bugs mailing list