OSDN Git Service

GlobalISel: translate "unreachable" (into nothing)
authorTim Northover <tnorthover@apple.com>
Fri, 29 Jul 2016 22:41:55 +0000 (22:41 +0000)
committerTim Northover <tnorthover@apple.com>
Fri, 29 Jul 2016 22:41:55 +0000 (22:41 +0000)
Easiest instruction ever!

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277225 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/GlobalISel/IRTranslator.cpp
test/CodeGen/AArch64/GlobalISel/arm64-irtranslator.ll

index 80ec1b5..9ead159 100644 (file)
@@ -269,6 +269,9 @@ bool IRTranslator::translate(const Instruction &Inst) {
   case Instruction::Alloca:
     return translateStaticAlloca(cast<AllocaInst>(Inst));
 
+  case Instruction::Unreachable:
+    return true;
+
   default:
     llvm_unreachable("Opcode not supported");
   }
index 28005fa..892838f 100644 (file)
@@ -271,3 +271,13 @@ define void @intrinsics(i32 %cur, i32 %bits) {
   call void @llvm.aarch64.neon.st2.v8i8.p0i8(<8 x i8> %vec, <8 x i8> %vec, i8* %ptr)
   ret void
 }
+
+
+; CHECK-LABEL: name: unreachable
+; CHECK: G_ADD
+; CHECK-NEXT: {{^$}}
+; CHECK-NEXT: ...
+define void @unreachable(i32 %a) {
+  %sum = add i32 %a, %a
+  unreachable
+}