DBG_VALUE insertion for spills breaks bundles

Hi,

The insertion of DBG_VALUE instructions for spills does not seem to be handling insert locations inside bundles well. If the spill instruction is part of a bundle, the new DBG_VALUE is inserted after it, but does not have the bundling flags set. This essentially means that if we start with a set of bundled instructions:

MI1 [BundledSucc=true, BundledPred=false]

MI2 [BundledSucc=false, BundledPred=true]

Where MI1 is a spill, and MI2 is a different instruction, after ExtendRanges we end up with

MI1 [BundledSucc=true, BundledPred=false]

DBG_VALUE MI [BundledSucc=false, BundledPred=false]

MI2 [BundledSucc=false, BundledPred=true]

Since this happens after the final instruction scheduling, it results in broken schedules. I believe setting the bundling flags before invoking MBB->insertAfter in ExtendRanges should fix this.

Best regards

Saurabh Verma

Hi again,

Here is a small patch to fix this issue. Please note that since the problem results in broken bundles, it can result in invalid schedules for any VLIW back-ends using bundling to group instructions.

Best regards

Saurabh Verma

dbg_value_fix.patch (1.04 KB)

Thank you for your patch. Could you please add a testcase to it and upload it to reviews.llvm.org and CC llvm-commits, me and the debug-info group?

-- adrian

Hi,

Any help in pushing this change through would be greatly appreciated. As I mentioned in my previous email, this bug causes breakage of VLIW bundles and results in incorrect schedules when debug info gets generated and is hence an important one to fix. My previous post had a small patch with the fix.

Best regards

Saurabh Verma