Strange ppc failure.

As part of my testing for my ELLCC cross compiler tool project (http://ellcc.org), I use clang/LLVM to compile itself for various targets
(arm, armeb, i386, mips, mipsel, ppc, and x86_64). Today, after a TOT update the ppc cross build failed strangely. I started to get
assembly errors:

[~/ellcc/llvm/lib/Target/PowerPC] dev% ~/ellcc/bin/ppc-elf-as PPCInstrInfo.s
PPCInstrInfo.s: Assembler messages:
PPCInstrInfo.s:1795: Error: operand out of range (49 is not between 0 and 31)
PPCInstrInfo.s:17893: Error: operand out of range (73 is not between 0 and 31)
PPCInstrInfo.s:17953: Error: operand out of range (49 is not between 0 and 31)

Here is the assembly starting at 17980 (other cases are similar):
.LBB133_139:
         lbz 3, 75(22)
         lwz 0, 140(1)
         add 18, 22, 73 <-- error line
         rlwinm 0, 0, 20, 0, 31
         andi. 3, 3, 1
         mtcrf 16, 0
         bc 4, 1, .LBB133_142
         lwz 3, 164(1)
         lwz 6, 236(1)
         mr 4, 16
         li 5, 374
         bl __assert_fail
         b .LBB133_142
.LBB133_141:
         lwz 0, 140(1)
         addi 18, 22, 73 <-- odd similarity

It looks (to me, brain hazy with a bad head code) that the add in the error
case might want to be an addi.

My previous TOT revision that worked for sure was 208501. My current
test version is 209581.

Any thoughts? Even suggestions about how to submit bug report (simple test case) would be welcome.

-Rich

From: "Richard Pennington" <rich@pennware.com>
To: "LLVM Developers Mailing List" <llvmdev@cs.uiuc.edu>
Sent: Saturday, May 24, 2014 10:01:22 PM
Subject: [LLVMdev] Strange ppc failure.

As part of my testing for my ELLCC cross compiler tool project
(http://ellcc.org), I use clang/LLVM to compile itself for various
targets
(arm, armeb, i386, mips, mipsel, ppc, and x86_64). Today, after a TOT
update the ppc cross build failed strangely. I started to get
assembly errors:

[~/ellcc/llvm/lib/Target/PowerPC] dev% ~/ellcc/bin/ppc-elf-as
PPCInstrInfo.s
PPCInstrInfo.s: Assembler messages:
PPCInstrInfo.s:1795: Error: operand out of range (49 is not between 0
and 31)
PPCInstrInfo.s:17893: Error: operand out of range (73 is not between
0
and 31)
PPCInstrInfo.s:17953: Error: operand out of range (49 is not between
0
and 31)

Here is the assembly starting at 17980 (other cases are similar):
.LBB133_139:
         lbz 3, 75(22)
         lwz 0, 140(1)
         add 18, 22, 73 <-- error line
         rlwinm 0, 0, 20, 0, 31
         andi. 3, 3, 1
         mtcrf 16, 0
         bc 4, 1, .LBB133_142
         lwz 3, 164(1)
         lwz 6, 236(1)
         mr 4, 16
         li 5, 374
         bl __assert_fail
         b .LBB133_142
.LBB133_141:
         lwz 0, 140(1)
         addi 18, 22, 73 <-- odd similarity

It looks (to me, brain hazy with a bad head code) that the add in the
error
case might want to be an addi.

Indeed. Can you grab the input LLVM IR and file a bug report, and we'll see if we can reproduce from that (pass -S -emit-llvm)? If we can reproduce this using the IR and llc, then it should be possible to narrow down the problem using bugpoint.

Thanks,
Hal