Skip to content

Commit b328d95

Browse files
author
Jessica Paquette
committedOct 5, 2018
[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
1 parent fdada09 commit b328d95

File tree

2 files changed

+22
-0
lines changed

2 files changed

+22
-0
lines changed
 

‎llvm/lib/CodeGen/GlobalISel/IRTranslator.cpp

+8
Original file line numberDiff line numberDiff line change
@@ -955,6 +955,14 @@ bool IRTranslator::translateKnownIntrinsic(const CallInst &CI, Intrinsic::ID ID,
955955
.addUse(getOrCreateVReg(*CI.getArgOperand(0)));
956956
return true;
957957
}
958+
case Intrinsic::invariant_start: {
959+
LLT PtrTy = getLLTForType(*CI.getArgOperand(0)->getType(), *DL);
960+
unsigned Undef = MRI->createGenericVirtualRegister(PtrTy);
961+
MIRBuilder.buildUndef(Undef);
962+
return true;
963+
}
964+
case Intrinsic::invariant_end:
965+
return true;
958966
}
959967
return false;
960968
}

‎llvm/test/CodeGen/AArch64/GlobalISel/arm64-irtranslator.ll

+14
Original file line numberDiff line numberDiff line change
@@ -2207,3 +2207,17 @@ define void @test_blockaddress() {
22072207
block:
22082208
ret void
22092209
}
2210+
2211+
%t = type { i32 }
2212+
declare {}* @llvm.invariant.start.p0i8(i64, i8* nocapture) readonly nounwind
2213+
declare void @llvm.invariant.end.p0i8({}*, i64, i8* nocapture) nounwind
2214+
define void @test_invariant_intrin() {
2215+
; CHECK-LABEL: name: test_invariant_intrin
2216+
; CHECK: %{{[0-9]+}}:_(s64) = G_IMPLICIT_DEF
2217+
; CHECK-NEXT: RET_ReallyLR
2218+
%x = alloca %t
2219+
%y = bitcast %t* %x to i8*
2220+
%inv = call {}* @llvm.invariant.start.p0i8(i64 8, i8* %y)
2221+
call void @llvm.invariant.end.p0i8({}* %inv, i64 8, i8* %y)
2222+
ret void
2223+
}

0 commit comments

Comments
 (0)
Failed to load comments.