[PATCH] Branch folding causes different code generation at "-O2 -g" and "-O2"

Katya Romanova Katya_Romanova at playstation.sony.com
Wed Mar 5 16:00:07 PST 2014


kromanova added you to the CC list for the revision "Branch folding causes different code generation at "-O2 -g" and "-O2"".

This is a fix for PR# 19051. I noticed code gen differences due to code motion when running tests with and without the debug info at O2.

There is a problem in branch folding. The purpose of the following loop seems to be to skip the debug info

while (PI != MBB->begin() && Loc->isDebugValue())

but it doesn't actually do that. If Loc is not a DebugValue the loop does nothing, otherwise it iterates to the beginning of the block.

Here is a fix that does skip the debug info.

while (PI != MBB->begin() && PI->isDebugValue())

The testcase test/CodeGen/X86/dbg-changes-codegen-branch-folding.ll is checking that the same instruction sequence generated with and without the debug info.


http://llvm-reviews.chandlerc.com/D2970

Files:
  lib/CodeGen/BranchFolding.cpp
  test/CodeGen/X86/dbg-changes-codegen-branch-folding.ll
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D2970.1.patch
Type: text/x-patch
Size: 17498 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140305/ba26b13e/attachment.bin>


More information about the llvm-commits mailing list