[llvm] r222039 - Reapply r221924: "[GVN] Perform Scalar PRE on gep indices that feed loads before

Manman Ren manman.ren at gmail.com
Thu Nov 20 08:42:55 PST 2014


Hi Hao,

Sorry about missing the step of acquiring source. What I did was trying to
replicate what the build bot is doing.

Yes, libcxx is part of the source acquiring. See

http://lab.llvm.org:8080/green/job/clang-Rlto_master_acquire/514/console

for a list of projects.

If you still have problem reproducing, let me know.

Manman

On Thu, Nov 20, 2014 at 2:49 AM, Hao Liu <Hao.Liu at arm.com> wrote:

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


More information about the llvm-commits mailing list