From db610dd62d05484db8df49f1a3a211d77e390fcb Mon Sep 17 00:00:00 2001 From: Sanjay Patel Date: Wed, 1 Mar 2017 20:59:56 +0000 Subject: [PATCH] [InstCombine] use -instnamer and auto-generate complete checks; NFC git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@296673 91177308-0d34-0410-b5e6-96231b3b80d8 --- test/Transforms/InstCombine/select-cmp-br.ll | 323 ++++++++++++------- 1 file changed, 206 insertions(+), 117 deletions(-) diff --git a/test/Transforms/InstCombine/select-cmp-br.ll b/test/Transforms/InstCombine/select-cmp-br.ll index 1dc7e153f5f..4afa5365e17 100644 --- a/test/Transforms/InstCombine/select-cmp-br.ll +++ b/test/Transforms/InstCombine/select-cmp-br.ll @@ -1,155 +1,244 @@ +; NOTE: Assertions have been autogenerated by utils/update_test_checks.py ; Replace a 'select' with 'or' in 'select - cmp [eq|ne] - br' sequence ; RUN: opt -instcombine -S < %s | FileCheck %s -%C = type <{ %struct.S }> %struct.S = type { i64*, i32, i32 } +%C = type <{ %struct.S }> -declare void @bar(%struct.S *) #1 +declare void @bar(%struct.S*) declare void @foobar() -define void @test1(%C*) { +define void @test1(%C* %arg) { +; CHECK-LABEL: @test1( +; CHECK-NEXT: entry: +; CHECK-NEXT: [[TMP:%.*]] = getelementptr inbounds [[C:%.*]], %C* [[ARG:%.*]], i64 0, i32 0, i32 0 +; CHECK-NEXT: [[M:%.*]] = load i64*, i64** [[TMP]], align 8 +; CHECK-NEXT: [[TMP1:%.*]] = getelementptr inbounds [[C]], %C* [[ARG]], i64 1, i32 0, i32 0 +; CHECK-NEXT: [[N:%.*]] = load i64*, i64** [[TMP1]], align 8 +; CHECK-NEXT: [[TMP71:%.*]] = icmp eq %C* [[ARG]], null +; CHECK-NEXT: [[NOT_TMP5:%.*]] = icmp ne i64* [[M]], [[N]] +; CHECK-NEXT: [[TMP7:%.*]] = or i1 [[TMP71]], [[NOT_TMP5]] +; CHECK-NEXT: br i1 [[TMP7]], label [[BB10:%.*]], label [[BB8:%.*]] +; CHECK: bb: +; CHECK-NEXT: ret void +; CHECK: bb8: +; CHECK-NEXT: [[TMP9:%.*]] = getelementptr inbounds [[C]], %C* [[ARG]], i64 0, i32 0 +; CHECK-NEXT: tail call void @bar(%struct.S* [[TMP9]]) +; CHECK-NEXT: br label [[BB:%.*]] +; CHECK: bb10: +; CHECK-NEXT: [[TMP2:%.*]] = getelementptr inbounds i64, i64* [[M]], i64 9 +; CHECK-NEXT: [[TMP3:%.*]] = bitcast i64* [[TMP2]] to i64 (%C*)** +; CHECK-NEXT: [[TMP4:%.*]] = load i64 (%C*)*, i64 (%C*)** [[TMP3]], align 8 +; CHECK-NEXT: [[TMP11:%.*]] = tail call i64 [[TMP4]](%C* [[ARG]]) +; CHECK-NEXT: br label [[BB]] +; entry: - %1 = getelementptr inbounds %C, %C* %0, i64 0, i32 0, i32 0 - %m = load i64*, i64** %1, align 8 - %2 = getelementptr inbounds %C, %C* %0, i64 1, i32 0, i32 0 - %n = load i64*, i64** %2, align 8 - %3 = getelementptr inbounds i64, i64* %m, i64 9 - %4 = bitcast i64* %3 to i64 (%C*)** - %5 = load i64 (%C*)*, i64 (%C*)** %4, align 8 - %6 = icmp eq i64* %m, %n - %7 = select i1 %6, %C* %0, %C* null - %8 = icmp eq %C* %7, null - br i1 %8, label %12, label %10 - -;