GlobalISel: widen booleans by zero-extending to a byte.

A bool is represented by a single byte, which the ARM ABI requires to be either
0 or 1. So we cannot use G_ANYEXT when legalizing the type.

llvm-svn: 298439
This commit is contained in:
Tim Northover 2017-03-21 21:12:04 +00:00
parent 947f48fa0e
commit dd4b9d6d7b
2 changed files with 2 additions and 2 deletions

View File

@ -433,7 +433,7 @@ LegalizerHelper::widenScalar(MachineInstr &MI, unsigned TypeIdx, LLT WideTy) {
"illegal to increase number of bytes modified by a store");
unsigned SrcExt = MRI.createGenericVirtualRegister(WideTy);
MIRBuilder.buildAnyExt(SrcExt, MI.getOperand(0).getReg());
MIRBuilder.buildZExt(SrcExt, MI.getOperand(0).getReg());
MIRBuilder.buildStore(SrcExt, MI.getOperand(1).getReg(),
**MI.memoperands_begin());
MI.eraseFromParent();

View File

@ -82,7 +82,7 @@ body: |
%0(p0) = COPY %x0
%1(s32) = COPY %w1
; CHECK: [[BIT8:%[0-9]+]](s8) = G_ANYEXT %2(s1)
; CHECK: [[BIT8:%[0-9]+]](s8) = G_ZEXT %2(s1)
; CHECK: G_STORE [[BIT8]](s8), %0(p0) :: (store 1 into %ir.addr)
%2(s1) = G_TRUNC %1
G_STORE %2, %0 :: (store 1 into %ir.addr)