<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <div class="moz-cite-prefix">Preprocessed source attached. 
      Reproduce with "clang -O3 -g --target=aarch64-pc-linux-gnu".<br>
      <br>
      -Eli<br>
      <br>
      On 6/19/2018 1:10 AM, Björn Pettersson A wrote:<br>
    </div>
    <blockquote type="cite"
cite="mid:HE1PR0702MB3788DEB294B03198F6121462B0700@HE1PR0702MB3788.eurprd07.prod.outlook.com">
      <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
      <meta name="Generator" content="Microsoft Word 15 (filtered
        medium)">
      <style><!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Consolas;
        panose-1:2 11 6 9 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;
        color:black;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
pre
        {mso-style-priority:99;
        mso-style-link:"HTML Preformatted Char";
        margin:0cm;
        margin-bottom:.0001pt;
        font-size:10.0pt;
        font-family:"Courier New";
        color:black;}
p.msonormal0, li.msonormal0, div.msonormal0
        {mso-style-name:msonormal;
        mso-margin-top-alt:auto;
        margin-right:0cm;
        mso-margin-bottom-alt:auto;
        margin-left:0cm;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;
        color:black;}
span.stdout
        {mso-style-name:stdout;}
span.HTMLPreformattedChar
        {mso-style-name:"HTML Preformatted Char";
        mso-style-priority:99;
        mso-style-link:"HTML Preformatted";
        font-family:Consolas;
        color:black;}
span.EmailStyle22
        {mso-style-type:personal-reply;
        font-family:"Calibri",sans-serif;
        color:windowtext;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:70.85pt 70.85pt 70.85pt 70.85pt;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
      <div class="WordSection1">
        <p class="MsoNormal"><span
            style="color:windowtext;mso-fareast-language:EN-US"
            lang="EN-US">Preprocessed source would be helpful. I never
            used polly, so I’m not sure exactly how to reproduce this.<o:p></o:p></span></p>
        <p class="MsoNormal"><span
            style="color:windowtext;mso-fareast-language:EN-US"
            lang="EN-US"><o:p> </o:p></span></p>
        <p class="MsoNormal"><span
            style="color:windowtext;mso-fareast-language:EN-US"
            lang="EN-US">The
          </span><span style="color:windowtext" lang="EN-US">"[DebugInfo]
            Check size of variable in ConvertDebugDeclareToDebugValue"
            commit is basically about avoiding faulty debug-info.<o:p></o:p></span></p>
        <p class="MsoNormal"><span
            style="color:windowtext;mso-fareast-language:EN-US"
            lang="EN-US">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.<o:p></o:p></span></p>
        <p class="MsoNormal"><span
            style="color:windowtext;mso-fareast-language:EN-US"
            lang="EN-US"><o:p> </o:p></span></p>
        <p class="MsoNormal"><span
            style="color:windowtext;mso-fareast-language:EN-US"
            lang="EN-US">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. <o:p></o:p></span></p>
        <p class="MsoNormal"><span
            style="color:windowtext;mso-fareast-language:EN-US"
            lang="EN-US"><o:p> </o:p></span></p>
        <p class="MsoNormal"><span
            style="color:windowtext;mso-fareast-language:EN-US"
            lang="EN-US">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).<o:p></o:p></span></p>
        <p class="MsoNormal"><span
            style="color:windowtext;mso-fareast-language:EN-US"
            lang="EN-US">I’ll simply remove those asserts until I can
            reproduce the problem seen with polly-aosp.
            <o:p></o:p></span></p>
        <p class="MsoNormal"><span
            style="color:windowtext;mso-fareast-language:EN-US"
            lang="EN-US"><o:p> </o:p></span></p>
        <p class="MsoNormal"><span
            style="color:windowtext;mso-fareast-language:EN-US"
            lang="EN-US">/Björn<o:p></o:p></span></p>
        <p class="MsoNormal"><span
            style="color:windowtext;mso-fareast-language:EN-US"
            lang="EN-US"><o:p> </o:p></span></p>
        <p class="MsoNormal"><span
            style="color:windowtext;mso-fareast-language:EN-US"
            lang="EN-US"><o:p> </o:p></span></p>
        <div style="border:none;border-left:solid blue 1.5pt;padding:0cm
          0cm 0cm 4.0pt">
          <div>
            <div style="border:none;border-top:solid #E1E1E1
              1.0pt;padding:3.0pt 0cm 0cm 0cm">
              <p class="MsoNormal"><b><span style="color:windowtext"
                    lang="EN-US">From:</span></b><span
                  style="color:windowtext" lang="EN-US"> Friedman, Eli
                  <a class="moz-txt-link-rfc2396E" href="mailto:efriedma@codeaurora.org"><efriedma@codeaurora.org></a>
                  <br>
                  <b>Sent:</b> den 19 juni 2018 02:55<br>
                  <b>To:</b> Björn Pettersson A
                  <a class="moz-txt-link-rfc2396E" href="mailto:bjorn.a.pettersson@ericsson.com"><bjorn.a.pettersson@ericsson.com></a>;
                  <a class="moz-txt-link-abbreviated" href="mailto:llvm-commits@lists.llvm.org">llvm-commits@lists.llvm.org</a><br>
                  <b>Subject:</b> Re: [llvm] r334830 - Re-apply
                  "[DebugInfo] Check size of variable in
                  ConvertDebugDeclareToDebugValue"<o:p></o:p></span></p>
            </div>
          </div>
          <p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
          <div>
            <p class="MsoNormal">I'm seeing a crash on the polly-aosp
              buildbot (<a
href="http://lab.llvm.org:8011/builders/aosp-O3-polly-before-vectorizer-unprofitable/builds/552/steps/build-aosp/logs/stdio"
                moz-do-not-send="true">http://lab.llvm.org:8011/builders/aosp-O3-polly-before-vectorizer-unprofitable/builds/552/steps/build-aosp/logs/stdio</a>)
              which looks like it's caused by this patch.  Any idea
              what's going on?  I can send preprocessed source if you
              need it.<br>
              <br>
              -Eli<br>
              <br>
              from build log:<br>
              <br>
              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.<br>
              Stack dump:<br>
              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
              <br>
              1.    <eof> parser at end of file<br>
              2.    Per-module optimization passes<br>
              3.    Running pass 'Function Pass Manager' on module
              'external/strace/desc.c'.<br>
              4.    Running pass 'Combine redundant instructions' on
              function '@umove_kulong_array_or_printaddr'<br>
              #0 0x00000000016611d4 PrintStackTraceSignalHandler(void*)
              (llvm.inst/bin/clang+0x16611d4)<br>
              #1 0x000000000165f550 llvm::sys::RunSignalHandlers()
              (llvm.inst/bin/clang+0x165f550)<br>
              #2 0x0000000001661378 SignalHandler(int)
              (llvm.inst/bin/clang+0x1661378)<br>
              #3 0x00007fed8f475d10 __restore_rt
              (/lib/x86_64-linux-gnu/libpthread.so.0+0x10d10)<br>
              #4 0x00007fed8e053267 gsignal
              /build/buildd/glibc-2.21/signal/../sysdeps/unix/sysv/linux/raise.c:55:0<br>
              #5 0x00007fed8e054eca abort
              /build/buildd/glibc-2.21/stdlib/abort.c:91:0<br>
              #6 0x00007fed8e04c03d __assert_fail_base
              /build/buildd/glibc-2.21/assert/assert.c:92:0<br>
              #7 0x00007fed8e04c0f2
              (/lib/x86_64-linux-gnu/libc.so.6+0x2e0f2)<br>
              #8 0x00000000016c20f2 (llvm.inst/bin/clang+0x16c20f2)<br>
              #9 0x00000000016c2710
              llvm::LowerDbgDeclare(llvm::Function&)
              (llvm.inst/bin/clang+0x16c2710)<br>
              #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)<br>
              #11 0x00000000012aca4b
              llvm::InstructionCombiningPass::runOnFunction(llvm::Function&)
              (llvm.inst/bin/clang+0x12aca4b)<br>
              #12 0x00000000011b8b57
              llvm::FPPassManager::runOnFunction(llvm::Function&)
              (llvm.inst/bin/clang+0x11b8b57)<br>
              #13 0x00000000011b8db3
              llvm::FPPassManager::runOnModule(llvm::Module&)
              (llvm.inst/bin/clang+0x11b8db3)<br>
              #14 0x00000000011b92bb
              llvm::legacy::PassManagerImpl::run(llvm::Module&)
              (llvm.inst/bin/clang+0x11b92bb)<br>
              #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)<br>
              #16 0x0000000002115f22
              clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&)
              (llvm.inst/bin/clang+0x2115f22)<br>
              #17 0x0000000002685084 clang::ParseAST(clang::Sema&,
              bool, bool) (llvm.inst/bin/clang+0x2685084)<br>
              #18 0x0000000001c8ef98 clang::FrontendAction::Execute()
              (llvm.inst/bin/clang+0x1c8ef98)<br>
              #19 0x0000000001c4e101
              clang::CompilerInstance::ExecuteAction(clang::FrontendAction&)
              (llvm.inst/bin/clang+0x1c4e101)<br>
              #20 0x0000000001d3205a
              clang::ExecuteCompilerInvocation(clang::CompilerInstance*)
              (llvm.inst/bin/clang+0x1d3205a)<br>
              #21 0x0000000000854b9c cc1_main(llvm::ArrayRef<char
              const*>, char const*, void*)
              (llvm.inst/bin/clang+0x854b9c)<br>
              #22 0x0000000000853025 main (llvm.inst/bin/clang+0x853025)<br>
              #23 0x00007fed8e03ea40 __libc_start_main
              /build/buildd/glibc-2.21/csu/libc-start.c:323:0<br>
              #24 0x000000000084fbb9 _start
              (llvm.inst/bin/clang+0x84fbb9)<br>
              clang: error: unable to execute command: Aborted (core
              dumped)<br>
              clang: error: clang frontend command failed due to signal
              (use -v to see invocation)<br>
              clang version 7.0.0 (trunk 334899)<br>
              Target: aarch64--linux-android<br>
              Thread model: posix<br>
              InstalledDir: llvm.inst/bin<br>
              <br>
              <span class="stdout"><span
                  style="font-family:"Courier New""> </span></span><br>
              On 6/15/2018 6:48 AM, Bjorn Pettersson via llvm-commits
              wrote:<o:p></o:p></p>
          </div>
          <blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
            <pre>Author: bjope<o:p></o:p></pre>
            <pre>Date: Fri Jun 15 06:48:55 2018<o:p></o:p></pre>
            <pre>New Revision: 334830<o:p></o:p></pre>
            <pre><o:p> </o:p></pre>
            <pre>URL: <a href="http://llvm.org/viewvc/llvm-project?rev=334830&view=rev" moz-do-not-send="true">http://llvm.org/viewvc/llvm-project?rev=334830&view=rev</a><o:p></o:p></pre>
            <pre>Log:<o:p></o:p></pre>
            <pre>Re-apply "[DebugInfo] Check size of variable in ConvertDebugDeclareToDebugValue"<o:p></o:p></pre>
            <pre><o:p> </o:p></pre>
            <pre>This is r334704 (which was reverted in r334732) with a fix for<o:p></o:p></pre>
            <pre>types like x86_fp80. We need to use getTypeAllocSizeInBits and<o:p></o:p></pre>
            <pre>not getTypeStoreSizeInBits to avoid dropping debug info for<o:p></o:p></pre>
            <pre>such types.<o:p></o:p></pre>
            <pre><o:p> </o:p></pre>
            <pre>Original commit msg:<o:p></o:p></pre>
            <blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
              <pre>Summary:<o:p></o:p></pre>
              <pre>Do not convert a DbgDeclare to DbgValue if the store<o:p></o:p></pre>
              <pre>instruction only refer to a fragment of the variable<o:p></o:p></pre>
              <pre>described by the DbgDeclare.<o:p></o:p></pre>
              <pre><o:p> </o:p></pre>
              <pre>Problem was seen when for example having an alloca for an<o:p></o:p></pre>
              <pre>array or struct, and there were stores to individual elements.<o:p></o:p></pre>
              <pre>In the past we inserted a DbgValue intrinsics for each store,<o:p></o:p></pre>
              <pre>just as if the store wrote the whole variable.<o:p></o:p></pre>
              <pre><o:p> </o:p></pre>
              <pre>When handling store instructions we insert a DbgValue that<o:p></o:p></pre>
              <pre>indicates that the variable is "undefined", as we do not know<o:p></o:p></pre>
              <pre>which part of the variable that is updated by the store.<o:p></o:p></pre>
              <pre><o:p> </o:p></pre>
              <pre>When ConvertDebugDeclareToDebugValue is used with a load/phi<o:p></o:p></pre>
              <pre>instruction we assert that the referenced value is large enough<o:p></o:p></pre>
              <pre>to cover the whole variable. Afaict this should be true for all<o:p></o:p></pre>
              <pre>scenarios where those methods are used on trunk. If the assert<o:p></o:p></pre>
              <pre>blows in the future I guess we could simply skip to insert a<o:p></o:p></pre>
              <pre>dbg.value instruction.<o:p></o:p></pre>
              <pre><o:p> </o:p></pre>
              <pre>In the future I think we should examine which part of the variable<o:p></o:p></pre>
              <pre>that is accessed, and add a DbgValue instrinsic with an appropriate<o:p></o:p></pre>
              <pre>DW_OP_LLVM_fragment expression.<o:p></o:p></pre>
              <pre><o:p> </o:p></pre>
              <pre>Reviewers: dblaikie, aprantl, rnk<o:p></o:p></pre>
              <pre><o:p> </o:p></pre>
              <pre>Reviewed By: aprantl<o:p></o:p></pre>
              <pre><o:p> </o:p></pre>
              <pre>Subscribers: JDevlieghere, llvm-commits<o:p></o:p></pre>
              <pre><o:p> </o:p></pre>
              <pre>Tags: #debug-info<o:p></o:p></pre>
              <pre><o:p> </o:p></pre>
              <pre>Differential Revision: <a href="https://reviews.llvm.org/D48024" moz-do-not-send="true">https://reviews.llvm.org/D48024</a><o:p></o:p></pre>
            </blockquote>
            <pre><o:p> </o:p></pre>
            <pre>Added:<o:p></o:p></pre>
            <pre>    llvm/trunk/test/DebugInfo/X86/mem2reg_fp80.ll<o:p></o:p></pre>
            <pre>    llvm/trunk/test/Transforms/Mem2Reg/debug-alloca-phi-2.ll<o:p></o:p></pre>
            <pre>Modified:<o:p></o:p></pre>
            <pre>    llvm/trunk/include/llvm/IR/IntrinsicInst.h<o:p></o:p></pre>
            <pre>    llvm/trunk/lib/IR/IntrinsicInst.cpp<o:p></o:p></pre>
            <pre>    llvm/trunk/lib/Transforms/Utils/Local.cpp<o:p></o:p></pre>
            <pre>    llvm/trunk/test/Transforms/InstCombine/debuginfo.ll<o:p></o:p></pre>
            <pre><o:p> </o:p></pre>
            <pre>Modified: llvm/trunk/include/llvm/IR/IntrinsicInst.h<o:p></o:p></pre>
            <pre>URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/IR/IntrinsicInst.h?rev=334830&r1=334829&r2=334830&view=diff" moz-do-not-send="true">http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/IR/IntrinsicInst.h?rev=334830&r1=334829&r2=334830&view=diff</a><o:p></o:p></pre>
            <pre>==============================================================================<o:p></o:p></pre>
            <pre>--- llvm/trunk/include/llvm/IR/IntrinsicInst.h (original)<o:p></o:p></pre>
            <pre>+++ llvm/trunk/include/llvm/IR/IntrinsicInst.h Fri Jun 15 06:48:55 2018<o:p></o:p></pre>
            <pre>@@ -93,6 +93,10 @@ namespace llvm {<o:p></o:p></pre>
            <pre>       return cast<MetadataAsValue>(getArgOperand(2))->getMetadata();<o:p></o:p></pre>
            <pre>     }<o:p></o:p></pre>
            <pre> <o:p></o:p></pre>
            <pre>+    /// Get the size (in bits) of the variable, or fragment of the variable that<o:p></o:p></pre>
            <pre>+    /// is described.<o:p></o:p></pre>
            <pre>+    Optional<uint64_t> getFragmentSizeInBits() const;<o:p></o:p></pre>
            <pre>+<o:p></o:p></pre>
            <pre>     /// \name Casting methods<o:p></o:p></pre>
            <pre>     /// @{<o:p></o:p></pre>
            <pre>     static bool classof(const IntrinsicInst *I) {<o:p></o:p></pre>
            <pre><o:p> </o:p></pre>
            <pre>Modified: llvm/trunk/lib/IR/IntrinsicInst.cpp<o:p></o:p></pre>
            <pre>URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/IntrinsicInst.cpp?rev=334830&r1=334829&r2=334830&view=diff" moz-do-not-send="true">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/IntrinsicInst.cpp?rev=334830&r1=334829&r2=334830&view=diff</a><o:p></o:p></pre>
            <pre>==============================================================================<o:p></o:p></pre>
            <pre>--- llvm/trunk/lib/IR/IntrinsicInst.cpp (original)<o:p></o:p></pre>
            <pre>+++ llvm/trunk/lib/IR/IntrinsicInst.cpp Fri Jun 15 06:48:55 2018<o:p></o:p></pre>
            <pre>@@ -24,6 +24,7 @@<o:p></o:p></pre>
            <pre> #include "llvm/IR/IntrinsicInst.h"<o:p></o:p></pre>
            <pre> #include "llvm/ADT/StringSwitch.h"<o:p></o:p></pre>
            <pre> #include "llvm/IR/Constants.h"<o:p></o:p></pre>
            <pre>+#include "llvm/IR/DebugInfoMetadata.h"<o:p></o:p></pre>
            <pre> #include "llvm/IR/GlobalVariable.h"<o:p></o:p></pre>
            <pre> #include "llvm/IR/Metadata.h"<o:p></o:p></pre>
            <pre> #include "llvm/IR/Module.h"<o:p></o:p></pre>
            <pre>@@ -48,6 +49,12 @@ Value *DbgInfoIntrinsic::getVariableLoca<o:p></o:p></pre>
            <pre>   return nullptr;<o:p></o:p></pre>
            <pre> }<o:p></o:p></pre>
            <pre> <o:p></o:p></pre>
            <pre>+Optional<uint64_t> DbgInfoIntrinsic::getFragmentSizeInBits() const {<o:p></o:p></pre>
            <pre>+  if (auto Fragment = getExpression()->getFragmentInfo())<o:p></o:p></pre>
            <pre>+    return Fragment->SizeInBits;<o:p></o:p></pre>
            <pre>+  return getVariable()->getSizeInBits();<o:p></o:p></pre>
            <pre>+}<o:p></o:p></pre>
            <pre>+<o:p></o:p></pre>
            <pre> int llvm::Intrinsic::lookupLLVMIntrinsicByName(ArrayRef<const char *> NameTable,<o:p></o:p></pre>
            <pre>                                                StringRef Name) {<o:p></o:p></pre>
            <pre>   assert(Name.startswith("llvm."));<o:p></o:p></pre>
            <pre><o:p> </o:p></pre>
            <pre>Modified: llvm/trunk/lib/Transforms/Utils/Local.cpp<o:p></o:p></pre>
            <pre>URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Utils/Local.cpp?rev=334830&r1=334829&r2=334830&view=diff" moz-do-not-send="true">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Utils/Local.cpp?rev=334830&r1=334829&r2=334830&view=diff</a><o:p></o:p></pre>
            <pre>==============================================================================<o:p></o:p></pre>
            <pre>--- llvm/trunk/lib/Transforms/Utils/Local.cpp (original)<o:p></o:p></pre>
            <pre>+++ llvm/trunk/lib/Transforms/Utils/Local.cpp Fri Jun 15 06:48:55 2018<o:p></o:p></pre>
            <pre>@@ -1228,6 +1228,23 @@ static bool PhiHasDebugValue(DILocalVari<o:p></o:p></pre>
            <pre>   return false;<o:p></o:p></pre>
            <pre> }<o:p></o:p></pre>
            <pre> <o:p></o:p></pre>
            <pre>+/// Check if the alloc size of \p ValTy is large enough to cover the variable<o:p></o:p></pre>
            <pre>+/// (or fragment of the variable) described by \p DII.<o:p></o:p></pre>
            <pre>+///<o:p></o:p></pre>
            <pre>+/// This is primarily intended as a helper for the different<o:p></o:p></pre>
            <pre>+/// ConvertDebugDeclareToDebugValue functions. The dbg.declare/dbg.addr that is<o:p></o:p></pre>
            <pre>+/// converted describes an alloca'd variable, so we need to use the<o:p></o:p></pre>
            <pre>+/// alloc size of the value when doing the comparison. E.g. an i1 value will be<o:p></o:p></pre>
            <pre>+/// identified as covering an n-bit fragment, if the store size of i1 is at<o:p></o:p></pre>
            <pre>+/// least n bits.<o:p></o:p></pre>
            <pre>+static bool valueCoversEntireFragment(Type *ValTy, DbgInfoIntrinsic *DII) {<o:p></o:p></pre>
            <pre>+  const DataLayout &DL = DII->getModule()->getDataLayout();<o:p></o:p></pre>
            <pre>+  uint64_t ValueSize = DL.getTypeAllocSizeInBits(ValTy);<o:p></o:p></pre>
            <pre>+  if (auto FragmentSize = DII->getFragmentSizeInBits())<o:p></o:p></pre>
            <pre>+    return ValueSize >= *FragmentSize;<o:p></o:p></pre>
            <pre>+  return false;<o:p></o:p></pre>
            <pre>+}<o:p></o:p></pre>
            <pre>+<o:p></o:p></pre>
            <pre> /// Inserts a llvm.dbg.value intrinsic before a store to an alloca'd value<o:p></o:p></pre>
            <pre> /// that has an associated llvm.dbg.declare or llvm.dbg.addr intrinsic.<o:p></o:p></pre>
            <pre> void llvm::ConvertDebugDeclareToDebugValue(DbgInfoIntrinsic *DII,<o:p></o:p></pre>
            <pre>@@ -1238,6 +1255,21 @@ void llvm::ConvertDebugDeclareToDebugVal<o:p></o:p></pre>
            <pre>   auto *DIExpr = DII->getExpression();<o:p></o:p></pre>
            <pre>   Value *DV = SI->getOperand(0);<o:p></o:p></pre>
            <pre> <o:p></o:p></pre>
            <pre>+  if (!valueCoversEntireFragment(SI->getValueOperand()->getType(), DII)) {<o:p></o:p></pre>
            <pre>+    // FIXME: If storing to a part of the variable described by the dbg.declare,<o:p></o:p></pre>
            <pre>+    // then we want to insert a dbg.value for the corresponding fragment.<o:p></o:p></pre>
            <pre>+    LLVM_DEBUG(dbgs() << "Failed to convert dbg.declare to dbg.value: "<o:p></o:p></pre>
            <pre>+                      << *DII << '\n');<o:p></o:p></pre>
            <pre>+    // For now, when there is a store to parts of the variable (but we do not<o:p></o:p></pre>
            <pre>+    // know which part) we insert an dbg.value instrinsic to indicate that we<o:p></o:p></pre>
            <pre>+    // know nothing about the variable's content.<o:p></o:p></pre>
            <pre>+    DV = UndefValue::get(DV->getType());<o:p></o:p></pre>
            <pre>+    if (!LdStHasDebugValue(DIVar, DIExpr, SI))<o:p></o:p></pre>
            <pre>+      Builder.insertDbgValueIntrinsic(DV, DIVar, DIExpr, DII->getDebugLoc(),<o:p></o:p></pre>
            <pre>+                                      SI);<o:p></o:p></pre>
            <pre>+    return;<o:p></o:p></pre>
            <pre>+  }<o:p></o:p></pre>
            <pre>+<o:p></o:p></pre>
            <pre>   // If an argument is zero extended then use argument directly. The ZExt<o:p></o:p></pre>
            <pre>   // may be zapped by an optimization pass in future.<o:p></o:p></pre>
            <pre>   Argument *ExtendedArg = nullptr;<o:p></o:p></pre>
            <pre>@@ -1281,6 +1313,9 @@ void llvm::ConvertDebugDeclareToDebugVal<o:p></o:p></pre>
            <pre>   if (LdStHasDebugValue(DIVar, DIExpr, LI))<o:p></o:p></pre>
            <pre>     return;<o:p></o:p></pre>
            <pre> <o:p></o:p></pre>
            <pre>+  assert(valueCoversEntireFragment(LI->getType(), DII) &&<o:p></o:p></pre>
            <pre>+         "Load is not loading the full variable fragment.");<o:p></o:p></pre>
            <pre>+<o:p></o:p></pre>
            <pre>   // We are now tracking the loaded value instead of the address. In the<o:p></o:p></pre>
            <pre>   // future if multi-location support is added to the IR, it might be<o:p></o:p></pre>
            <pre>   // preferable to keep tracking both the loaded value and the original<o:p></o:p></pre>
            <pre>@@ -1301,6 +1336,9 @@ void llvm::ConvertDebugDeclareToDebugVal<o:p></o:p></pre>
            <pre>   if (PhiHasDebugValue(DIVar, DIExpr, APN))<o:p></o:p></pre>
            <pre>     return;<o:p></o:p></pre>
            <pre> <o:p></o:p></pre>
            <pre>+  assert(valueCoversEntireFragment(APN->getType(), DII) &&<o:p></o:p></pre>
            <pre>+         "PHI node is not describing the full variable.");<o:p></o:p></pre>
            <pre>+<o:p></o:p></pre>
            <pre>   BasicBlock *BB = APN->getParent();<o:p></o:p></pre>
            <pre>   auto InsertionPt = BB->getFirstInsertionPt();<o:p></o:p></pre>
            <pre> <o:p></o:p></pre>
            <pre><o:p> </o:p></pre>
            <pre>Added: llvm/trunk/test/DebugInfo/X86/mem2reg_fp80.ll<o:p></o:p></pre>
            <pre>URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/X86/mem2reg_fp80.ll?rev=334830&view=auto" moz-do-not-send="true">http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/X86/mem2reg_fp80.ll?rev=334830&view=auto</a><o:p></o:p></pre>
            <pre>==============================================================================<o:p></o:p></pre>
            <pre>--- llvm/trunk/test/DebugInfo/X86/mem2reg_fp80.ll (added)<o:p></o:p></pre>
            <pre>+++ llvm/trunk/test/DebugInfo/X86/mem2reg_fp80.ll Fri Jun 15 06:48:55 2018<o:p></o:p></pre>
            <pre>@@ -0,0 +1,57 @@<o:p></o:p></pre>
            <pre>+; RUN: opt < %s -mem2reg -S | FileCheck %s<o:p></o:p></pre>
            <pre>+<o:p></o:p></pre>
            <pre>+target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"<o:p></o:p></pre>
            <pre>+target triple = "x86_64-unknown-linux-gnu"<o:p></o:p></pre>
            <pre>+<o:p></o:p></pre>
            <pre>+define dso_local x86_fp80 @powixf2() !dbg !1 {<o:p></o:p></pre>
            <pre>+entry:<o:p></o:p></pre>
            <pre>+  %r = alloca x86_fp80, align 16<o:p></o:p></pre>
            <pre>+  call void @llvm.dbg.declare(metadata x86_fp80* %r, metadata !14, metadata !DIExpression()), !dbg !15<o:p></o:p></pre>
            <pre>+  br i1 undef, label %if.then, label %if.end, !dbg !16<o:p></o:p></pre>
            <pre>+<o:p></o:p></pre>
            <pre>+if.then:                                          ; preds = %entry<o:p></o:p></pre>
            <pre>+; CHECK-label: if.then:<o:p></o:p></pre>
            <pre>+; CHECK: %mul = fmul x86_fp80<o:p></o:p></pre>
            <pre>+; CHECK: call void @llvm.dbg.value(metadata x86_fp80 %mul, metadata {{.*}}, metadata !DIExpression())<o:p></o:p></pre>
            <pre>+  %mul = fmul x86_fp80 undef, undef, !dbg !18<o:p></o:p></pre>
            <pre>+  store x86_fp80 %mul, x86_fp80* %r, align 16, !dbg !18<o:p></o:p></pre>
            <pre>+  br label %if.end, !dbg !20<o:p></o:p></pre>
            <pre>+<o:p></o:p></pre>
            <pre>+if.end:                                           ; preds = %if.then, %entry<o:p></o:p></pre>
            <pre>+; CHECK-label: if.end:<o:p></o:p></pre>
            <pre>+; CHECK: %r.0 = phi x86_fp80<o:p></o:p></pre>
            <pre>+; CHECK: call void @llvm.dbg.value(metadata x86_fp80 %r.0, metadata {{.*}}, metadata !DIExpression())<o:p></o:p></pre>
            <pre>+  %out = load x86_fp80, x86_fp80* %r, align 16, !dbg !21<o:p></o:p></pre>
            <pre>+  ret x86_fp80 %out, !dbg !22<o:p></o:p></pre>
            <pre>+}<o:p></o:p></pre>
            <pre>+<o:p></o:p></pre>
            <pre>+declare void @llvm.dbg.declare(metadata, metadata, metadata) #0<o:p></o:p></pre>
            <pre>+<o:p></o:p></pre>
            <pre>+attributes #0 = { nounwind readnone speculatable }<o:p></o:p></pre>
            <pre>+<o:p></o:p></pre>
            <pre>+!llvm.dbg.cu = !{}<o:p></o:p></pre>
            <pre>+!llvm.module.flags = !{!0}<o:p></o:p></pre>
            <pre>+<o:p></o:p></pre>
            <pre>+!0 = !{i32 2, !"Debug Info Version", i32 3}<o:p></o:p></pre>
            <pre>+!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)<o:p></o:p></pre>
            <pre>+!2 = !DIFile(filename: "powixf2.c", directory: "")<o:p></o:p></pre>
            <pre>+!3 = !DISubroutineType(types: !4)<o:p></o:p></pre>
            <pre>+!4 = !{!5, !5, !6}<o:p></o:p></pre>
            <pre>+!5 = !DIBasicType(name: "long double", size: 128, encoding: DW_ATE_float)<o:p></o:p></pre>
            <pre>+!6 = !DIDerivedType(tag: DW_TAG_typedef, name: "si_int", file: !7, line: 28, baseType: !8)<o:p></o:p></pre>
            <pre>+!7 = !DIFile(filename: "int_types.h", directory: "")<o:p></o:p></pre>
            <pre>+!8 = !DIDerivedType(tag: DW_TAG_typedef, name: "int32_t", file: !9, line: 39, baseType: !10)<o:p></o:p></pre>
            <pre>+!9 = !DIFile(filename: "/usr/include/stdint.h", directory: "")<o:p></o:p></pre>
            <pre>+!10 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)<o:p></o:p></pre>
            <pre>+!11 = distinct !DICompileUnit(language: DW_LANG_C99, file: !2, producer: "clang version 7.0.0 () ()", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !12)<o:p></o:p></pre>
            <pre>+!12 = !{}<o:p></o:p></pre>
            <pre>+!13 = !{!14}<o:p></o:p></pre>
            <pre>+!14 = !DILocalVariable(name: "r", scope: !1, file: !2, line: 25, type: !5)<o:p></o:p></pre>
            <pre>+!15 = !DILocation(line: 25, column: 17, scope: !1)<o:p></o:p></pre>
            <pre>+!16 = !DILocation(line: 28, column: 13, scope: !17)<o:p></o:p></pre>
            <pre>+!17 = distinct !DILexicalBlock(scope: !1, file: !2, line: 27, column: 5)<o:p></o:p></pre>
            <pre>+!18 = !DILocation(line: 29, column: 15, scope: !19)<o:p></o:p></pre>
            <pre>+!19 = distinct !DILexicalBlock(scope: !17, file: !2, line: 28, column: 13)<o:p></o:p></pre>
            <pre>+!20 = !DILocation(line: 29, column: 13, scope: !19)<o:p></o:p></pre>
            <pre>+!21 = !DILocation(line: 35, column: 22, scope: !1)<o:p></o:p></pre>
            <pre>+!22 = !DILocation(line: 35, column: 5, scope: !1)<o:p></o:p></pre>
            <pre><o:p> </o:p></pre>
            <pre>Modified: llvm/trunk/test/Transforms/InstCombine/debuginfo.ll<o:p></o:p></pre>
            <pre>URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/debuginfo.ll?rev=334830&r1=334829&r2=334830&view=diff" moz-do-not-send="true">http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/debuginfo.ll?rev=334830&r1=334829&r2=334830&view=diff</a><o:p></o:p></pre>
            <pre>==============================================================================<o:p></o:p></pre>
            <pre>--- llvm/trunk/test/Transforms/InstCombine/debuginfo.ll (original)<o:p></o:p></pre>
            <pre>+++ llvm/trunk/test/Transforms/InstCombine/debuginfo.ll Fri Jun 15 06:48:55 2018<o:p></o:p></pre>
            <pre>@@ -71,9 +71,11 @@ entry:<o:p></o:p></pre>
            <pre> ; NOLOWER-NOT: alloca<o:p></o:p></pre>
            <pre> ; NOLOWER-NOT: store<o:p></o:p></pre>
            <pre> ; NOLOWER-NOT: call void @llvm.dbg.declare<o:p></o:p></pre>
            <pre>-; NOLOWER: call void @llvm.dbg.value(metadata i64 %o.coerce0, {{.*}})<o:p></o:p></pre>
            <pre>+; 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))<o:p></o:p></pre>
            <pre>+; NOLOWER: call void @llvm.dbg.value(metadata i64 undef, {{.*}})<o:p></o:p></pre>
            <pre> ; NOLOWER-NOT: store<o:p></o:p></pre>
            <pre>-; NOLOWER: call void @llvm.dbg.value(metadata i64 %o.coerce1, {{.*}})<o:p></o:p></pre>
            <pre>+; 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))<o:p></o:p></pre>
            <pre>+; NOLOWER: call void @llvm.dbg.value(metadata i64 undef, {{.*}})<o:p></o:p></pre>
            <pre> ; NOLOWER-NOT: store<o:p></o:p></pre>
            <pre> ; NOLOWER: call void @tworegs_callee(i64 %o.coerce0, i64 %o.coerce1)<o:p></o:p></pre>
            <pre> <o:p></o:p></pre>
            <pre><o:p> </o:p></pre>
            <pre>Added: llvm/trunk/test/Transforms/Mem2Reg/debug-alloca-phi-2.ll<o:p></o:p></pre>
            <pre>URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/Mem2Reg/debug-alloca-phi-2.ll?rev=334830&view=auto" moz-do-not-send="true">http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/Mem2Reg/debug-alloca-phi-2.ll?rev=334830&view=auto</a><o:p></o:p></pre>
            <pre>==============================================================================<o:p></o:p></pre>
            <pre>--- llvm/trunk/test/Transforms/Mem2Reg/debug-alloca-phi-2.ll (added)<o:p></o:p></pre>
            <pre>+++ llvm/trunk/test/Transforms/Mem2Reg/debug-alloca-phi-2.ll Fri Jun 15 06:48:55 2018<o:p></o:p></pre>
            <pre>@@ -0,0 +1,46 @@<o:p></o:p></pre>
            <pre>+; RUN: opt < %s -mem2reg -S | FileCheck %s<o:p></o:p></pre>
            <pre>+source_filename = "bugpoint-output.bc"<o:p></o:p></pre>
            <pre>+target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"<o:p></o:p></pre>
            <pre>+target triple = "x86_64-apple-macosx10.12.0"<o:p></o:p></pre>
            <pre>+<o:p></o:p></pre>
            <pre>+define void @scan() #0 !dbg !12 {<o:p></o:p></pre>
            <pre>+entry:<o:p></o:p></pre>
            <pre>+  %entry1 = alloca i1, align 8<o:p></o:p></pre>
            <pre>+  call void @llvm.dbg.declare(metadata i1* %entry1, metadata !18, metadata !19), !dbg !20<o:p></o:p></pre>
            <pre>+  store i1 0, i1* %entry1, align 8, !dbg !20<o:p></o:p></pre>
            <pre>+  br label %for.cond, !dbg !20<o:p></o:p></pre>
            <pre>+<o:p></o:p></pre>
            <pre>+for.cond:<o:p></o:p></pre>
            <pre>+; CHECK: %[[PHI:.*]] = phi i1 [ false, %entry ], [ %0, %for.cond ]<o:p></o:p></pre>
            <pre>+  %entryN = load i1, i1* %entry1, align 8, !dbg !20<o:p></o:p></pre>
            <pre>+; CHECK: call void @llvm.dbg.value(metadata i1 %[[PHI]],<o:p></o:p></pre>
            <pre>+; CHECK-SAME:                      metadata !DIExpression())<o:p></o:p></pre>
            <pre>+  %0 = add i1 %entryN, 1<o:p></o:p></pre>
            <pre>+; CHECK: %0 = add i1 %[[PHI]], true<o:p></o:p></pre>
            <pre>+; CHECK: call void @llvm.dbg.value(metadata i1 %0,<o:p></o:p></pre>
            <pre>+; CHECK-SAME:                      metadata !DIExpression())<o:p></o:p></pre>
            <pre>+  store i1 %0, i1* %entry1, align 8, !dbg !20<o:p></o:p></pre>
            <pre>+  br label %for.cond, !dbg !20<o:p></o:p></pre>
            <pre>+}<o:p></o:p></pre>
            <pre>+<o:p></o:p></pre>
            <pre>+declare void @llvm.dbg.declare(metadata, metadata, metadata) #1<o:p></o:p></pre>
            <pre>+<o:p></o:p></pre>
            <pre>+attributes #0 = { nounwind ssp uwtable }<o:p></o:p></pre>
            <pre>+attributes #1 = { nounwind readnone }<o:p></o:p></pre>
            <pre>+<o:p></o:p></pre>
            <pre>+!llvm.dbg.cu = !{!0}<o:p></o:p></pre>
            <pre>+!llvm.module.flags = !{!10, !11}<o:p></o:p></pre>
            <pre>+<o:p></o:p></pre>
            <pre>+!0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "adrian", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug)<o:p></o:p></pre>
            <pre>+!1 = !DIFile(filename: "<stdin>", directory: "/")<o:p></o:p></pre>
            <pre>+!2 = !{}<o:p></o:p></pre>
            <pre>+!4 = !DIBasicType(name: "char", size: 8, encoding: DW_ATE_signed_char)<o:p></o:p></pre>
            <pre>+!10 = !{i32 2, !"Debug Info Version", i32 3}<o:p></o:p></pre>
            <pre>+!11 = !{i32 1, !"PIC Level", i32 2}<o:p></o:p></pre>
            <pre>+!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)<o:p></o:p></pre>
            <pre>+!13 = !DISubroutineType(types: !14)<o:p></o:p></pre>
            <pre>+!14 = !{null, !4, !4}<o:p></o:p></pre>
            <pre>+!15 = !{!18}<o:p></o:p></pre>
            <pre>+!18 = !DILocalVariable(name: "entry", scope: !12, file: !1, line: 6, type: !4)<o:p></o:p></pre>
            <pre>+!19 = !DIExpression()<o:p></o:p></pre>
            <pre>+!20 = !DILocation(line: 6, scope: !12)<o:p></o:p></pre>
            <pre><o:p> </o:p></pre>
            <pre><o:p> </o:p></pre>
            <pre>_______________________________________________<o:p></o:p></pre>
            <pre>llvm-commits mailing list<o:p></o:p></pre>
            <pre><a href="mailto:llvm-commits@lists.llvm.org" moz-do-not-send="true">llvm-commits@lists.llvm.org</a><o:p></o:p></pre>
            <pre><a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits" moz-do-not-send="true">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits</a><o:p></o:p></pre>
          </blockquote>
          <p><o:p> </o:p></p>
          <pre>-- <o:p></o:p></pre>
          <pre>Employee of Qualcomm Innovation Center, Inc.<o:p></o:p></pre>
          <pre>Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project<o:p></o:p></pre>
        </div>
      </div>
    </blockquote>
    <p><br>
    </p>
    <pre class="moz-signature" cols="72">-- 
Employee of Qualcomm Innovation Center, Inc.
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project</pre>
  </body>
</html>