[PATCH] [RegAllocGreedy] Rematerialization crashes while updating operands in bundled MIs

Dmitri Shtilman dshtilman at icloud.com
Wed May 20 22:51:26 PDT 2015


Hi Quentin,

This patch fixes rematerialization in InlineSpiller so it can handle bundles of MIs properly.

Context:
Before InlineSpiller rematerializes a vreg, it iterates over operands of each MI in a bundle, collecting all (MI, OpNo) pairs that reference that vreg.

Then if it does rematerialize, it goes through the pair list and replaces the operands with the new (rematerialized) vreg.  The problem is, it tries to replace all of these operands in the main MI ! This works fine for single MIs. However, if we are processing a bundle of MIs and the list contains multiple pairs - the rematerialization will either crash trying to access a non-existing operand of the main MI, or silently corrupt one of the existing ones. It will also ignore other MIs in the bundle.

The obvious fix is to use the MI pointers saved in collected (MI, OpNo) pairs. This must have been the original intent of the pair list but somehow these pointers got lost.

Please review.

Thanks,
Dmitri


http://reviews.llvm.org/D9904

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/






More information about the llvm-commits mailing list