[llvm] r334830 - Re-apply "[DebugInfo] Check size of variable in ConvertDebugDeclareToDebugValue"

Björn Pettersson A via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 19 01:10:15 PDT 2018


Preprocessed source would be helpful. I never used polly, so I’m not sure exactly how to reproduce this.

The "[DebugInfo] Check size of variable in ConvertDebugDeclareToDebugValue" commit is basically about avoiding faulty debug-info.
I noticed that sometimes when a dbg.declare is removed and we convert it to dbg.value (based on a store) we could insert incorrect dbg.value intrinsics in case the store only stored to parts of the variable (e.g. storing a single index in an array that was described by the dbg.declare). That is what the commit should fix.

The code for adding dbg.value based on a load/phi looked quite similar as the store situation. However, I could not find a way to make a test case where it failed for those (and I spent some time analyzing the code and I could not see that we would suffer in the same way as for store instructions), so I simply added some assertions that the size of the variable and the value involved matched up. It is one of those asserts that now trigger.

I figure that it is more important that the code compiles compared to having correct debug info (otherwise I suppose that we could add tons of asserts that would fail almost every build with -g).
I’ll simply remove those asserts until I can reproduce the problem seen with polly-aosp.

/Björn


From: Friedman, Eli <efriedma at codeaurora.org>
Sent: den 19 juni 2018 02:55
To: Björn Pettersson A <bjorn.a.pettersson at ericsson.com>; llvm-commits at lists.llvm.org
Subject: Re: [llvm] r334830 - Re-apply "[DebugInfo] Check size of variable in ConvertDebugDeclareToDebugValue"

I'm seeing a crash on the polly-aosp buildbot (http://lab.llvm.org:8011/builders/aosp-O3-polly-before-vectorizer-unprofitable/builds/552/steps/build-aosp/logs/stdio) which looks like it's caused by this patch.  Any idea what's going on?  I can send preprocessed source if you need it.

-Eli

from build log:

clang: /var/lib/buildbot/slaves/hexagon-build-03/aosp/llvm.src/lib/Transforms/Utils/Local.cpp:1317: void llvm::ConvertDebugDeclareToDebugValue(llvm::DbgInfoIntrinsic *, llvm::LoadInst *, llvm::DIBuilder &): Assertion `valueCoversEntireFragment(LI->getType(), DII) && "Load is not loading the full variable fragment."' failed.
Stack dump:
0.    Program arguments: llvm.inst/bin/clang -cc1 -triple aarch64--linux-android -emit-obj -mnoexecstack -disable-free -main-file-name desc.c -mrelocation-model pic -pic-level 1 -pic-is-pie -mthread-model posix -mdisable-fp-elim -relaxed-aliasing -fmath-errno -masm-verbose -mconstructor-aliases -munwind-tables -fuse-init-array -target-cpu cortex-a53 -target-feature +fp-armv8 -target-feature +neon -target-feature +crc -target-feature +crypto -target-abi aapcs -mllvm -aarch64-fix-cortex-a53-835769=1 -fallow-half-arguments-and-returns -dwarf-column-info -debug-info-kind=limited -dwarf-version=4 -debugger-tuning=gdb -ffunction-sections -fdata-sections -coverage-notes-file /var/lib/buildbot/slaves/hexagon-build-03/aosp/out/target/product/angler/obj/EXECUTABLES/strace_intermediates/desc.gcno -nostdsysteminc -resource-dir llvm.inst/lib/clang/7.0.0 -dependency-file out/target/product/angler/obj/EXECUTABLES/strace_intermediates/desc.d -MT out/target/product/angler/obj/EXECUTABLES/strace_intermediates/desc.o -sys-header-deps -isystem frameworks/av/include -isystem out/target/product/angler/obj/include -isystem device/huawei/angler/kernel-headers -isystem hardware/qcom/msm8994/kernel-headers -isystem bionic/libc/arch-arm64/include -isystem bionic/libc/include -isystem bionic/libc/kernel/uapi -isystem bionic/libc/kernel/uapi/asm-arm64 -isystem bionic/libc/kernel/android/uapi -I external/strace/linux/aarch64 -I external/strace/linux -I external/strace -I out/target/product/angler/obj/EXECUTABLES/strace_intermediates -I out/target/product/angler/gen/EXECUTABLES/strace_intermediates -I libnativehelper/include/nativehelper -I external/libcxx/include -I external/libcxxabi/include -I system/core/include -I system/media/audio/include -I hardware/libhardware/include -I hardware/libhardware_legacy/include -I hardware/ril/include -I libnativehelper/include -I frameworks/native/include -I frameworks/native/opengl/include -D _FORTIFY_SOURCE=2 -D NDEBUG -D ANDROID -D NDEBUG -U DEBUG -D __compiler_offsetof=__builtin_offsetof -D GETGROUPS_T=gid_t -U HAVE_ASM_CACHECTL_H -D HAVE_ASM_SIGCONTEXT_H=1 -D HAVE_BLKGETSIZE64=1 -U HAVE_BLUETOOTH_BLUETOOTH_H -D HAVE___BUILTIN_POPCOUNT=1 -D HAVE_DIRENT_H=1 -D HAVE_DLADDR=1 -D HAVE_ELF_H=1 -D HAVE_FOPEN64=1 -D HAVE_FORK=1 -D HAVE_FSTATAT=1 -D HAVE_FTRUNCATE=1 -D HAVE_FUTIMENS=1 -D HAVE_IF_INDEXTONAME=1 -D HAVE_INET_NTOP=1 -D HAVE_INET_PTON=1 -D HAVE_INTTYPES_H=1 -D HAVE_LINUX_BPF_H=1 -D HAVE_LINUX_BSG_H=1 -D HAVE_LINUX_BTRFS_H=1 -D HAVE_LINUX_FALLOC_H=1 -D HAVE_LINUX_FILTER_H=1 -D HAVE_LINUX_FUTEX_H=1 -D HAVE_LINUX_ICMP_H=1 -D HAVE_LINUX_IF_PACKET_H=1 -D HAVE_LINUX_INPUT_H=1 -D HAVE_LINUX_IN6_H=1 -D HAVE_LINUX_IPC_H=1 -D HAVE_LINUX_MQUEUE=1 -D HAVE_LINUX_MSG_H=1 -D HAVE_LINUX_NETLINK_H=1 -D HAVE_LINUX_PERF_EVENT_H=1 -D HAVE_LINUX_SEM_H=1 -D HAVE_LINUX_SHM_H=1 -D HAVE_LITTLE_ENDIAN_LONG_LONG=1 -D HAVE_LONG_LONG=1 -D HAVE_NETINET_TCP_H=1 -D HAVE_NETINET_UDP_H=1 -D HAVE_POLL_H=1 -D HAVE_PRCTL=1 -D HAVE_PWRITEV=1 -D HAVE_SENDMSG=1 -D HAVE_SIGACTION=1 -D HAVE_SIG_ATOMIC_T=1 -D HAVE_SIGINFO_T=1 -D HAVE_SIGINFO_T_SI_OVERRUN=1 -D HAVE_SIGINFO_T_SI_SYSCALL=1 -D HAVE_SIGINFO_T_SI_TIMERID=1 -D HAVE_STATFS64=1 -D HAVE_STDBOOL_H=1 -D HAVE_STRERROR=1 -D HAVE_STRUCT_BTRFS_IOCTL_DEFRAG_RANGE_ARGS_START=1 -D HAVE_STRUCT_BTRFS_IOCTL_FEATURE_FLAGS_COMPAT_FLAGS=1 -D HAVE_STRUCT_FLOCK=1 -D HAVE_STRUCT_FLOCK64=1 -D HAVE_STRUCT_MMSGHDR=1 -D HAVE_STRUCT_MSGHDR_MSG_CONTROL=1 -D HAVE_STRUCT_SIGCONTEXT=1 -D HAVE_STRUCT_SIGEVENT__SIGEV_UN__PAD=1 -D HAVE_STRUCT_SOCKADDR_IN6_SIN6_SCOPE_ID=1 -D HAVE_STRUCT_STATFS64=1 -U HAVE_STRUCT_STAT_ST_ACLCNT -D HAVE_STRUCT_STAT_ST_BLKSIZE=1 -D HAVE_STRUCT_STAT_ST_BLOCKS=1 -U HAVE_STRUCT_STAT_ST_FLAGS -U HAVE_STRUCT_STAT_ST_FSTYPE -U HAVE_STRUCT_STAT_ST_GEN -U HAVE_STRUCT_STAT_ST_LEVEL -D HAVE_STRUCT_STAT_ST_RDEV=1 -D HAVE_STRUCT_SYSINFO_FREEHIGH=1 -D HAVE_STRUCT_SYSINFO_MEM_UNIT=1 -D HAVE_STRUCT_SYSINFO_TOTALHIGH=1 -D HAVE_STRUCT_UTSNAME_DOMAINNAME=1 -D HAVE_SYS_EPOLL_H=1 -D HAVE_SYS_IOCTL_H=1 -D HAVE_SYS_POLL_H=1 -D HAVE_SYS_REG_H=1 -D HAVE_SYS_VFS_H=1 -D HAVE_SYS_XATTR_H=1 -D HAVE_UNISTD_H=1 -D HAVE_UTIMENSAT=1 -D MAJOR_IN_SYSMACROS -D PACKAGE_NAME="strace" -D VERSION="(4.13-1)" -D SIZEOF_OFF_T=SIZEOF_LONG -D SIZEOF_LONG_LONG=8 -D STDC_HEADERS=1 -D STRACE_KNOWS_ONLY_EABI=1 -D _LFS64_LARGEFILE=1 -D _GNU_SOURCE=1 -D _POSIX_SOURCE=1 -D AARCH64=1 -D SIZEOF_LONG=8 -D SIZEOF_RLIM_T=8 -D _USING_LIBCXX -internal-isystem llvm.inst/lib/clang/7.0.0/include -O3 -Wno-multichar -Werror=format-security -Werror=pointer-to-int-cast -Werror=int-to-pointer-cast -Werror=implicit-function-declaration -Wstrict-aliasing=2 -W -Wall -Wno-unused -Winit-self -Wpointer-arith -Werror=int-conversion -Wno-reserved-id-macro -Wno-format-pedantic -Wno-unused-command-line-argument -Wno-expansion-to-defined -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Werror=date-time -Wall -Wwrite-strings -Wsign-compare -Wno-missing-field-initializers -Wno-pointer-arith -Wno-unused-parameter -Wno-sign-compare -Werror=int-to-pointer-cast -Werror=pointer-to-int-cast -Werror=address-of-temporary -Werror=return-type -Wno-error -std=gnu99 -fconst-strings -fdebug-compilation-dir /var/lib/buildbot/slaves/hexagon-build-03/aosp -fdebug-prefix-map=/proc/self/cwd= -ferror-limit 19 -fmessage-length 0 -stack-protector 2 -fno-signed-char -fobjc-runtime=gcc -fdiagnostics-show-option -fcolor-diagnostics -vectorize-loops -vectorize-slp -mllvm -polly -mllvm -polly-position=before-vectorizer -mllvm -polly-process-unprofitable -o out/target/product/angler/obj/EXECUTABLES/strace_intermediates/desc.o -x c external/strace/desc.c
1.    <eof> parser at end of file
2.    Per-module optimization passes
3.    Running pass 'Function Pass Manager' on module 'external/strace/desc.c'.
4.    Running pass 'Combine redundant instructions' on function '@umove_kulong_array_or_printaddr'
#0 0x00000000016611d4 PrintStackTraceSignalHandler(void*) (llvm.inst/bin/clang+0x16611d4)
#1 0x000000000165f550 llvm::sys::RunSignalHandlers() (llvm.inst/bin/clang+0x165f550)
#2 0x0000000001661378 SignalHandler(int) (llvm.inst/bin/clang+0x1661378)
#3 0x00007fed8f475d10 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x10d10)
#4 0x00007fed8e053267 gsignal /build/buildd/glibc-2.21/signal/../sysdeps/unix/sysv/linux/raise.c:55:0
#5 0x00007fed8e054eca abort /build/buildd/glibc-2.21/stdlib/abort.c:91:0
#6 0x00007fed8e04c03d __assert_fail_base /build/buildd/glibc-2.21/assert/assert.c:92:0
#7 0x00007fed8e04c0f2 (/lib/x86_64-linux-gnu/libc.so.6+0x2e0f2)
#8 0x00000000016c20f2 (llvm.inst/bin/clang+0x16c20f2)
#9 0x00000000016c2710 llvm::LowerDbgDeclare(llvm::Function&) (llvm.inst/bin/clang+0x16c2710)
#10 0x00000000012ab472 combineInstructionsOverFunction(llvm::Function&, llvm::InstCombineWorklist&, llvm::AAResults*, llvm::AssumptionCache&, llvm::TargetLibraryInfo&, llvm::DominatorTree&, llvm::OptimizationRemarkEmitter&, bool, llvm::LoopInfo*) (llvm.inst/bin/clang+0x12ab472)
#11 0x00000000012aca4b llvm::InstructionCombiningPass::runOnFunction(llvm::Function&) (llvm.inst/bin/clang+0x12aca4b)
#12 0x00000000011b8b57 llvm::FPPassManager::runOnFunction(llvm::Function&) (llvm.inst/bin/clang+0x11b8b57)
#13 0x00000000011b8db3 llvm::FPPassManager::runOnModule(llvm::Module&) (llvm.inst/bin/clang+0x11b8db3)
#14 0x00000000011b92bb llvm::legacy::PassManagerImpl::run(llvm::Module&) (llvm.inst/bin/clang+0x11b92bb)
#15 0x000000000181f0ac clang::EmitBackendOutput(clang::DiagnosticsEngine&, clang::HeaderSearchOptions const&, clang::CodeGenOptions const&, clang::TargetOptions const&, clang::LangOptions const&, llvm::DataLayout const&, llvm::Module*, clang::BackendAction, std::unique_ptr<llvm::raw_pwrite_stream, std::default_delete<llvm::raw_pwrite_stream> >) (llvm.inst/bin/clang+0x181f0ac)
#16 0x0000000002115f22 clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&) (llvm.inst/bin/clang+0x2115f22)
#17 0x0000000002685084 clang::ParseAST(clang::Sema&, bool, bool) (llvm.inst/bin/clang+0x2685084)
#18 0x0000000001c8ef98 clang::FrontendAction::Execute() (llvm.inst/bin/clang+0x1c8ef98)
#19 0x0000000001c4e101 clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (llvm.inst/bin/clang+0x1c4e101)
#20 0x0000000001d3205a clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (llvm.inst/bin/clang+0x1d3205a)
#21 0x0000000000854b9c cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (llvm.inst/bin/clang+0x854b9c)
#22 0x0000000000853025 main (llvm.inst/bin/clang+0x853025)
#23 0x00007fed8e03ea40 __libc_start_main /build/buildd/glibc-2.21/csu/libc-start.c:323:0
#24 0x000000000084fbb9 _start (llvm.inst/bin/clang+0x84fbb9)
clang: error: unable to execute command: Aborted (core dumped)
clang: error: clang frontend command failed due to signal (use -v to see invocation)
clang version 7.0.0 (trunk 334899)
Target: aarch64--linux-android
Thread model: posix
InstalledDir: llvm.inst/bin


On 6/15/2018 6:48 AM, Bjorn Pettersson via llvm-commits wrote:

Author: bjope

Date: Fri Jun 15 06:48:55 2018

New Revision: 334830



URL: http://llvm.org/viewvc/llvm-project?rev=334830&view=rev

Log:

Re-apply "[DebugInfo] Check size of variable in ConvertDebugDeclareToDebugValue"



This is r334704 (which was reverted in r334732) with a fix for

types like x86_fp80. We need to use getTypeAllocSizeInBits and

not getTypeStoreSizeInBits to avoid dropping debug info for

such types.



Original commit msg:

Summary:

Do not convert a DbgDeclare to DbgValue if the store

instruction only refer to a fragment of the variable

described by the DbgDeclare.



Problem was seen when for example having an alloca for an

array or struct, and there were stores to individual elements.

In the past we inserted a DbgValue intrinsics for each store,

just as if the store wrote the whole variable.



When handling store instructions we insert a DbgValue that

indicates that the variable is "undefined", as we do not know

which part of the variable that is updated by the store.



When ConvertDebugDeclareToDebugValue is used with a load/phi

instruction we assert that the referenced value is large enough

to cover the whole variable. Afaict this should be true for all

scenarios where those methods are used on trunk. If the assert

blows in the future I guess we could simply skip to insert a

dbg.value instruction.



In the future I think we should examine which part of the variable

that is accessed, and add a DbgValue instrinsic with an appropriate

DW_OP_LLVM_fragment expression.



Reviewers: dblaikie, aprantl, rnk



Reviewed By: aprantl



Subscribers: JDevlieghere, llvm-commits



Tags: #debug-info



Differential Revision: https://reviews.llvm.org/D48024



Added:

    llvm/trunk/test/DebugInfo/X86/mem2reg_fp80.ll

    llvm/trunk/test/Transforms/Mem2Reg/debug-alloca-phi-2.ll

Modified:

    llvm/trunk/include/llvm/IR/IntrinsicInst.h

    llvm/trunk/lib/IR/IntrinsicInst.cpp

    llvm/trunk/lib/Transforms/Utils/Local.cpp

    llvm/trunk/test/Transforms/InstCombine/debuginfo.ll



Modified: llvm/trunk/include/llvm/IR/IntrinsicInst.h

URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/IR/IntrinsicInst.h?rev=334830&r1=334829&r2=334830&view=diff

==============================================================================

--- llvm/trunk/include/llvm/IR/IntrinsicInst.h (original)

+++ llvm/trunk/include/llvm/IR/IntrinsicInst.h Fri Jun 15 06:48:55 2018

@@ -93,6 +93,10 @@ namespace llvm {

       return cast<MetadataAsValue>(getArgOperand(2))->getMetadata();

     }



+    /// Get the size (in bits) of the variable, or fragment of the variable that

+    /// is described.

+    Optional<uint64_t> getFragmentSizeInBits() const;

+

     /// \name Casting methods

     /// @{

     static bool classof(const IntrinsicInst *I) {



Modified: llvm/trunk/lib/IR/IntrinsicInst.cpp

URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/IntrinsicInst.cpp?rev=334830&r1=334829&r2=334830&view=diff

==============================================================================

--- llvm/trunk/lib/IR/IntrinsicInst.cpp (original)

+++ llvm/trunk/lib/IR/IntrinsicInst.cpp Fri Jun 15 06:48:55 2018

@@ -24,6 +24,7 @@

 #include "llvm/IR/IntrinsicInst.h"

 #include "llvm/ADT/StringSwitch.h"

 #include "llvm/IR/Constants.h"

+#include "llvm/IR/DebugInfoMetadata.h"

 #include "llvm/IR/GlobalVariable.h"

 #include "llvm/IR/Metadata.h"

 #include "llvm/IR/Module.h"

@@ -48,6 +49,12 @@ Value *DbgInfoIntrinsic::getVariableLoca

   return nullptr;

 }



+Optional<uint64_t> DbgInfoIntrinsic::getFragmentSizeInBits() const {

+  if (auto Fragment = getExpression()->getFragmentInfo())

+    return Fragment->SizeInBits;

+  return getVariable()->getSizeInBits();

+}

+

 int llvm::Intrinsic::lookupLLVMIntrinsicByName(ArrayRef<const char *> NameTable,

                                                StringRef Name) {

   assert(Name.startswith("llvm."));



Modified: llvm/trunk/lib/Transforms/Utils/Local.cpp

URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Utils/Local.cpp?rev=334830&r1=334829&r2=334830&view=diff

==============================================================================

--- llvm/trunk/lib/Transforms/Utils/Local.cpp (original)

+++ llvm/trunk/lib/Transforms/Utils/Local.cpp Fri Jun 15 06:48:55 2018

@@ -1228,6 +1228,23 @@ static bool PhiHasDebugValue(DILocalVari

   return false;

 }



+/// Check if the alloc size of \p ValTy is large enough to cover the variable

+/// (or fragment of the variable) described by \p DII.

+///

+/// This is primarily intended as a helper for the different

+/// ConvertDebugDeclareToDebugValue functions. The dbg.declare/dbg.addr that is

+/// converted describes an alloca'd variable, so we need to use the

+/// alloc size of the value when doing the comparison. E.g. an i1 value will be

+/// identified as covering an n-bit fragment, if the store size of i1 is at

+/// least n bits.

+static bool valueCoversEntireFragment(Type *ValTy, DbgInfoIntrinsic *DII) {

+  const DataLayout &DL = DII->getModule()->getDataLayout();

+  uint64_t ValueSize = DL.getTypeAllocSizeInBits(ValTy);

+  if (auto FragmentSize = DII->getFragmentSizeInBits())

+    return ValueSize >= *FragmentSize;

+  return false;

+}

+

 /// Inserts a llvm.dbg.value intrinsic before a store to an alloca'd value

 /// that has an associated llvm.dbg.declare or llvm.dbg.addr intrinsic.

 void llvm::ConvertDebugDeclareToDebugValue(DbgInfoIntrinsic *DII,

@@ -1238,6 +1255,21 @@ void llvm::ConvertDebugDeclareToDebugVal

   auto *DIExpr = DII->getExpression();

   Value *DV = SI->getOperand(0);



+  if (!valueCoversEntireFragment(SI->getValueOperand()->getType(), DII)) {

+    // FIXME: If storing to a part of the variable described by the dbg.declare,

+    // then we want to insert a dbg.value for the corresponding fragment.

+    LLVM_DEBUG(dbgs() << "Failed to convert dbg.declare to dbg.value: "

+                      << *DII << '\n');

+    // For now, when there is a store to parts of the variable (but we do not

+    // know which part) we insert an dbg.value instrinsic to indicate that we

+    // know nothing about the variable's content.

+    DV = UndefValue::get(DV->getType());

+    if (!LdStHasDebugValue(DIVar, DIExpr, SI))

+      Builder.insertDbgValueIntrinsic(DV, DIVar, DIExpr, DII->getDebugLoc(),

+                                      SI);

+    return;

+  }

+

   // If an argument is zero extended then use argument directly. The ZExt

   // may be zapped by an optimization pass in future.

   Argument *ExtendedArg = nullptr;

@@ -1281,6 +1313,9 @@ void llvm::ConvertDebugDeclareToDebugVal

   if (LdStHasDebugValue(DIVar, DIExpr, LI))

     return;



+  assert(valueCoversEntireFragment(LI->getType(), DII) &&

+         "Load is not loading the full variable fragment.");

+

   // We are now tracking the loaded value instead of the address. In the

   // future if multi-location support is added to the IR, it might be

   // preferable to keep tracking both the loaded value and the original

@@ -1301,6 +1336,9 @@ void llvm::ConvertDebugDeclareToDebugVal

   if (PhiHasDebugValue(DIVar, DIExpr, APN))

     return;



+  assert(valueCoversEntireFragment(APN->getType(), DII) &&

+         "PHI node is not describing the full variable.");

+

   BasicBlock *BB = APN->getParent();

   auto InsertionPt = BB->getFirstInsertionPt();





Added: llvm/trunk/test/DebugInfo/X86/mem2reg_fp80.ll

URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/X86/mem2reg_fp80.ll?rev=334830&view=auto

==============================================================================

--- llvm/trunk/test/DebugInfo/X86/mem2reg_fp80.ll (added)

+++ llvm/trunk/test/DebugInfo/X86/mem2reg_fp80.ll Fri Jun 15 06:48:55 2018

@@ -0,0 +1,57 @@

+; RUN: opt < %s -mem2reg -S | FileCheck %s

+

+target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"

+target triple = "x86_64-unknown-linux-gnu"

+

+define dso_local x86_fp80 @powixf2() !dbg !1 {

+entry:

+  %r = alloca x86_fp80, align 16

+  call void @llvm.dbg.declare(metadata x86_fp80* %r, metadata !14, metadata !DIExpression()), !dbg !15

+  br i1 undef, label %if.then, label %if.end, !dbg !16

+

+if.then:                                          ; preds = %entry

+; CHECK-label: if.then:

+; CHECK: %mul = fmul x86_fp80

+; CHECK: call void @llvm.dbg.value(metadata x86_fp80 %mul, metadata {{.*}}, metadata !DIExpression())

+  %mul = fmul x86_fp80 undef, undef, !dbg !18

+  store x86_fp80 %mul, x86_fp80* %r, align 16, !dbg !18

+  br label %if.end, !dbg !20

+

+if.end:                                           ; preds = %if.then, %entry

+; CHECK-label: if.end:

+; CHECK: %r.0 = phi x86_fp80

+; CHECK: call void @llvm.dbg.value(metadata x86_fp80 %r.0, metadata {{.*}}, metadata !DIExpression())

+  %out = load x86_fp80, x86_fp80* %r, align 16, !dbg !21

+  ret x86_fp80 %out, !dbg !22

+}

+

+declare void @llvm.dbg.declare(metadata, metadata, metadata) #0

+

+attributes #0 = { nounwind readnone speculatable }

+

+!llvm.dbg.cu = !{}

+!llvm.module.flags = !{!0}

+

+!0 = !{i32 2, !"Debug Info Version", i32 3}

+!1 = distinct !DISubprogram(name: "__powixf2", scope: !2, file: !2, line: 22, type: !3, isLocal: false, isDefinition: true, scopeLine: 23, flags: DIFlagPrototyped, isOptimized: true, unit: !11, retainedNodes: !13)

+!2 = !DIFile(filename: "powixf2.c", directory: "")

+!3 = !DISubroutineType(types: !4)

+!4 = !{!5, !5, !6}

+!5 = !DIBasicType(name: "long double", size: 128, encoding: DW_ATE_float)

+!6 = !DIDerivedType(tag: DW_TAG_typedef, name: "si_int", file: !7, line: 28, baseType: !8)

+!7 = !DIFile(filename: "int_types.h", directory: "")

+!8 = !DIDerivedType(tag: DW_TAG_typedef, name: "int32_t", file: !9, line: 39, baseType: !10)

+!9 = !DIFile(filename: "/usr/include/stdint.h", directory: "")

+!10 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)

+!11 = distinct !DICompileUnit(language: DW_LANG_C99, file: !2, producer: "clang version 7.0.0 () ()", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !12)

+!12 = !{}

+!13 = !{!14}

+!14 = !DILocalVariable(name: "r", scope: !1, file: !2, line: 25, type: !5)

+!15 = !DILocation(line: 25, column: 17, scope: !1)

+!16 = !DILocation(line: 28, column: 13, scope: !17)

+!17 = distinct !DILexicalBlock(scope: !1, file: !2, line: 27, column: 5)

+!18 = !DILocation(line: 29, column: 15, scope: !19)

+!19 = distinct !DILexicalBlock(scope: !17, file: !2, line: 28, column: 13)

+!20 = !DILocation(line: 29, column: 13, scope: !19)

+!21 = !DILocation(line: 35, column: 22, scope: !1)

+!22 = !DILocation(line: 35, column: 5, scope: !1)



Modified: llvm/trunk/test/Transforms/InstCombine/debuginfo.ll

URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/debuginfo.ll?rev=334830&r1=334829&r2=334830&view=diff

==============================================================================

--- llvm/trunk/test/Transforms/InstCombine/debuginfo.ll (original)

+++ llvm/trunk/test/Transforms/InstCombine/debuginfo.ll Fri Jun 15 06:48:55 2018

@@ -71,9 +71,11 @@ entry:

 ; NOLOWER-NOT: alloca

 ; NOLOWER-NOT: store

 ; NOLOWER-NOT: call void @llvm.dbg.declare

-; NOLOWER: call void @llvm.dbg.value(metadata i64 %o.coerce0, {{.*}})

+; Here we want to find:  call void @llvm.dbg.value(metadata i64 %o.coerce0, metadata [[VARIABLE_O]], metadata !DIExpression(DW_OP_LLVM_fragment, 0, 64))

+; NOLOWER: call void @llvm.dbg.value(metadata i64 undef, {{.*}})

 ; NOLOWER-NOT: store

-; NOLOWER: call void @llvm.dbg.value(metadata i64 %o.coerce1, {{.*}})

+; Here we want to find:  call void @llvm.dbg.value(metadata i64 %o.coerce1, metadata [[VARIABLE_O]], metadata !DIExpression(DW_OP_LLVM_fragment, 64, 64))

+; NOLOWER: call void @llvm.dbg.value(metadata i64 undef, {{.*}})

 ; NOLOWER-NOT: store

 ; NOLOWER: call void @tworegs_callee(i64 %o.coerce0, i64 %o.coerce1)





Added: llvm/trunk/test/Transforms/Mem2Reg/debug-alloca-phi-2.ll

URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/Mem2Reg/debug-alloca-phi-2.ll?rev=334830&view=auto

==============================================================================

--- llvm/trunk/test/Transforms/Mem2Reg/debug-alloca-phi-2.ll (added)

+++ llvm/trunk/test/Transforms/Mem2Reg/debug-alloca-phi-2.ll Fri Jun 15 06:48:55 2018

@@ -0,0 +1,46 @@

+; RUN: opt < %s -mem2reg -S | FileCheck %s

+source_filename = "bugpoint-output.bc"

+target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"

+target triple = "x86_64-apple-macosx10.12.0"

+

+define void @scan() #0 !dbg !12 {

+entry:

+  %entry1 = alloca i1, align 8

+  call void @llvm.dbg.declare(metadata i1* %entry1, metadata !18, metadata !19), !dbg !20

+  store i1 0, i1* %entry1, align 8, !dbg !20

+  br label %for.cond, !dbg !20

+

+for.cond:

+; CHECK: %[[PHI:.*]] = phi i1 [ false, %entry ], [ %0, %for.cond ]

+  %entryN = load i1, i1* %entry1, align 8, !dbg !20

+; CHECK: call void @llvm.dbg.value(metadata i1 %[[PHI]],

+; CHECK-SAME:                      metadata !DIExpression())

+  %0 = add i1 %entryN, 1

+; CHECK: %0 = add i1 %[[PHI]], true

+; CHECK: call void @llvm.dbg.value(metadata i1 %0,

+; CHECK-SAME:                      metadata !DIExpression())

+  store i1 %0, i1* %entry1, align 8, !dbg !20

+  br label %for.cond, !dbg !20

+}

+

+declare void @llvm.dbg.declare(metadata, metadata, metadata) #1

+

+attributes #0 = { nounwind ssp uwtable }

+attributes #1 = { nounwind readnone }

+

+!llvm.dbg.cu = !{!0}

+!llvm.module.flags = !{!10, !11}

+

+!0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "adrian", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug)

+!1 = !DIFile(filename: "<stdin>", directory: "/")

+!2 = !{}

+!4 = !DIBasicType(name: "char", size: 8, encoding: DW_ATE_signed_char)

+!10 = !{i32 2, !"Debug Info Version", i32 3}

+!11 = !{i32 1, !"PIC Level", i32 2}

+!12 = distinct !DISubprogram(name: "scan", scope: !1, file: !1, line: 4, type: !13, isLocal: false, isDefinition: true, scopeLine: 5, flags: DIFlagPrototyped, isOptimized: true, unit: !0, retainedNodes: !15)

+!13 = !DISubroutineType(types: !14)

+!14 = !{null, !4, !4}

+!15 = !{!18}

+!18 = !DILocalVariable(name: "entry", scope: !12, file: !1, line: 6, type: !4)

+!19 = !DIExpression()

+!20 = !DILocation(line: 6, scope: !12)





_______________________________________________

llvm-commits mailing list

llvm-commits at lists.llvm.org<mailto:llvm-commits at lists.llvm.org>

http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits



--

Employee of Qualcomm Innovation Center, Inc.

Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180619/546684ba/attachment.html>


More information about the llvm-commits mailing list