[PowerPC] Constrain base register in PPCRegisterInfo::resolveFrameIndex
authorUlrich Weigand <ulrich.weigand@de.ibm.com>
Fri, 27 Jun 2014 13:04:12 +0000 (13:04 +0000)
committerUlrich Weigand <ulrich.weigand@de.ibm.com>
Fri, 27 Jun 2014 13:04:12 +0000 (13:04 +0000)
commit14bd521f4c187d6b7b267a8376ef0f7b492697b5
tree2256b50263011d73721b5e66d266fe2466492020
parentc935ca8c3ce9bdc3de211e93634da83a6eaacbe2
[PowerPC] Constrain base register in PPCRegisterInfo::resolveFrameIndex

I've run into a bug where current LLVM at -O0 (with fast-isel)
generated invalid code like:

        ld 0, 20936(1)                  # 8-byte Folded Reload
        stw 12, 10348(0)
        stw 12, 10344(0)

The underlying vreg had been introduced as base register by the
Local Stack Slot Allocation pass.  That register was constrained
to G8RC by PPCRegisterInfo::materializeFrameBaseRegister to match
the ADDI instruction used to set it, but it was *not* constrained
to G8RC_NOX0 to fit the *use* of the register in an address.

That should have happened in PPCRegisterInfo::resolveFrameIndex.
This patch adds an appropriate constrainRegClass call.

Reviewed by Hal Finkel.

llvm-svn: 211897
llvm/lib/Target/PowerPC/PPCRegisterInfo.cpp
llvm/test/CodeGen/PowerPC/resolvefi-basereg.ll [new file with mode: 0644]