From: Volkan Keles Date: Fri, 7 Jun 2019 20:19:27 +0000 (+0000) Subject: [GlobalISel] IRTranslator: Translate the intrinsics ignored by CodeGen X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=f3183529a4790b0fb864e9432f335ac4b8243923;p=llvm [GlobalISel] IRTranslator: Translate the intrinsics ignored by CodeGen Summary: Translate `llvm.assume`, `llvm.var.annotation` and `llvm.sideeffect` to nothing as they have no effect on CodeGen. Reviewers: qcolombet, aditya_nandakumar, dsanders, paquette, aemerson, arsenm Reviewed By: arsenm Subscribers: hiraditya, wdng, rovka, kristof.beyls, javed.absar, Petar.Avramovic, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D63022 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@362834 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/CodeGen/GlobalISel/IRTranslator.cpp b/lib/CodeGen/GlobalISel/IRTranslator.cpp index b1a53c54024..bde5ccc4f66 100644 --- a/lib/CodeGen/GlobalISel/IRTranslator.cpp +++ b/lib/CodeGen/GlobalISel/IRTranslator.cpp @@ -1108,6 +1108,11 @@ bool IRTranslator::translateKnownIntrinsic(const CallInst &CI, Intrinsic::ID ID, } case Intrinsic::invariant_end: return true; + case Intrinsic::assume: + case Intrinsic::var_annotation: + case Intrinsic::sideeffect: + // Discard annotate attributes, assumptions, and artificial side-effects. + return true; } return false; } diff --git a/test/CodeGen/AArch64/GlobalISel/arm64-irtranslator.ll b/test/CodeGen/AArch64/GlobalISel/arm64-irtranslator.ll index e7d1e0f5665..3758df29c3b 100644 --- a/test/CodeGen/AArch64/GlobalISel/arm64-irtranslator.ll +++ b/test/CodeGen/AArch64/GlobalISel/arm64-irtranslator.ll @@ -2390,3 +2390,30 @@ define float @test_rint_f32(float %x) { %y = call float @llvm.rint.f32(float %x) ret float %y } + +declare void @llvm.assume(i1) +define void @test_assume(i1 %x) { + ; CHECK-LABEL: name: test_assume + ; CHECK-NOT: llvm.assume + ; CHECK: RET_ReallyLR + call void @llvm.assume(i1 %x) + ret void +} + +declare void @llvm.sideeffect() +define void @test_sideeffect() { + ; CHECK-LABEL: name: test_sideeffect + ; CHECK-NOT: llvm.sideeffect + ; CHECK: RET_ReallyLR + call void @llvm.sideeffect() + ret void +} + +declare void @llvm.var.annotation(i8*, i8*, i8*, i32) +define void @test_var_annotation(i8*, i8*, i8*, i32) { + ; CHECK-LABEL: name: test_var_annotation + ; CHECK-NOT: llvm.var.annotation + ; CHECK: RET_ReallyLR + call void @llvm.var.annotation(i8* %0, i8* %1, i8* %2, i32 %3) + ret void +}