[FastISel] Ignore @llvm.assume.
authorAhmed Bougacha <ahmed.bougacha@gmail.com>
Fri, 22 Jul 2016 12:54:53 +0000 (12:54 +0000)
committerAhmed Bougacha <ahmed.bougacha@gmail.com>
Fri, 22 Jul 2016 12:54:53 +0000 (12:54 +0000)
llvm-svn: 276410

llvm/lib/CodeGen/SelectionDAG/FastISel.cpp
llvm/test/CodeGen/AArch64/fast-isel-assume.ll [new file with mode: 0644]

index b10da00..4092c34 100644 (file)
@@ -1104,6 +1104,8 @@ bool FastISel::selectIntrinsicCall(const IntrinsicInst *II) {
   case Intrinsic::lifetime_end:
   // The donothing intrinsic does, well, nothing.
   case Intrinsic::donothing:
+  // Neither does the assume intrinsic; it's also OK not to codegen its operand.
+  case Intrinsic::assume:
     return true;
   case Intrinsic::dbg_declare: {
     const DbgDeclareInst *DI = cast<DbgDeclareInst>(II);
diff --git a/llvm/test/CodeGen/AArch64/fast-isel-assume.ll b/llvm/test/CodeGen/AArch64/fast-isel-assume.ll
new file mode 100644 (file)
index 0000000..d39a907
--- /dev/null
@@ -0,0 +1,14 @@
+; RUN: llc -mtriple=aarch64-- -fast-isel -fast-isel-abort=4 -verify-machineinstrs < %s | FileCheck %s
+
+; Check that we ignore the assume intrinsic.
+
+; CHECK-LABEL: test:
+; CHECK: // BB#0:
+; CHECK-NEXT: ret
+define void @test(i32 %a) {
+  %tmp0 = icmp slt i32 %a, 0
+  call void @llvm.assume(i1 %tmp0)
+  ret void
+}
+
+declare void @llvm.assume(i1)