[GlobalIsel] Add llvm.invariant.start and llvm.invariant.end

Port over the implementation in SelectionDAGBuilder.cpp into the IRTranslator
and update the arm64-irtranslator test.

These were causing fallbacks in CTMark/Bullet (-Rpass-missed=gisel-select),
and this patch fixes that.

https://reviews.llvm.org/D52945

llvm-svn: 343885
This commit is contained in:
Jessica Paquette 2018-10-05 21:02:46 +00:00
parent fdada09fa4
commit b328d95333
2 changed files with 22 additions and 0 deletions

View File

@ -955,6 +955,14 @@ bool IRTranslator::translateKnownIntrinsic(const CallInst &CI, Intrinsic::ID ID,
.addUse(getOrCreateVReg(*CI.getArgOperand(0)));
return true;
}
case Intrinsic::invariant_start: {
LLT PtrTy = getLLTForType(*CI.getArgOperand(0)->getType(), *DL);
unsigned Undef = MRI->createGenericVirtualRegister(PtrTy);
MIRBuilder.buildUndef(Undef);
return true;
}
case Intrinsic::invariant_end:
return true;
}
return false;
}

View File

@ -2207,3 +2207,17 @@ define void @test_blockaddress() {
block:
ret void
}
%t = type { i32 }
declare {}* @llvm.invariant.start.p0i8(i64, i8* nocapture) readonly nounwind
declare void @llvm.invariant.end.p0i8({}*, i64, i8* nocapture) nounwind
define void @test_invariant_intrin() {
; CHECK-LABEL: name: test_invariant_intrin
; CHECK: %{{[0-9]+}}:_(s64) = G_IMPLICIT_DEF
; CHECK-NEXT: RET_ReallyLR
%x = alloca %t
%y = bitcast %t* %x to i8*
%inv = call {}* @llvm.invariant.start.p0i8(i64 8, i8* %y)
call void @llvm.invariant.end.p0i8({}* %inv, i64 8, i8* %y)
ret void
}