From 8d652b756e33b6deb4e469ac7494d0967a22aab7 Mon Sep 17 00:00:00 2001 From: Vedant Kumar Date: Tue, 21 Aug 2018 23:42:53 +0000 Subject: [PATCH] [CodeGenPrepare] Pre-commit debug info test for optimizeSelectInst This test shows that optimizeSelectInst splits a select and sinks a `fdiv` operation to one side of the diamond. However, the dbg.value for the operation isn't moved. llvm-svn: 340369 --- llvm/test/Transforms/CodeGenPrepare/X86/select.ll | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/llvm/test/Transforms/CodeGenPrepare/X86/select.ll b/llvm/test/Transforms/CodeGenPrepare/X86/select.ll index 58d81b5..9abb286 100644 --- a/llvm/test/Transforms/CodeGenPrepare/X86/select.ll +++ b/llvm/test/Transforms/CodeGenPrepare/X86/select.ll @@ -1,5 +1,6 @@ ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py ; RUN: opt -codegenprepare -S < %s | FileCheck %s +; RUN: opt -debugify -codegenprepare -S < %s | FileCheck %s -check-prefix=DEBUG target triple = "x86_64-unknown-unknown" @@ -35,6 +36,20 @@ define float @fdiv_true_sink(float %a, float %b) { ; CHECK-NEXT: [[SEL:%.*]] = phi float [ [[DIV]], [[SELECT_TRUE_SINK]] ], [ 2.000000e+00, [[ENTRY:%.*]] ] ; CHECK-NEXT: ret float [[SEL]] ; +; DEBUG-LABEL: @fdiv_true_sink( +; DEBUG-NEXT: entry: +; DEBUG-NEXT: call void @llvm.dbg.value(metadata float [[DIV:%[^,]+]] +; DEBUG-NEXT: [[CMP:%.*]] = fcmp ogt float [[A:%.*]], 1.000000e+00 +; DEBUG-NEXT: call void @llvm.dbg.value(metadata i1 [[CMP]] +; DEBUG-NEXT: br i1 [[CMP]], label [[SELECT_TRUE_SINK:%.*]], label [[SELECT_END:%[^,]+]] +; DEBUG: select.true.sink: +; DEBUG-NEXT: [[DIV]] = fdiv float [[A]], [[B:%.*]] +; DEBUG-NEXT: br label [[SELECT_END]] +; DEBUG: select.end: +; DEBUG-NEXT: [[SEL:%.*]] = phi float [ [[DIV]], [[SELECT_TRUE_SINK]] ], [ 2.000000e+00, [[ENTRY:%.*]] ] +; DEBUG-NEXT: call void @llvm.dbg.value(metadata float [[SEL]] +; DEBUG-NEXT: ret float [[SEL]] +; entry: %div = fdiv float %a, %b %cmp = fcmp ogt float %a, 1.0 -- 2.7.4