<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40"><head><meta http-equiv=Content-Type content="text/html; charset=utf-8"><meta name=Generator content="Microsoft Word 14 (filtered medium)"><style><!--
/* Font Definitions */
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";}
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;}
p.MsoAcetate, li.MsoAcetate, div.MsoAcetate
        {mso-style-priority:99;
        mso-style-link:"Balloon Text Char";
        margin:0in;
        margin-bottom:.0001pt;
        font-size:8.0pt;
        font-family:"Tahoma","sans-serif";}
span.hoenzb
        {mso-style-name:hoenzb;}
span.EmailStyle18
        {mso-style-type:personal-reply;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
span.BalloonTextChar
        {mso-style-name:"Balloon Text Char";
        mso-style-priority:99;
        mso-style-link:"Balloon Text";
        font-family:"Tahoma","sans-serif";}
.MsoChpDefault
        {mso-style-type:export-only;
        font-family:"Calibri","sans-serif";}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
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]--></head><body lang=EN-US link=blue vlink=purple><div class=WordSection1><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>Hi Manman,<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>Thanks for trying out.<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>I agree that I need to reproduce the issue first but since I was not able to reproduce the issue I inspected my code and found that call to performScalarPRE should be guarded by the flags EnablePRE && EnableLoadPRE.<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>I assume when you initialize the pass manager in LTO you turn off EnableLoadPRE flag, I suspect when the flag is off this could be an issue but this is only speculation at this point since I cannot reproduce your issue.<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>Thanks,<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>Balaram<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><b><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>From:</span></b><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'> Manman Ren [mailto:manman.ren@gmail.com] <br><b>Sent:</b> Friday, November 21, 2014 6:39 PM<br><b>To:</b> Balaram Makam; llvm-commits@cs.uiuc.edu<br><b>Subject:</b> Re: [llvm] r222039 - Reapply r221924: "[GVN] Perform Scalar PRE on gep indices that feed loads before<o:p></o:p></span></p><p class=MsoNormal><o:p> </o:p></p><div><p class=MsoNormal><o:p> </o:p></p><div><p class=MsoNormal>I locally applied your patch, its only difference from r222039 is:<o:p></o:p></p></div><div><div><p class=MsoNormal>Index: lib/Transforms/Scalar/GVN.cpp<o:p></o:p></p></div><div><p class=MsoNormal>===================================================================<o:p></o:p></p></div><div><p class=MsoNormal>--- lib/Transforms/Scalar/GVN.cpp     (revision 222239)<o:p></o:p></p></div><div><p class=MsoNormal>+++ lib/Transforms/Scalar/GVN.cpp  (working copy)<o:p></o:p></p></div><div><p class=MsoNormal>@@ -1732,12 +1732,15 @@<o:p></o:p></p></div><div><p class=MsoNormal>   }<o:p></o:p></p></div><div><p class=MsoNormal> <o:p></o:p></p></div><div><p class=MsoNormal>   // If this load follows a GEP, see if we can PRE the indices before analyzing.<o:p></o:p></p></div><div><p class=MsoNormal>-  if (GetElementPtrInst *GEP = dyn_cast<GetElementPtrInst>(LI->getOperand(0))) {<o:p></o:p></p></div><div><p class=MsoNormal>-    for (GetElementPtrInst::op_iterator OI = GEP->idx_begin(),<o:p></o:p></p></div><div><p class=MsoNormal>-                                        OE = GEP->idx_end();<o:p></o:p></p></div><div><p class=MsoNormal>-         OI != OE; ++OI)<o:p></o:p></p></div><div><p class=MsoNormal>-      if (Instruction *I = dyn_cast<Instruction>(OI->get()))<o:p></o:p></p></div><div><p class=MsoNormal>-        performScalarPRE(I);<o:p></o:p></p></div><div><p class=MsoNormal>+  if (EnablePRE && EnableLoadPRE) {<o:p></o:p></p></div><div><p class=MsoNormal>+    if (GetElementPtrInst *GEP =<o:p></o:p></p></div><div><p class=MsoNormal>+        dyn_cast<GetElementPtrInst>(LI->getOperand(0))) {<o:p></o:p></p></div><div><p class=MsoNormal>+      for (GetElementPtrInst::op_iterator OI = GEP->idx_begin(),<o:p></o:p></p></div><div><p class=MsoNormal>+                                          OE = GEP->idx_end();<o:p></o:p></p></div><div><p class=MsoNormal>+           OI != OE; ++OI)<o:p></o:p></p></div><div><p class=MsoNormal>+        if (Instruction *I = dyn_cast<Instruction>(OI->get()))<o:p></o:p></p></div><div><p class=MsoNormal>+          performScalarPRE(I);<o:p></o:p></p></div><div><p class=MsoNormal>+    }<o:p></o:p></p></div><div><p class=MsoNormal>   }<o:p></o:p></p></div><div><p class=MsoNormal> <o:p></o:p></p></div><div><p class=MsoNormal>   // Step 2: Analyze the availability of the load<o:p></o:p></p></div></div><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal>I don't quite get why this can fix the lto selfhost. You probably need to reproduce the issue first.<o:p></o:p></p></div><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal>Manman<o:p></o:p></p></div></div><div><p class=MsoNormal><o:p> </o:p></p><div><p class=MsoNormal>On Fri, Nov 21, 2014 at 3:24 PM, Manman Ren <<a href="mailto:manman.ren@gmail.com" target="_blank">manman.ren@gmail.com</a>> wrote:<o:p></o:p></p><div><p class=MsoNormal>Hi Balaram,<o:p></o:p></p><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal>I didn't do anything special about libcxx. All I did was "configure + make".<o:p></o:p></p></div><div><p class=MsoNormal>Maybe someone else can help you with this error.<o:p></o:p></p></div><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal>I will try to very the patch today, it is going to lock up my computer for 2 hours.<o:p></o:p></p></div><div><p class=MsoNormal>If I can't, I will try it after the Thanksgiving break.<o:p></o:p></p></div><div><p class=MsoNormal><span style='color:#888888'><o:p> </o:p></span></p></div><div><p class=MsoNormal><span class=hoenzb><span style='color:#888888'>Manman</span></span><o:p></o:p></p><div><div><p class=MsoNormal><o:p> </o:p></p><div><p class=MsoNormal><o:p> </o:p></p><div><p class=MsoNormal>On Fri, Nov 21, 2014 at 11:58 AM, Balaram Makam <<a href="mailto:bmakam@codeaurora.org" target="_blank">bmakam@codeaurora.org</a>> wrote:<o:p></o:p></p><p class=MsoNormal style='margin-bottom:12.0pt'>Hi Manman,<br><br>Could you please point me out how to build libcxx and libcxxabi on linux to build lto selfhost?<br><br>I keep getting the following error when trying to build libcxx and libcxxabi:<br><br>CMake Error at cmake/modules/HandleLLVMOptions.cmake:38 (message):<br>  Host Clang must be able to find libstdc++4.7 or newer!<br><br>Thanks,<br>Balaram<br><br>-----Original Message-----<br>From: <a href="mailto:llvm-commits-bounces@cs.uiuc.edu" target="_blank">llvm-commits-bounces@cs.uiuc.edu</a> [mailto:<a href="mailto:llvm-commits-bounces@cs.uiuc.edu" target="_blank">llvm-commits-bounces@cs.uiuc.edu</a>] On Behalf Of Hao Liu<br>Sent: Friday, November 21, 2014 2:25 AM<br>To: Manman Ren<br>Cc: <a href="mailto:llvm-commits@cs.uiuc.edu" target="_blank">llvm-commits@cs.uiuc.edu</a><br>Subject: Re: [llvm] r222039 - Reapply r221924: "[GVN] Perform Scalar PRE on gep indices that feed loads before<o:p></o:p></p><div><div><p class=MsoNormal>Hi Manman,<br><br>Unfortunately, I still have such build failures. It seems not related to the source. Something must be wrong with my process.<br><br>As you can easily reproduce it, maybe you can help Balaram to verify his new patch,<br><br>Thanks,<br>-Hao<br><br>2014-11-21 0:42 GMT+08:00 Manman Ren <<a href="mailto:manman.ren@gmail.com" target="_blank">manman.ren@gmail.com</a>>:<br>> Hi Hao,<br>><br>> Sorry about missing the step of acquiring source. What I did was<br>> trying to replicate what the build bot is doing.<br>><br>> Yes, libcxx is part of the source acquiring. See<br>><br>> <a href="http://lab.llvm.org:8080/green/job/clang-Rlto_master_acquire/514/conso" target="_blank">http://lab.llvm.org:8080/green/job/clang-Rlto_master_acquire/514/conso</a><br>> le<br>><br>> for a list of projects.<br>><br>> If you still have problem reproducing, let me know.<br>><br>> Manman<br>><br>> On Thu, Nov 20, 2014 at 2:49 AM, Hao Liu <<a href="mailto:Hao.Liu@arm.com" target="_blank">Hao.Liu@arm.com</a>> wrote:<br>>><br>>> Hi Manman,<br>>><br>>><br>>><br>>> I tried your steps on the same revision as yours: r222239@trunk. But<br>>> failed to reproduce it. Is it related to libc++ version? If so, what<br>>> revision is used in your test.<br>>><br>>><br>>><br>>> I tired libc++ reversion of r222425 and r222425 and followed your steps.<br>>><br>>> But it had build failures on 1st step:<br>>><br>>> llvm[2]: Linking Release+Asserts executable FileCheck (without<br>>> symbols)<br>>><br>>><br>>> build/utils/FileCheck/Release+Asserts/FileCheck.o:llvm/utils/FileChec<br>>> k/FileCheck.cpp:function llvm::cl::list<std::__1::basic_string<char,<br>>> std::__1::char_traits<char>, std::__1::allocator<char> >, bool,<br>>> llvm::cl::parser<std::__1::basic_string<char,<br>>> std::__1::char_traits<char>, std::__1::allocator<char> > ><br>>> >::~list(): error: undefined reference to 'operator delete(void*)'<br>>><br>>> …<br>>><br>>><br>>><br>>> Also I tried to configure without “--enable-libcpp”,  both steps were<br>>> finished. But can not reproduce the failures on fixxfti.c and fixunsxfti.c.<br>>> So I think libc++ is necessary.<br>>><br>>><br>>><br>>> Thanks,<br>>><br>>> -Hao<br>>><br>>><br>>><br>>> From: <a href="mailto:llvm-commits-bounces@cs.uiuc.edu" target="_blank">llvm-commits-bounces@cs.uiuc.edu</a><br>>> [mailto:<a href="mailto:llvm-commits-bounces@cs.uiuc.edu" target="_blank">llvm-commits-bounces@cs.uiuc.edu</a>] On Behalf Of Manman Ren<br>>> Sent: Thursday, November 20, 2014 8:29 AM<br>>> To: Balaram Makam<br>>> Cc: <a href="mailto:llvm-commits@cs.uiuc.edu" target="_blank">llvm-commits@cs.uiuc.edu</a><br>>><br>>><br>>> Subject: Re: [llvm] r222039 - Reapply r221924: "[GVN] Perform Scalar<br>>> PRE on gep indices that feed loads before<br>>><br>>><br>>><br>>><br>>><br>>> On Nov 19, 2014, at 3:46 PM, Balaram Makam <<a href="mailto:bmakam@codeaurora.org" target="_blank">bmakam@codeaurora.org</a>> wrote:<br>>><br>>><br>>><br>>> Hi Manman,<br>>><br>>> I have a patch with a potential fix to the problem, but I cannot<br>>> reproduce the original failure with the preprocessed source files you provided.<br>>><br>>><br>>><br>>> Hi Balaram,<br>>><br>>><br>>><br>>> You need to build a lto selfhost to reproduce.<br>>><br>>><br>>><br>>> 1> make a release+assert build with your patch (install the compiler<o:p></o:p></p></div></div><p class=MsoNormal>>> 1> to a<o:p></o:p></p><div><div><p class=MsoNormal>>> directory clang-install for example).<br>>><br>>><br>>><br>>> create directory clang-build and clang-install under llvm<br>>><br>>> under clang-build, do:<br>>>   ./llvm/configure --enable-assertions --enable-optimized<br>>> --disable-bindings --enable-targets=x86,x86_64 --enable-libcpp<br>>> --prefix=Users/manmanren/llvm/clang-install<br>>><br>>>   make -j 12 VERBOSE=1<br>>> CLANG_REPOSITORY_STRING=clang-stage1-configure-RA_build SVN_REVISION=222059<br>>>   make install-clang -j 4<br>>><br>>><br>>><br>>> 2> use clang-install binary and library to build the same repo with lto.<br>>><br>>><br>>> create directory selfhost, under selfhost, do:<br>>><br>>> ../llvm/configure --disable-assertions --with-extra-options="-flto<br>>> -gline-tables-only” --enable-optimized --disable-bindings<br>>> --enable-targets=x86,x86_64 --enable-libcpp<br>>> CC=/Users/manmanren/llvm/clang-install/bin/clang<br>>> CXX=/Users/manmanren/gmail/clang-install/llvm/clang++<br>>><br>>><br>>><br>>>    make -j 4 VERBOSE=1<br>>> CLANG_REPOSITORY_STRING=clang-Rlto_master_build<br>>> SVN_REVISION=222059<br>>> DYLD_LIBRARY_PATH=/Users/manmanren/llvm_gmail/clang-install/lib/<br>>><br>>><br>>><br>>> The whole process takes a few hours to run.You can also commit the<br>>> patch if you are confident enough and then watch the bot (phase 2 lto).<br>>><br>>><br>>><br>>> Manman<br>>><br>>><br>>><br>>> Could you please test this patch (attached) and let me know if it works?<br>>><br>>> Thanks,<br>>> Balaram<br>>><br>>><br>>> -----Original Message-----<br>>> From: Chad Rosier [mailto:<a href="mailto:mcrosier@codeaurora.org" target="_blank">mcrosier@codeaurora.org</a>]<br>>> Sent: Tuesday, November 18, 2014 9:09 PM<br>>> To: Manman Ren<br>>> Cc: <a href="mailto:mcrosier@codeaurora.org" target="_blank">mcrosier@codeaurora.org</a>; <a href="mailto:llvm-commits@cs.uiuc.edu" target="_blank">llvm-commits@cs.uiuc.edu</a>; Balaram Makam;<br>>> James Molloy<br>>> Subject: Re: [llvm] r222039 - Reapply r221924: "[GVN] Perform Scalar<br>>> PRE on gep indices that feed loads before<br>>><br>>> Thanks, Manman.  Balaram or another one of our team members will<br>>> investigate.<br>>><br>>> Chad<br>>><br>>><br>>><br>>><br>>> Hi Chad,<br>>><br>>> I reverted the commit in r222287.<br>>><br>>> The lto self host of r222239 without this commit succeeded.<br>>> And I have finished the lto self host of r222239 including this<br>>> commit, it failed. If you need any more files, let me know.<br>>><br>>> Thanks,<br>>> Manman<br>>><br>>> clang(59539,0x7fff7c035300) malloc: *** error for object 0x7fa438648450:<br>>> pointer being freed was not allocated<br>>> *** set a breakpoint in malloc_error_break to debug<br>>>  COMPILE:   clang_darwin/cc_kext/x86_64:<br>>> /Users/manmanren/gmail/llvm/projects/compiler-rt/lib/builtins/fixxfti.c<br>>>  COMPILE:   clang_darwin/cc_kext/x86_64:<br>>> /Users/manmanren/gmail/llvm/projects/compiler-rt/lib/builtins/x86_64/<o:p></o:p></p></div></div><p class=MsoNormal>>> f loatdidf.c /Users/manmanren/gmail/selfhost/Release/bin/clang -fPIC<br>>> -I/Users/manmanren/gmail/llvm/projects/compiler-rt/lib<br>>> -I/Users/manmanren/gmail/llvm/projects/compiler-rt/include -arch<br>>> x86_64 -fvisibility=hidden -DVISIBILITY_HIDDEN -mkernel -DKERNEL_USE<br>>> -Wall -Werror -O3 -fomit-frame-pointer -mmacosx-version-min=10.4<br>>> -isysroot<br>>> /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/<br>>> D<br>>> eveloper/SDKs/MacOSX10.10.sdk<br>>> -c -o<br>>> /Users/manmanren/gmail/selfhost/tools/clang/runtime/compiler-rt/clang<br>>> _ darwin/cc_kext/x86_64/SubDir.lib__builtins/fixxfti.o<br>>> /Users/manmanren/gmail/llvm/projects/compiler-rt/lib/builtins/fixxfti.c<br>>>  COMPILE:   clang_darwin/cc_kext/x86_64:<br>>> /Users/manmanren/gmail/llvm/projects/compiler-rt/lib/builtins/x86_64/<br>>> f loatdisf.c /Users/manmanren/gmail/selfhost/Release/bin/clang -fPIC<br>>> -I/Users/manmanren/gmail/llvm/projects/compiler-rt/lib<br>>> -I/Users/manmanren/gmail/llvm/projects/compiler-rt/include -arch<br>>> x86_64 -fvisibility=hidden -DVISIBILITY_HIDDEN -mkernel -DKERNEL_USE<br>>> -Wall -Werror -O3 -fomit-frame-pointer -mmacosx-version-min=10.4<br>>> -isysroot<br>>> /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/<br>>> D<br>>> eveloper/SDKs/MacOSX10.10.sdk<br>>> -c -o<br>>> /Users/manmanren/gmail/selfhost/tools/clang/runtime/compiler-rt/clang<br>>> _ darwin/cc_kext/x86_64/SubDir.lib__builtins__x86_64/floatdisf.o<br>>> /Users/manmanren/gmail/llvm/projects/compiler-rt/lib/builtins/x86_64/<br>>> f loatdisf.c /Users/manmanren/gmail/selfhost/Release/bin/clang -fPIC<br>>> -I/Users/manmanren/gmail/llvm/projects/compiler-rt/lib<br>>> -I/Users/manmanren/gmail/llvm/projects/compiler-rt/include -arch<br>>> x86_64 -fvisibility=hidden -DVISIBILITY_HIDDEN -mkernel -DKERNEL_USE<br>>> -Wall -Werror -O3 -fomit-frame-pointer -mmacosx-version-min=10.4<br>>> -isysroot<br>>> /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/<br>>> D<br>>> eveloper/SDKs/MacOSX10.10.sdk<br>>> -c -o<br>>> /Users/manmanren/gmail/selfhost/tools/clang/runtime/compiler-rt/clang<br>>> _ darwin/cc_kext/x86_64/SubDir.lib__builtins__x86_64/floatdidf.o<br>>> /Users/manmanren/gmail/llvm/projects/compiler-rt/lib/builtins/x86_64/<o:p></o:p></p><div><div><p class=MsoNormal>>> f<br>>> loatdidf.c<br>>> clang(59547,0x7fff7c035300) malloc: *** error for object 0x7f9410f1c0d0:<br>>> pointer being freed was not allocated<br>>> *** set a breakpoint in malloc_error_break to debug<br>>> 0  clang                    0x000000010c15d259<br>>> llvm::sys::PrintStackTrace(__sFILE*) + 57<br>>> 1  clang                    0x000000010c15ddab SignalHandler(int) + 347<br>>> 2  libsystem_platform.dylib 0x00007fff980faf1a _sigtramp + 26<br>>> 3  libsystem_platform.dylib 0xffffffffffffffff _sigtramp + 1743802623<br>>> 4  libsystem_c.dylib        0x00007fff982ccb73 abort + 129<br>>> 5  libsystem_malloc.dylib   0x00007fff98e7b937 nano_size + 0<br>>> 6  clang                    0x000000010b7b77b9 (anonymous<br>>> namespace)::X86TTI::getIntImmCost(llvm::APInt const&, llvm::Type*)<br>>> const +<br>>> 601<br>>> 7  clang                    0x000000010b7b6cd8 non-virtual thunk to<br>>> (anonymous namespace)::X86TTI::getIntImmCost(unsigned int, unsigned<br>>> int, llvm::APInt const&, llvm::Type*) const + 216<br>>> 8  clang                    0x000000010bb73333 (anonymous<br>>> namespace)::ConstantHoisting::collectConstantCandidates(llvm::DenseMa<br>>> p<br>>> <llvm::ConstantInt*, unsigned int,<br>>> llvm::DenseMapInfo<llvm::ConstantInt*> >&, llvm::Instruction*,<br>>> unsigned int, llvm::ConstantInt*) + 211<br>>>  COMPILE:   clang_darwin/cc_kext/x86_64:<br>>><br>>> /Users/manmanren/gmail/llvm/projects/compiler-rt/lib/builtins/x86_64/floatdixf.c<br>>> 9  clang                    0x000000010bb6ecf4 (anonymous<br>>> namespace)::ConstantHoisting::runOnFunction(llvm::Function&) + 516<br>>>  COMPILE:   clang_darwin/cc_kext/x86_64:<br>>> /Users/manmanren/gmail/llvm/projects/compiler-rt/lib/builtins/floatti<o:p></o:p></p></div></div><p class=MsoNormal>>> d f.c /Users/manmanren/gmail/selfhost/Release/bin/clang -fPIC<br>>> -I/Users/manmanren/gmail/llvm/projects/compiler-rt/lib<br>>> -I/Users/manmanren/gmail/llvm/projects/compiler-rt/include -arch<br>>> x86_64 -fvisibility=hidden -DVISIBILITY_HIDDEN -mkernel -DKERNEL_USE<br>>> -Wall -Werror -O3 -fomit-frame-pointer -mmacosx-version-min=10.4<br>>> -isysroot<br>>> /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/<br>>> D<br>>> eveloper/SDKs/MacOSX10.10.sdk<br>>> -c -o<br>>> /Users/manmanren/gmail/selfhost/tools/clang/runtime/compiler-rt/clang<br>>> _ darwin/cc_kext/x86_64/SubDir.lib__builtins__x86_64/floatdixf.o<o:p></o:p></p><div><div><p class=MsoNormal>>><br>>> /Users/manmanren/gmail/llvm/projects/compiler-rt/lib/builtins/x86_64/floatdixf.c<br>>> 10 clang                    0x000000010c0e3a25<br>>> llvm::FPPassManager::runOnFunction(llvm::Function&) + 549<br>>> 11 clang                    0x000000010c0e3c9b<br>>> llvm::FPPassManager::runOnModule(llvm::Module&) + 43<br>>> 12 clang                    0x000000010c0e412a<br>>> llvm::legacy::PassManagerImpl::run(llvm::Module&) + 922<br>>> 13 clang                    0x000000010a445430<br>>> clang::EmitBackendOutput(clang::DiagnosticsEngine&,<br>>> clang::CodeGenOptions const&, clang::TargetOptions const&,<br>>> clang::LangOptions const&, llvm::StringRef, llvm::Module*,<br>>> clang::BackendAction, llvm::raw_ostream*)<br>>> + 12208<br>>> 0  clang                    0x00000001059d5259<br>>> llvm::sys::PrintStackTrace(__sFILE*) + 57<br>>> 14 clang                    0x000000010a5cda44<br>>> clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&) +<br>>> 516 /Users/manmanren/gmail/selfhost/Release/bin/clang -fPIC<br>>> -I/Users/manmanren/gmail/llvm/projects/compiler-rt/lib<br>>> -I/Users/manmanren/gmail/llvm/projects/compiler-rt/include -arch<br>>> x86_64 -fvisibility=hidden -DVISIBILITY_HIDDEN -mkernel -DKERNEL_USE<br>>> -Wall -Werror -O3 -fomit-frame-pointer -mmacosx-version-min=10.4<br>>> -isysroot<br>>> /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/<br>>> D<br>>> eveloper/SDKs/MacOSX10.10.sdk<br>>> -c -o<br>>> /Users/manmanren/gmail/selfhost/tools/clang/runtime/compiler-rt/clang<o:p></o:p></p></div></div><p class=MsoNormal>>> _ darwin/cc_kext/x86_64/SubDir.lib__builtins/floattidf.o<o:p></o:p></p><div><div><p class=MsoNormal>>> /Users/manmanren/gmail/llvm/projects/compiler-rt/lib/builtins/floattidf.c<br>>> 1  clang                    0x00000001059d5dab SignalHandler(int) + 347<br>>> 2  libsystem_platform.dylib 0x00007fff980faf1a _sigtramp + 26<br>>> 3  libsystem_platform.dylib 0xffffffffffffffff _sigtramp + 1743802623<br>>> 15 clang                    0x000000010a6864c5 4  libsystem_c.dylib<br>>> 0x00007fff982ccb73 clang::ParseAST(clang::Sema&, bool, bool)abort +<br>>> 661 +<br>>> 129<br>>><br>>> 5  libsystem_malloc.dylib   0x00007fff98e7b937 nano_size + 0<br>>> 16 clang                    0x000000010a1f2b7e<br>>> clang::FrontendAction::Execute() + 62<br>>> 6  clang                    0x000000010502f7b9 (anonymous<br>>> namespace)::X86TTI::getIntImmCost(llvm::APInt const&, llvm::Type*)<br>>> const +<br>>> 601<br>>> 17 clang                    0x000000010a1ba8d3<br>>> clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) + 915<br>>> 7  clang                    0x000000010502ecd8 non-virtual thunk to<br>>> (anonymous namespace)::X86TTI::getIntImmCost(unsigned int, unsigned<br>>> int, llvm::APInt const&, llvm::Type*) const + 216<br>>> 18 clang                    0x000000010a16a3fa<br>>> clang::ExecuteCompilerInvocation(clang::CompilerInstance*) + 2890<br>>> 8  clang                    0x00000001053eb333 (anonymous<br>>> namespace)::ConstantHoisting::collectConstantCandidates(llvm::DenseMa<br>>> p<br>>> <llvm::ConstantInt*, unsigned int,<br>>> llvm::DenseMapInfo<llvm::ConstantInt*> >&, llvm::Instruction*,<br>>> unsigned int, llvm::ConstantInt*) + 211<br>>> 19 clang                    0x000000010a16000c<br>>> cc1_main(llvm::ArrayRef<char const*>, char const*, void*) + 1836<br>>> 9  clang                    0x00000001053e6cf4 (anonymous<br>>> namespace)::ConstantHoisting::runOnFunction(llvm::Function&) + 516<br>>> 20 clang                    0x000000010a168b21 main + 13745<br>>> 21 libdyld.dylib            0x00007fff8b4215c9 start + 1<br>>> 22 libdyld.dylib            0x0000000000000045 start + 1958603389<br>>> 10 clang                    0x000000010595ba25<br>>> llvm::FPPassManager::runOnFunction(llvm::Function&) + 549 Stack dump:<br>>> 0.          Program arguments:<br>>> /Users/manmanren/gmail/selfhost/Release/bin/clang<br>>> -cc1 -triple x86_64-apple-macosx10.4.0 -emit-obj -disable-free<br>>> -disable-llvm-verifier -main-file-name fixunsxfti.c -static-define<br>>> -mrelocation-model static -mthread-model posix -masm-verbose<br>>> -fforbid-guard-variables -target-cpu core2 -disable-red-zone<br>>> -no-implicit-float -target-linker-version 242 -dwarf-column-info<br>>> -coverage-file<br>>> /Users/manmanren/gmail/selfhost/tools/clang/runtime/compiler-rt/clang<br>>> _ darwin/cc_kext/x86_64/SubDir.lib__builtins/fixunsxfti.o<br>>> -resource-dir<br>>> /Users/manmanren/gmail/selfhost/Release/bin/../lib/clang/3.6.0<br>>> -isysroot<br>>> /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/<br>>> D<br>>> eveloper/SDKs/MacOSX10.10.sdk<br>>> -D VISIBILITY_HIDDEN -D KERNEL_USE -I<br>>> /Users/manmanren/gmail/llvm/projects/compiler-rt/lib -I<br>>> /Users/manmanren/gmail/llvm/projects/compiler-rt/include -O3 -Wall<br>>> -Werror -fdebug-compilation-dir<br>>> /Users/manmanren/gmail/llvm/projects/compiler-rt<br>>> -ferror-limit 19 -fmessage-length 164 -fvisibility hidden<br>>> -ffreestanding -mstackrealign -fno-builtin -fblocks<br>>> -fblocks-runtime-optional -fno-rtti -fno-use-cxa-atexit<br>>> -fobjc-runtime=macosx-10.4.0 -fobjc-dispatch-method=non-legacy<br>>> -fencode-extended-block-signature<br>>> -fmax-type-align=16 -fno-common -fdiagnostics-show-option<br>>> -fcolor-diagnostics -vectorize-loops -vectorize-slp -o<br>>> /Users/manmanren/gmail/selfhost/tools/clang/runtime/compiler-rt/clang<o:p></o:p></p></div></div><p class=MsoNormal>>> _ darwin/cc_kext/x86_64/SubDir.lib__builtins/fixunsxfti.o<o:p></o:p></p><div><div><p class=MsoNormal>>> -x c<br>>> /Users/manmanren/gmail/llvm/projects/compiler-rt/lib/builtins/fixunsxfti.c<br>>> 1.          <eof> parser at end of file<br>>> 2.          Code generation<br>>> 3.          Running pass 'Function Pass Manager' on module<br>>><br>>> '/Users/manmanren/gmail/llvm/projects/compiler-rt/lib/builtins/fixunsxfti.c'.<br>>> 4.          Running pass 'Constant Hoisting' on function '@__fixunsxfti'<br>>> 11 clang                    0x000000010595bc9b<br>>> llvm::FPPassManager::runOnModule(llvm::Module&) + 43<br>>> 12 clang                    0x000000010595c12a<br>>> llvm::legacy::PassManagerImpl::run(llvm::Module&) + 922<br>>> 13 clang                    0x0000000103cbd430<br>>> clang::EmitBackendOutput(clang::DiagnosticsEngine&,<br>>> clang::CodeGenOptions const&, clang::TargetOptions const&,<br>>> clang::LangOptions const&, llvm::StringRef, llvm::Module*,<br>>> clang::BackendAction, llvm::raw_ostream*)<br>>> + 12208<br>>> 14 clang                    0x0000000103e45a44<br>>> clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&) + 516<br>>> 15 clang                    0x0000000103efe4c5<br>>> clang::ParseAST(clang::Sema&, bool, bool) + 661<br>>> 16 clang                    0x0000000103a6ab7e<br>>> clang::FrontendAction::Execute() + 62<br>>> 17 clang                    0x0000000103a328d3<br>>> clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) + 915<br>>> 18 clang                    0x00000001039e23fa<br>>> clang::ExecuteCompilerInvocation(clang::CompilerInstance*) + 2890<br>>> 19 clang                    0x00000001039d800c<br>>> cc1_main(llvm::ArrayRef<char const*>, char const*, void*) + 1836<br>>> 20 clang                    0x00000001039e0b21 main + 13745<br>>> 21 libdyld.dylib            0x00007fff8b4215c9 start + 1<br>>> 22 libdyld.dylib            0x0000000000000045 start + 1958603389<br>>> Stack dump:<br>>> 0.          Program arguments:<br>>> /Users/manmanren/gmail/selfhost/Release/bin/clang<br>>> -cc1 -triple x86_64-apple-macosx10.4.0 -emit-obj -disable-free<br>>> -disable-llvm-verifier -main-file-name fixxfti.c -static-define<br>>> -mrelocation-model static -mthread-model posix -masm-verbose<br>>> -fforbid-guard-variables -target-cpu core2 -disable-red-zone<br>>> -no-implicit-float -target-linker-version 242 -dwarf-column-info<br>>> -coverage-file<br>>> /Users/manmanren/gmail/selfhost/tools/clang/runtime/compiler-rt/clang<br>>> _ darwin/cc_kext/x86_64/SubDir.lib__builtins/fixxfti.o<br>>> -resource-dir<br>>> /Users/manmanren/gmail/selfhost/Release/bin/../lib/clang/3.6.0<br>>> -isysroot<br>>> /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/<br>>> D<br>>> eveloper/SDKs/MacOSX10.10.sdk<br>>> -D VISIBILITY_HIDDEN -D KERNEL_USE -I<br>>> /Users/manmanren/gmail/llvm/projects/compiler-rt/lib -I<br>>> /Users/manmanren/gmail/llvm/projects/compiler-rt/include -O3 -Wall<br>>> -Werror -fdebug-compilation-dir<br>>> /Users/manmanren/gmail/llvm/projects/compiler-rt<br>>> -ferror-limit 19 -fmessage-length 164 -fvisibility hidden<br>>> -ffreestanding -mstackrealign -fno-builtin -fblocks<br>>> -fblocks-runtime-optional -fno-rtti -fno-use-cxa-atexit<br>>> -fobjc-runtime=macosx-10.4.0 -fobjc-dispatch-method=non-legacy<br>>> -fencode-extended-block-signature<br>>> -fmax-type-align=16 -fno-common -fdiagnostics-show-option<br>>> -fcolor-diagnostics -vectorize-loops -vectorize-slp -o<br>>> /Users/manmanren/gmail/selfhost/tools/clang/runtime/compiler-rt/clang<o:p></o:p></p></div></div><p class=MsoNormal>>> _ darwin/cc_kext/x86_64/SubDir.lib__builtins/fixxfti.o<br>>> -x c<br>>> /Users/manmanren/gmail/llvm/projects/compiler-rt/lib/builtins/fixxfti.c<br>>> 1.          <eof> parser at end of file<br>>> 2.          Code generation<br>>> 3.          Running pass 'Function Pass Manager' on module<br>>> '/Users/manmanren/gmail/llvm/projects/compiler-rt/lib/builtins/fixxfti.c'.<br>>> 4.          Running pass 'Constant Hoisting' on function '@__fixxfti'<br>>>  COMPILE:   clang_darwin/cc_kext/x86_64:<br>>> /Users/manmanren/gmail/llvm/projects/compiler-rt/lib/builtins/floatti<br>>> s f.c /Users/manmanren/gmail/selfhost/Release/bin/clang -fPIC<br>>> -I/Users/manmanren/gmail/llvm/projects/compiler-rt/lib<br>>> -I/Users/manmanren/gmail/llvm/projects/compiler-rt/include -arch<br>>> x86_64 -fvisibility=hidden -DVISIBILITY_HIDDEN -mkernel -DKERNEL_USE<br>>> -Wall -Werror -O3 -fomit-frame-pointer -mmacosx-version-min=10.4<br>>> -isysroot<br>>> /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/<br>>> D<br>>> eveloper/SDKs/MacOSX10.10.sdk<br>>> -c -o<br>>> /Users/manmanren/gmail/selfhost/tools/clang/runtime/compiler-rt/clang<br>>> _ darwin/cc_kext/x86_64/SubDir.lib__builtins/floattisf.o<br>>> /Users/manmanren/gmail/llvm/projects/compiler-rt/lib/builtins/floatti<br>>> s<br>>> f.c<br>>><br>>>  COMPILE:   clang_darwin/cc_kext/x86_64:<br>>> /Users/manmanren/gmail/llvm/projects/compiler-rt/lib/builtins/powidf2.<br>>> c /Users/manmanren/gmail/selfhost/Release/bin/clang -fPIC<br>>> -I/Users/manmanren/gmail/llvm/projects/compiler-rt/lib<br>>> -I/Users/manmanren/gmail/llvm/projects/compiler-rt/include -arch<br>>> x86_64 -fvisibility=hidden -DVISIBILITY_HIDDEN -mkernel -DKERNEL_USE<br>>> -Wall -Werror -O3 -fomit-frame-pointer -mmacosx-version-min=10.4<br>>> -isysroot<br>>> /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/<br>>> D<br>>> eveloper/SDKs/MacOSX10.10.sdk<br>>> -c -o<br>>> /Users/manmanren/gmail/selfhost/tools/clang/runtime/compiler-rt/clang<br>>> _ darwin/cc_kext/x86_64/SubDir.lib__builtins/popcountti2.o<br>>> /Users/manmanren/gmail/llvm/projects/compiler-rt/lib/builtins/popcoun<br>>> t ti2.c /Users/manmanren/gmail/selfhost/Release/bin/clang -fPIC<br>>> -I/Users/manmanren/gmail/llvm/projects/compiler-rt/lib<br>>> -I/Users/manmanren/gmail/llvm/projects/compiler-rt/include -arch<br>>> x86_64 -fvisibility=hidden -DVISIBILITY_HIDDEN -mkernel -DKERNEL_USE<br>>> -Wall -Werror -O3 -fomit-frame-pointer -mmacosx-version-min=10.4<br>>> -isysroot<br>>> /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/<br>>> D<br>>> eveloper/SDKs/MacOSX10.10.sdk<br>>> -c -o<br>>> /Users/manmanren/gmail/selfhost/tools/clang/runtime/compiler-rt/clang<br>>> _ darwin/cc_kext/x86_64/SubDir.lib__builtins/powidf2.o<o:p></o:p></p><div><div><p class=MsoNormal>>> /Users/manmanren/gmail/llvm/projects/compiler-rt/lib/builtins/powidf2.<br>>> c<br>>> clang: error: unable to execute command: Abort trap: 6<br>>> clang: error: clang frontend command failed due to signal (use -v to<br>>> see<br>>> invocation)<br>>> clang version 3.6.0 (clang-Rlto_master_build 222059) (llvm/trunk<br>>> 222239)<br>>> Target: x86_64-apple-darwin14.0.0<br>>> Thread model: posix<br>>> clang: note: diagnostic msg: PLEASE submit a bug report to<br>>> <a href="http://llvm.org/bugs/" target="_blank">http://llvm.org/bugs/</a> and include the crash backtrace, preprocessed<br>>> source, and associated run script.<br>>>  COMPILE:   clang_darwin/cc_kext/x86_64:<br>>> /Users/manmanren/gmail/llvm/projects/compiler-rt/lib/builtins/powisf2.<br>>> c /Users/manmanren/gmail/selfhost/Release/bin/clang -fPIC<br>>> -I/Users/manmanren/gmail/llvm/projects/compiler-rt/lib<br>>> -I/Users/manmanren/gmail/llvm/projects/compiler-rt/include -arch<br>>> x86_64 -fvisibility=hidden -DVISIBILITY_HIDDEN -mkernel -DKERNEL_USE<br>>> -Wall -Werror -O3 -fomit-frame-pointer -mmacosx-version-min=10.4<br>>> -isysroot<br>>> /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/<br>>> D<br>>> eveloper/SDKs/MacOSX10.10.sdk<br>>> -c -o<br>>> /Users/manmanren/gmail/selfhost/tools/clang/runtime/compiler-rt/clang<o:p></o:p></p></div></div><p class=MsoNormal>>> _ darwin/cc_kext/x86_64/SubDir.lib__builtins/powisf2.o<br>>> /Users/manmanren/gmail/llvm/projects/compiler-rt/lib/builtins/powisf2.<br>>> c<br>>> clang: note: diagnostic msg:<br>>> ********************<br>>><br>>> PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:<br>>> Preprocessed source(s) and associated run script(s) are located at:<br>>> clang: note: diagnostic msg:<br>>> /var/folders/8d/mksp0c9x6yngd578zj_s72ym0000gn/T/fixxfti-868934.c<br>>> clang: note: diagnostic msg:<br>>> /var/folders/8d/mksp0c9x6yngd578zj_s72ym0000gn/T/fixxfti-868934.sh<br>>> clang: note: diagnostic msg:<br>>><br>>> ********************<br>>>  COMPILE:   clang_darwin/cc_kext/x86_64:<br>>> /Users/manmanren/gmail/llvm/projects/compiler-rt/lib/builtins/powixf2.<br>>> c<br>>> make[5]: ***<br>>> [/Users/manmanren/gmail/selfhost/tools/clang/runtime/compiler-rt/clan<br>>> g _darwin/cc_kext/x86_64/SubDir.lib__builtins/fixxfti.o]<br>>> Error 254<br>>> make[5]: *** Waiting for unfinished jobs....<br>>> /Users/manmanren/gmail/selfhost/Release/bin/clang -fPIC<br>>> -I/Users/manmanren/gmail/llvm/projects/compiler-rt/lib<br>>> -I/Users/manmanren/gmail/llvm/projects/compiler-rt/include -arch<br>>> x86_64 -fvisibility=hidden -DVISIBILITY_HIDDEN -mkernel -DKERNEL_USE<br>>> -Wall -Werror -O3 -fomit-frame-pointer -mmacosx-version-min=10.4<br>>> -isysroot<br>>> /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/<br>>> D<br>>> eveloper/SDKs/MacOSX10.10.sdk<br>>> -c -o<br>>> /Users/manmanren/gmail/selfhost/tools/clang/runtime/compiler-rt/clang<br>>> _ darwin/cc_kext/x86_64/SubDir.lib__builtins/powixf2.o<o:p></o:p></p><div><div><p class=MsoNormal>>> /Users/manmanren/gmail/llvm/projects/compiler-rt/lib/builtins/powixf2.<br>>> c<br>>> clang: error: unable to execute command: Abort trap: 6<br>>> clang: error: clang frontend command failed due to signal (use -v to<br>>> see<br>>> invocation)<br>>> clang version 3.6.0 (clang-Rlto_master_build 222059) (llvm/trunk<br>>> 222239)<br>>> Target: x86_64-apple-darwin14.0.0<br>>> Thread model: posix<br>>> clang: note: diagnostic msg: PLEASE submit a bug report to<br>>> <a href="http://llvm.org/bugs/" target="_blank">http://llvm.org/bugs/</a> and include the crash backtrace, preprocessed<br>>> source, and associated run script.<br>>> clang: note: diagnostic msg:<br>>> ********************<br>>><br>>> PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:<br>>> Preprocessed source(s) and associated run script(s) are located at:<br>>> clang: note: diagnostic msg:<br>>> /var/folders/8d/mksp0c9x6yngd578zj_s72ym0000gn/T/fixunsxfti-33f776.c<br>>> clang: note: diagnostic msg:<br>>> /var/folders/8d/mksp0c9x6yngd578zj_s72ym0000gn/T/fixunsxfti-33f776.sh<br>>> clang: note: diagnostic msg:<br>>><br>>> ********************<br>>><br>>><br>>><br>>> On Nov 18, 2014, at 2:53 PM, Chad Rosier <<a href="mailto:mcrosier@codeaurora.org" target="_blank">mcrosier@codeaurora.org</a>><br>>> wrote:<br>>><br>>> Hi Manman,<br>>> Feel free to revert the patch if you're convinced this is the problem.<br>>> Please keep Balaram, James, and I updated on the progress.  This is a<br>>> performance critical fix, so we need to make sure it doesn't get lost<br>>> in the mix.<br>>><br>>> Chad<br>>><br>>><br>>> Hi Chad,<br>>><br>>> About the buildbot phase 2 failure, I now think this commit is the<br>>> root cause.<br>>><br>>> What I did was:<o:p></o:p></p></div></div><p class=MsoNormal>>> 1> update the repo to r222239, then "svn merge -c -r222039 .†, made<br>>> 1> a<o:p></o:p></p><div><div><p class=MsoNormal>>> release+assert build (installed to clang-install).<br>>> 2> use clang-install binary and library to build the same repo with<br>>> lto.<br>>>    make -j 4 VERBOSE=1<br>>> CLANG_REPOSITORY_STRING=clang-Rlto_master_build<br>>> SVN_REVISION=222059<br>>> DYLD_LIBRARY_PATH=/Users/manmanren/llvm_gmail/clang-install/lib/<br>>> 3> the build completed<br>>> make[1]: Nothing to be done for `all'.<br>>> make[1]: Nothing to be done for `all'.<br>>> llvm[0]: ***** Completed Release Build<br>>><br>>> Is it okay for us to revert this commit and watch the bot? If the bot<br>>> is still red, we can re-submit it.<br>>><br>>> If you want me to do more testing (maybe a lto self host with<br>>> r22239), let me know,<br>>><br>>> Thanks,<br>>> Manman (The build czar)<br>>><br>>><br>>> On Nov 14, 2014, at 1:09 PM, Chad Rosier <<a href="mailto:mcrosier@codeaurora.org" target="_blank">mcrosier@codeaurora.org</a>><br>>> wrote:<br>>><br>>> Author: mcrosier<br>>> Date: Fri Nov 14 15:09:13 2014<br>>> New Revision: 222039<br>>><br>>> URL: <a href="http://llvm.org/viewvc/llvm-project?rev=222039&view=rev" target="_blank">http://llvm.org/viewvc/llvm-project?rev=222039&view=rev</a><br>>> Log:<br>>> Reapply r221924: "[GVN] Perform Scalar PRE on gep indices that feed<br>>> loads before doing Load PRE"<br>>><br>>> This commit updates the failing test in<br>>> Analysis/TypeBasedAliasAnalysis/gvn-nonlocal-type-mismatch.ll<br>>><br>>> The failing test is sensitive to the order in which we process loads.<br>>> This<br>>> version turns on the RPO traversal instead of the while DT traversal<br>>> in GVN.<br>>> The new test code is functionally same just the order of loads that<br>>> are eliminated is swapped.<br>>><br>>> This new version also fixes an issue where GVN splits a critical edge<br>>> and potentially invalidate the RPO/DT iterator.<br>>><br>>> Added:<br>>>  llvm/trunk/test/Transforms/GVN/pre-gep-load.ll<br>>> Modified:<br>>>  llvm/trunk/lib/Transforms/Scalar/GVN.cpp<br>>><br>>> llvm/trunk/test/Analysis/TypeBasedAliasAnalysis/gvn-nonlocal-type-m<br>>> ismatch.ll<br>>><br>>> Modified: llvm/trunk/lib/Transforms/Scalar/GVN.cpp<br>>> URL:<br>>> <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scala" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scala</a><br>>> r/GVN.cpp?rev=222039&r1=222038&r2=222039&view=diff<br>>> ===================================================================<br>>> ===========<br>>> --- llvm/trunk/lib/Transforms/Scalar/GVN.cpp (original)<br>>> +++ llvm/trunk/lib/Transforms/Scalar/GVN.cpp Fri Nov 14 15:09:13<br>>> +++ 2014<br>>> @@ -20,6 +20,7 @@<br>>> #include "llvm/ADT/DepthFirstIterator.h"<br>>> #include "llvm/ADT/Hashing.h"<br>>> #include "llvm/ADT/MapVector.h"<br>>> +#include "llvm/ADT/PostOrderIterator.h"<br>>> #include "llvm/ADT/SetVector.h"<br>>> #include "llvm/ADT/SmallPtrSet.h"<br>>> #include "llvm/ADT/Statistic.h"<br>>> @@ -709,6 +710,7 @@ namespace {<br>>>   void dump(DenseMap<uint32_t, Value*> &d);<br>>>   bool iterateOnFunction(Function &F);<br>>>   bool performPRE(Function &F);<br>>> +    bool performScalarPRE(Instruction *I);<br>>>   Value *findLeader(const BasicBlock *BB, uint32_t num);<br>>>   void cleanupGlobalSets();<br>>>   void verifyRemoved(const Instruction *I) const; @@ -1729,6<br>>> +1731,15 @@ bool GVN::processNonLocalLoad(LoadInst *<br>>>   return false;<br>>> }<br>>><br>>> +  // If this load follows a GEP, see if we can PRE the indices<br>>> + before<br>>> analyzing.<br>>> +  if (GetElementPtrInst *GEP =<br>>> dyn_cast<GetElementPtrInst>(LI->getOperand(0))) {<br>>> +    for (GetElementPtrInst::op_iterator OI = GEP->idx_begin(),<br>>> +                                        OE = GEP->idx_end();<br>>> +         OI != OE; ++OI)<br>>> +      if (Instruction *I = dyn_cast<Instruction>(OI->get()))<br>>> +        performScalarPRE(I);<br>>> +  }<br>>> +<br>>> // Step 2: Analyze the availability of the load  AvailValInBlkVect<br>>> ValuesPerBlock;  UnavailBlkVect UnavailableBlocks; @@ -2431,175<br>>> +2442,182 @@ bool GVN::processBlock(BasicBlock *BB) {  return<br>>> ChangedFunction; }<br>>><br>>> -/// performPRE - Perform a purely local form of PRE that looks for<br>>> diamond -/// control flow patterns and attempts to perform simple PRE<br>>> at the join point.<br>>> -bool GVN::performPRE(Function &F) {<br>>> -  bool Changed = false;<br>>> +bool GVN::performScalarPRE(Instruction *CurInst) {<br>>> SmallVector<std::pair<Value*, BasicBlock*>, 8> predMap;<br>>> -  for (BasicBlock *CurrentBlock : depth_first(&F.getEntryBlock())) {<br>>> -    // Nothing to PRE in the entry block.<br>>> -    if (CurrentBlock == &F.getEntryBlock()) continue;<br>>><br>>> -    // Don't perform PRE on a landing pad.<br>>> -    if (CurrentBlock->isLandingPad()) continue;<br>>> +  if (isa<AllocaInst>(CurInst) || isa<TerminatorInst>(CurInst) ||<br>>> +      isa<PHINode>(CurInst) || CurInst->getType()->isVoidTy() ||<br>>> +      CurInst->mayReadFromMemory() ||<br>>> + CurInst->mayHaveSideEffects()<br>>> ||<br>>> +      isa<DbgInfoIntrinsic>(CurInst))<br>>> +    return false;<br>>><br>>> -    for (BasicBlock::iterator BI = CurrentBlock->begin(),<br>>> -         BE = CurrentBlock->end(); BI != BE; ) {<br>>> -      Instruction *CurInst = BI++;<o:p></o:p></p></div></div><p class=MsoNormal>>> +  // Don't do PRE on compares. The PHI would prevent CodeGenPrepare<br>>> from<br>>> +  // sinking the compare again, and it would force the code<br>>> + generator<br>>> to<br>>> +  // move the i1 from processor flags or predicate registers into a<o:p></o:p></p><div><div><p class=MsoNormal>>> general<br>>> +  // purpose register.<br>>> +  if (isa<CmpInst>(CurInst))<br>>> +    return false;<br>>><br>>> -      if (isa<AllocaInst>(CurInst) ||<br>>> -          isa<TerminatorInst>(CurInst) || isa<PHINode>(CurInst) ||<br>>> -          CurInst->getType()->isVoidTy() ||<br>>> -          CurInst->mayReadFromMemory() ||<br>>> CurInst->mayHaveSideEffects()<br>>> ||<br>>> -          isa<DbgInfoIntrinsic>(CurInst))<br>>> -        continue;<br>>> +  // We don't currently value number ANY inline asm calls.<br>>> +  if (CallInst *CallI = dyn_cast<CallInst>(CurInst))<br>>> +    if (CallI->isInlineAsm())<br>>> +      return false;<br>>><br>>> -      // Don't do PRE on compares. The PHI would prevent<br>>> CodeGenPrepare<br>>> from<br>>> -      // sinking the compare again, and it would force the code<br>>> generator to<br>>> -      // move the i1 from processor flags or predicate registers into<br>>> a<br>>> general<br>>> -      // purpose register.<br>>> -      if (isa<CmpInst>(CurInst))<br>>> -        continue;<br>>> +  uint32_t ValNo = VN.lookup(CurInst);<br>>><br>>> -      // We don't currently value number ANY inline asm calls.<br>>> -      if (CallInst *CallI = dyn_cast<CallInst>(CurInst))<br>>> -        if (CallI->isInlineAsm())<br>>> -          continue;<br>>> +  // Look for the predecessors for PRE opportunities.  We're  //<br>>> + only trying to solve the basic diamond case, where  // a value is<br>>> + computed in the successor and one predecessor,  // but not the<br>>> + other.  We also explicitly disallow cases  // where the successor<o:p></o:p></p></div></div><p class=MsoNormal>>> + is its own predecessor, because they're  // more complicated to get<br>>> + right.<br>>> +  unsigned NumWith = 0;<br>>> +  unsigned NumWithout = 0;<br>>> +  BasicBlock *PREPred = nullptr;<br>>> +  BasicBlock *CurrentBlock = CurInst->getParent(); predMap.clear();<o:p></o:p></p><div><div><p class=MsoNormal>>> +<br>>> +  for (pred_iterator PI = pred_begin(CurrentBlock), PE =<br>>> pred_end(CurrentBlock);<br>>> +       PI != PE; ++PI) {<br>>> +    BasicBlock *P = *PI;<br>>> +    // We're not interested in PRE where the block is its<br>>> +    // own predecessor, or in blocks with predecessors<br>>> +    // that are not reachable.<br>>> +    if (P == CurrentBlock) {<br>>> +      NumWithout = 2;<br>>> +      break;<br>>> +    } else if (!DT->isReachableFromEntry(P)) {<br>>> +      NumWithout = 2;<br>>> +      break;<br>>> +    }<br>>><br>>> -      uint32_t ValNo = VN.lookup(CurInst);<br>>> +    Value *predV = findLeader(P, ValNo);<br>>> +    if (!predV) {<br>>> +      predMap.push_back(std::make_pair(static_cast<Value<br>>> + *>(nullptr),<br>>> P));<br>>> +      PREPred = P;<br>>> +      ++NumWithout;<br>>> +    } else if (predV == CurInst) {<br>>> +      /* CurInst dominates this predecessor. */<br>>> +      NumWithout = 2;<br>>> +      break;<br>>> +    } else {<br>>> +      predMap.push_back(std::make_pair(predV, P));<br>>> +      ++NumWith;<br>>> +    }<br>>> +  }<br>>><br>>> -      // Look for the predecessors for PRE opportunities.  We're<br>>> -      // only trying to solve the basic diamond case, where<br>>> -      // a value is computed in the successor and one predecessor,<br>>> -      // but not the other.  We also explicitly disallow cases<br>>> -      // where the successor is its own predecessor, because they're<br>>> -      // more complicated to get right.<br>>> -      unsigned NumWith = 0;<br>>> -      unsigned NumWithout = 0;<br>>> -      BasicBlock *PREPred = nullptr;<br>>> -      predMap.clear();<br>>> -<br>>> -      for (pred_iterator PI = pred_begin(CurrentBlock),<br>>> -           PE = pred_end(CurrentBlock); PI != PE; ++PI) {<br>>> -        BasicBlock *P = *PI;<br>>> -        // We're not interested in PRE where the block is its<br>>> -        // own predecessor, or in blocks with predecessors<br>>> -        // that are not reachable.<br>>> -        if (P == CurrentBlock) {<br>>> -          NumWithout = 2;<br>>> -          break;<br>>> -        } else if (!DT->isReachableFromEntry(P))  {<br>>> -          NumWithout = 2;<br>>> -          break;<br>>> -        }<o:p></o:p></p></div></div><p class=MsoNormal>>> +  // Don't do PRE when it might increase code size, i.e. when  // we<o:p></o:p></p><div><div><p class=MsoNormal>>> + would need to insert instructions in more than one pred.<br>>> +  if (NumWithout != 1 || NumWith == 0)<br>>> +    return false;<br>>><br>>> -        Value* predV = findLeader(P, ValNo);<br>>> -        if (!predV) {<br>>> -          predMap.push_back(std::make_pair(static_cast<Value<br>>> *>(nullptr), P));<br>>> -          PREPred = P;<br>>> -          ++NumWithout;<br>>> -        } else if (predV == CurInst) {<br>>> -          /* CurInst dominates this predecessor. */<br>>> -          NumWithout = 2;<br>>> -          break;<br>>> -        } else {<br>>> -          predMap.push_back(std::make_pair(predV, P));<br>>> -          ++NumWith;<br>>> -        }<br>>> -      }<br>>> +  // Don't do PRE across indirect branch.<br>>> +  if (isa<IndirectBrInst>(PREPred->getTerminator()))<br>>> +    return false;<br>>><br>>> -      // Don't do PRE when it might increase code size, i.e. when<br>>> -      // we would need to insert instructions in more than one pred.<br>>> -      if (NumWithout != 1 || NumWith == 0)<br>>> -        continue;<br>>> +  // We can't do PRE safely on a critical edge, so instead we<br>>> schedule<br>>> +  // the edge to be split and perform the PRE the next time we<br>>> iterate<br>>> +  // on the function.<o:p></o:p></p></div></div><p class=MsoNormal>>> +  unsigned SuccNum = GetSuccessorNumber(PREPred, CurrentBlock); if<o:p></o:p></p><div><div><p class=MsoNormal>>> + (isCriticalEdge(PREPred->getTerminator(), SuccNum)) {<br>>> +    toSplit.push_back(std::make_pair(PREPred->getTerminator(),<br>>> SuccNum));<br>>> +    return false;<br>>> +  }<br>>><br>>> -      // Don't do PRE across indirect branch.<br>>> -      if (isa<IndirectBrInst>(PREPred->getTerminator()))<br>>> -        continue;<br>>> +  // Instantiate the expression in the predecessor that lacked it.<br>>> +  // Because we are going top-down through the block, all value<br>>> numbers<br>>> +  // will be available in the predecessor by the time we need them.<br>>> Any<br>>> +  // that weren't originally present will have been instantiated<br>>> earlier<br>>> +  // in this loop.<br>>> +  Instruction *PREInstr = CurInst->clone();  bool success = true;<br>>> + for (unsigned i = 0, e = CurInst->getNumOperands(); i != e; ++i) {<br>>> +    Value *Op = PREInstr->getOperand(i);<br>>> +    if (isa<Argument>(Op) || isa<Constant>(Op) ||<br>>> isa<GlobalValue>(Op))<br>>> +      continue;<br>>><br>>> -      // We can't do PRE safely on a critical edge, so instead we<br>>> schedule<br>>> -      // the edge to be split and perform the PRE the next time we<br>>> iterate<br>>> -      // on the function.<br>>> -      unsigned SuccNum = GetSuccessorNumber(PREPred, CurrentBlock);<br>>> -      if (isCriticalEdge(PREPred->getTerminator(), SuccNum)) {<br>>> -        toSplit.push_back(std::make_pair(PREPred->getTerminator(),<br>>> SuccNum));<br>>> -        continue;<br>>> -      }<br>>> +    if (Value *V = findLeader(PREPred, VN.lookup(Op))) {<br>>> +      PREInstr->setOperand(i, V);<br>>> +    } else {<br>>> +      success = false;<br>>> +      break;<br>>> +    }<br>>> +  }<br>>><br>>> -      // Instantiate the expression in the predecessor that lacked<br>>> it.<br>>> -      // Because we are going top-down through the block, all value<br>>> numbers<br>>> -      // will be available in the predecessor by the time we need<br>>> them.<br>>> Any<br>>> -      // that weren't originally present will have been instantiated<br>>> earlier<br>>> -      // in this loop.<br>>> -      Instruction *PREInstr = CurInst->clone();<br>>> -      bool success = true;<br>>> -      for (unsigned i = 0, e = CurInst->getNumOperands(); i != e;<br>>> ++i)<br>>> {<br>>> -        Value *Op = PREInstr->getOperand(i);<br>>> -        if (isa<Argument>(Op) || isa<Constant>(Op) ||<br>>> isa<GlobalValue>(Op))<br>>> -          continue;<o:p></o:p></p></div></div><p class=MsoNormal>>> +  // Fail out if we encounter an operand that is not available in //<br>>> + the PRE predecessor.  This is typically because of loads which //<o:p></o:p></p><div><div><p class=MsoNormal>>> + are not value numbered precisely.<br>>> +  if (!success) {<br>>> +    DEBUG(verifyRemoved(PREInstr));<br>>> +    delete PREInstr;<br>>> +    return false;<br>>> +  }<br>>><br>>> -        if (Value *V = findLeader(PREPred, VN.lookup(Op))) {<br>>> -          PREInstr->setOperand(i, V);<br>>> -        } else {<br>>> -          success = false;<br>>> -          break;<br>>> -        }<br>>> -      }<br>>> +  PREInstr->insertBefore(PREPred->getTerminator());<br>>> +  PREInstr->setName(CurInst->getName() + ".pre");<br>>> + PREInstr->setDebugLoc(CurInst->getDebugLoc());<br>>> +  VN.add(PREInstr, ValNo);<br>>> +  ++NumGVNPRE;<br>>> +<br>>> +  // Update the availability map to include the new instruction.<br>>> +  addToLeaderTable(ValNo, PREInstr, PREPred);<br>>> +<br>>> +  // Create a PHI to make the value available in this block.<br>>> +  PHINode *Phi =<br>>> +      PHINode::Create(CurInst->getType(), predMap.size(),<br>>> +                      CurInst->getName() + ".pre-phi",<br>>> CurrentBlock->begin());<br>>> +  for (unsigned i = 0, e = predMap.size(); i != e; ++i) {<br>>> +    if (Value *V = predMap[i].first)<br>>> +      Phi->addIncoming(V, predMap[i].second);<br>>> +    else<br>>> +      Phi->addIncoming(PREInstr, PREPred);  }<br>>><br>>> -      // Fail out if we encounter an operand that is not available in<br>>> -      // the PRE predecessor.  This is typically because of loads<br>>> which<br>>> -      // are not value numbered precisely.<br>>> -      if (!success) {<br>>> -        DEBUG(verifyRemoved(PREInstr));<br>>> -        delete PREInstr;<br>>> -        continue;<br>>> -      }<br>>> +  VN.add(Phi, ValNo);<br>>> +  addToLeaderTable(ValNo, Phi, CurrentBlock);<br>>> + Phi->setDebugLoc(CurInst->getDebugLoc());<br>>> +  CurInst->replaceAllUsesWith(Phi);  if<br>>> + (Phi->getType()->getScalarType()->isPointerTy()) {<o:p></o:p></p></div></div><p class=MsoNormal>>> +    // Because we have added a PHI-use of the pointer value, it has<o:p></o:p></p><div><div><p class=MsoNormal>>> now<br>>> +    // "escaped" from alias analysis' perspective.  We need to inform<br>>> +    // AA of this.<br>>> +    for (unsigned ii = 0, ee = Phi->getNumIncomingValues(); ii !=<br>>> + ee;<br>>> ++ii) {<br>>> +      unsigned jj = PHINode::getOperandNumForIncomingValue(ii);<br>>> +      VN.getAliasAnalysis()->addEscapingUse(Phi->getOperandUse(jj));<br>>> +    }<br>>><br>>> -      PREInstr->insertBefore(PREPred->getTerminator());<br>>> -      PREInstr->setName(CurInst->getName() + ".pre");<br>>> -      PREInstr->setDebugLoc(CurInst->getDebugLoc());<br>>> -      VN.add(PREInstr, ValNo);<br>>> -      ++NumGVNPRE;<br>>> -<br>>> -      // Update the availability map to include the new instruction.<br>>> -      addToLeaderTable(ValNo, PREInstr, PREPred);<br>>> -<br>>> -      // Create a PHI to make the value available in this block.<br>>> -      PHINode* Phi = PHINode::Create(CurInst->getType(),<br>>> predMap.size(),<br>>> -                                     CurInst->getName() + ".pre-phi",<br>>> -                                     CurrentBlock->begin());<br>>> -      for (unsigned i = 0, e = predMap.size(); i != e; ++i) {<br>>> -        if (Value *V = predMap[i].first)<br>>> -          Phi->addIncoming(V, predMap[i].second);<br>>> -        else<br>>> -          Phi->addIncoming(PREInstr, PREPred);<br>>> -      }<br>>> -<br>>> -      VN.add(Phi, ValNo);<br>>> -      addToLeaderTable(ValNo, Phi, CurrentBlock);<br>>> -      Phi->setDebugLoc(CurInst->getDebugLoc());<br>>> -      CurInst->replaceAllUsesWith(Phi);<br>>> -      if (Phi->getType()->getScalarType()->isPointerTy()) {<br>>> -        // Because we have added a PHI-use of the pointer value, it<br>>> has<br>>> now<br>>> -        // "escaped" from alias analysis' perspective.  We need to<br>>> inform<br>>> -        // AA of this.<br>>> -        for (unsigned ii = 0, ee = Phi->getNumIncomingValues(); ii !=<br>>> ee;<br>>> -             ++ii) {<br>>> -          unsigned jj = PHINode::getOperandNumForIncomingValue(ii);<br>>> -<br>>> VN.getAliasAnalysis()->addEscapingUse(Phi->getOperandUse(jj));<br>>> -        }<br>>> +    if (MD)<br>>> +      MD->invalidateCachedPointerInfo(Phi);<br>>> +  }<br>>> +  VN.erase(CurInst);<br>>> +  removeFromLeaderTable(ValNo, CurInst, CurrentBlock);<br>>><br>>> -        if (MD)<br>>> -          MD->invalidateCachedPointerInfo(Phi);<br>>> -      }<br>>> -      VN.erase(CurInst);<br>>> -      removeFromLeaderTable(ValNo, CurInst, CurrentBlock);<br>>> +  DEBUG(dbgs() << "GVN PRE removed: " << *CurInst << '\n');<br>>> +  if (MD)<br>>> +    MD->removeInstruction(CurInst);<br>>> +  DEBUG(verifyRemoved(CurInst));<br>>> +  CurInst->eraseFromParent();<br>>> +  return true;<br>>> +}<br>>> +<br>>> +/// performPRE - Perform a purely local form of PRE that looks for<br>>> diamond<o:p></o:p></p></div></div><p class=MsoNormal>>> +/// control flow patterns and attempts to perform simple PRE at the<o:p></o:p></p><div><div><p class=MsoNormal style='margin-bottom:12.0pt'>>> join point.<br>>> +bool GVN::performPRE(Function &F) {<br>>> +  bool Changed = false;<br>>> +  for (BasicBlock *CurrentBlock : depth_first(&F.getEntryBlock())) {<br>>> +    // Nothing to PRE in the entry block.<br>>> +    if (CurrentBlock == &F.getEntryBlock())<br>>> +      continue;<br>>><br>>> -      DEBUG(dbgs() << "GVN PRE removed: " << *CurInst << '\n');<br>>> -      if (MD) MD->removeInstruction(CurInst);<br>>> -      DEBUG(verifyRemoved(CurInst));<br>>> -      CurInst->eraseFromParent();<br>>> -      Changed = true;<br>>> +    // Don't perform PRE on a landing pad.<br>>> +    if (CurrentBlock->isLandingPad())<br>>> +      continue;<br>>> +<br>>> +    for (BasicBlock::iterator BI = CurrentBlock->begin(),<br>>> +                              BE = CurrentBlock->end();<br>>> +         BI != BE;) {<br>>> +      Instruction *CurInst = BI++;<br>>> +      Changed = performScalarPRE(CurInst);<br>>>   }<br>>> }<br>>><br>>> @@ -2637,25 +2655,21 @@ bool GVN::iterateOnFunction(Function &F)<br>>><br>>> // Top-down walk of the dominator tree  bool Changed = false; -#if<br>>> 0<br>>> -  // Needed for value numbering with phi construction to work.<br>>> -  ReversePostOrderTraversal<Function*> RPOT(&F);<br>>> -  for (ReversePostOrderTraversal<Function*>::rpo_iterator RI =<br>>> RPOT.begin(),<br>>> -       RE = RPOT.end(); RI != RE; ++RI)<br>>> -    Changed |= processBlock(*RI);<br>>> -#else<br>>> // Save the blocks this function have before transformation begins.<br>>> GVN may<br>>> // split critical edge, and hence may invalidate the RPO/DT iterator.<br>>> //<br>>> std::vector<BasicBlock *> BBVect;<br>>> BBVect.reserve(256);<br>>> -  for (DomTreeNode *X : depth_first(DT->getRootNode()))<br>>> -    BBVect.push_back(X->getBlock());<br>>> +  // Needed for value numbering with phi construction to work.<br>>> +  ReversePostOrderTraversal<Function *> RPOT(&F);  for<br>>> + (ReversePostOrderTraversal<Function *>::rpo_iterator RI =<br>>> RPOT.begin(),<br>>> +                                                           RE =<br>>> RPOT.end();<br>>> +       RI != RE; ++RI)<br>>> +    BBVect.push_back(*RI);<br>>><br>>> for (std::vector<BasicBlock *>::iterator I = BBVect.begin(), E =<br>>> BBVect.end();<br>>>      I != E; I++)<br>>>   Changed |= processBlock(*I);<br>>> -#endif<br>>><br>>> return Changed;<br>>> }<br>>><br>>> Modified:<br>>> llvm/trunk/test/Analysis/TypeBasedAliasAnalysis/gvn-nonlocal-type-m<br>>> ismatch.ll<br>>> URL:<br>>> <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Analysis/TypeBa" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Analysis/TypeBa</a><br>>> sedAliasAnalysis/gvn-nonlocal-type-mismatch.ll?rev=222039&r1=222038<br>>> &r2=222039&view=diff<br>>> ===================================================================<br>>> ===========<br>>> ---<br>>> llvm/trunk/test/Analysis/TypeBasedAliasAnalysis/gvn-nonlocal-type-m<br>>> ismatch.ll<br>>> (original)<br>>> +++<br>>> llvm/trunk/test/Analysis/TypeBasedAliasAnalysis/gvn-nonlocal-type-m<br>>> ismatch.ll<br>>> Fri Nov 14 15:09:13 2014<br>>> @@ -46,12 +46,12 @@ entry:<br>>> br i1 %c, label %if.else, label %if.then<br>>><br>>> if.then:<br>>> -  %t = load i32* %p, !tbaa !4<br>>> +  %t = load i32* %p, !tbaa !3<br>>> store i32 %t, i32* %q<br>>> ret void<br>>><br>>> if.else:<br>>> -  %u = load i32* %p, !tbaa !3<br>>> +  %u = load i32* %p, !tbaa !4<br>>> store i32 %u, i32* %q<br>>> ret void<br>>> }<br>>> @@ -61,11 +61,11 @@ if.else:<br>>><br>>> ; CHECK: @watch_out_for_another_type_change<br>>> ; CHECK: if.then:<br>>> -; CHECK:   %t = load i32* %p<br>>> -; CHECK:   store i32 %t, i32* %q<br>>> +; CHECK:   store i32 0, i32* %q<br>>> ; CHECK:   ret void<br>>> ; CHECK: if.else:<br>>> -; CHECK:   store i32 0, i32* %q<br>>> +; CHECK:   %u = load i32* %p<br>>> +; CHECK:   store i32 %u, i32* %q<br>>><br>>> define void @watch_out_for_another_type_change(i1 %c, i32* %p, i32*<br>>> %p1,<br>>> i32* %q) nounwind {<br>>> entry:<br>>> @@ -74,12 +74,12 @@ entry:<br>>> br i1 %c, label %if.else, label %if.then<br>>><br>>> if.then:<br>>> -  %t = load i32* %p, !tbaa !3<br>>> +  %t = load i32* %p, !tbaa !4<br>>> store i32 %t, i32* %q<br>>> ret void<br>>><br>>> if.else:<br>>> -  %u = load i32* %p, !tbaa !4<br>>> +  %u = load i32* %p, !tbaa !3<br>>> store i32 %u, i32* %q<br>>> ret void<br>>> }<br>>><br>>> Added: llvm/trunk/test/Transforms/GVN/pre-gep-load.ll<br>>> URL:<br>>> <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/GVN/" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/GVN/</a><br>>> pre-gep-load.ll?rev=222039&view=auto<br>>> ===================================================================<br>>> ===========<br>>> --- llvm/trunk/test/Transforms/GVN/pre-gep-load.ll (added)<br>>> +++ llvm/trunk/test/Transforms/GVN/pre-gep-load.ll Fri Nov 14<br>>> +++ 15:09:13<br>>> 2014<br>>> @@ -0,0 +1,49 @@<br>>> +; RUN: opt < %s -basicaa -gvn -enable-load-pre -S | FileCheck %s<br>>> +target datalayout = "e-m:e-i64:64-i128:128-n32:64-S128"<br>>> +target triple = "aarch64--linux-gnu"<br>>> +<br>>> +define double @foo(i32 %stat, i32 %i, double** %p) { ;<br>>> +CHECK-LABEL: @foo(<br>>> +entry:<br>>> +  switch i32 %stat, label %sw.default [<br>>> +    i32 0, label %<a href="http://sw.bb" target="_blank">sw.bb</a><br>>> +    i32 1, label %<a href="http://sw.bb" target="_blank">sw.bb</a><br>>> +    i32 2, label %sw.bb2<br>>> +  ]<br>>> +<br>>> +<a href="http://sw.bb" target="_blank">sw.bb</a>:                                            ; preds = %entry,<br>>> %entry<br>>> +  %idxprom = sext i32 %i to i64<br>>> +  %arrayidx = getelementptr inbounds double** %p, i64 0<br>>> +  %0 = load double** %arrayidx, align 8<br>>> +  %arrayidx1 = getelementptr inbounds double* %0, i64 %idxprom<br>>> +  %1 = load double* %arrayidx1, align 8  %sub = fsub double %1,<br>>> + 1.000000e+00  %cmp = fcmp olt double %sub, 0.000000e+00  br i1<br>>> + %cmp, label %if.then, label %if.end<br>>> +<br>>> +if.then:                                          ; preds = %<a href="http://sw.bb" target="_blank">sw.bb</a><br>>> +  br label %return<br>>> +<br>>> +if.end:                                           ; preds = %<a href="http://sw.bb" target="_blank">sw.bb</a><br>>> +  br label %sw.bb2<br>>> +<br>>> +sw.bb2:                                           ; preds = %if.end,<br>>> %entry<br>>> +  %idxprom3 = sext i32 %i to i64<br>>> +  %arrayidx4 = getelementptr inbounds double** %p, i64 0<br>>> +  %2 = load double** %arrayidx4, align 8<br>>> +  %arrayidx5 = getelementptr inbounds double* %2, i64 %idxprom3<br>>> +  %3 = load double* %arrayidx5, align 8 ; CHECK: sw.bb2:<br>>> +; CHECK-NEXT-NOT: sext<br>>> +; CHECK-NEXT: phi double [<br>>> +; CHECK-NOT: load<br>>> +  %sub6 = fsub double 3.000000e+00, %3<br>>> +  br label %return<br>>> +<br>>> +sw.default:                                       ; preds = %entry<br>>> +  br label %return<br>>> +<br>>> +return:                                           ; preds =<br>>> %sw.default, %sw.bb2, %if.then<br>>> +  %retval.0 = phi double [ 0.000000e+00, %sw.default ], [ %sub6,<br>>> %sw.bb2 ], [ %sub, %if.then ]<br>>> +  ret double %retval.0<br>>> +}<br>>><br>>><br>>> _______________________________________________<br>>> llvm-commits mailing list<br>>> <a href="mailto:llvm-commits@cs.uiuc.edu" target="_blank">llvm-commits@cs.uiuc.edu</a><br>>> <a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits</a><br>>><br>>><br>>><br>>><br>>><br>>><br>>><br>>><br>>><br>>> <0001-Reapply-r221924-GVN-Perform-Scalar-PRE-on-gep-indice.patch><br>>><br>>><br>>><br>>><br>>> _______________________________________________<br>>> llvm-commits mailing list<br>>> <a href="mailto:llvm-commits@cs.uiuc.edu" target="_blank">llvm-commits@cs.uiuc.edu</a><br>>> <a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits</a><br>>><br>><br>><br>> _______________________________________________<br>> llvm-commits mailing list<br>> <a href="mailto:llvm-commits@cs.uiuc.edu" target="_blank">llvm-commits@cs.uiuc.edu</a><br>> <a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits</a><br>><br><br>_______________________________________________<br>llvm-commits mailing list<br><a href="mailto:llvm-commits@cs.uiuc.edu" target="_blank">llvm-commits@cs.uiuc.edu</a><br><a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits</a><o:p></o:p></p></div></div></div><p class=MsoNormal><o:p> </o:p></p></div></div></div></div></div></div><p class=MsoNormal><o:p> </o:p></p></div></div></body></html>