[llvm] r258125 - [WebAssembly] Re-enable loop idiom recognition for memcpy et al.

JF Bastien via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 19 08:42:03 PST 2016


Hi Dan,

This causes this test program
<https://github.com/gcc-mirror/gcc/blob/master/gcc/testsuite/gcc.c-torture/execute/20030916-1.c>
to fail as follows:

FAILED 20030916-1.c
clang-3.9: /b/build/slave/linux/build/src/src/work/llvm/lib/CodeGen/SelectionDAG/InstrEmitter.cpp:302:
unsigned int llvm::InstrEmitter::getVR(llvm::SDValue,
DenseMap<llvm::SDValue, unsigned int> &): Assertion `I !=
VRBaseMap.end() && "Node emitted out of order - late"' failed.
0  libLLVM-3.9svn.so 0x00007f4af8130c78
llvm::sys::PrintStackTrace(llvm::raw_ostream&) + 40
1  libLLVM-3.9svn.so 0x00007f4af81313e7
2  libpthread.so.0   0x00007f4af7561340
3  libc.so.6         0x00007f4af6789cc9 gsignal + 57
4  libc.so.6         0x00007f4af678d0d8 abort + 328
5  libc.so.6         0x00007f4af6782b86
6  libc.so.6         0x00007f4af6782c32
7  libLLVM-3.9svn.so 0x00007f4af85e02fa
8  libLLVM-3.9svn.so 0x00007f4af85e3ce3
9  libLLVM-3.9svn.so 0x00007f4af86855c8
llvm::ScheduleDAGSDNodes::EmitSchedule(llvm::MachineBasicBlock::bundle_iterator<llvm::MachineInstr,
llvm::ilist_iterator<llvm::MachineInstr> >&) + 1368
10 libLLVM-3.9svn.so 0x00007f4af87194ee
llvm::SelectionDAGISel::CodeGenAndEmitDAG() + 4942
11 libLLVM-3.9svn.so 0x00007f4af8717a87
llvm::SelectionDAGISel::SelectAllBasicBlocks(llvm::Function const&) +
7175
12 libLLVM-3.9svn.so 0x00007f4af8714a96
llvm::SelectionDAGISel::runOnMachineFunction(llvm::MachineFunction&) +
2054
13 libLLVM-3.9svn.so 0x00007f4af8414b59
llvm::MachineFunctionPass::runOnFunction(llvm::Function&) + 153
14 libLLVM-3.9svn.so 0x00007f4af82a7f84
llvm::FPPassManager::runOnFunction(llvm::Function&) + 564
15 libLLVM-3.9svn.so 0x00007f4af82a81cb
llvm::FPPassManager::runOnModule(llvm::Module&) + 43
16 libLLVM-3.9svn.so 0x00007f4af82a8695
llvm::legacy::PassManagerImpl::run(llvm::Module&) + 869
17 clang-3.9         0x00000000005a66ad
clang::EmitBackendOutput(clang::DiagnosticsEngine&,
clang::CodeGenOptions const&, clang::TargetOptions const&,
clang::LangOptions const&, llvm::StringRef, llvm::Module*,
clang::BackendAction, llvm::raw_pwrite_stream*) + 9677
18 clang-3.9         0x00000000009f67f8
19 clang-3.9         0x0000000000c16f56 clang::ParseAST(clang::Sema&,
bool, bool) + 598
20 clang-3.9         0x000000000095bde5 clang::FrontendAction::Execute() + 69
21 clang-3.9         0x0000000000923f81
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) + 1153
22 clang-3.9         0x00000000009f2aee
clang::ExecuteCompilerInvocation(clang::CompilerInstance*) + 3086
23 clang-3.9         0x00000000005637ac cc1_main(llvm::ArrayRef<char
const*>, char const*, void*) + 1036
24 clang-3.9         0x00000000005623cf main + 12559
25 libc.so.6         0x00007f4af6774ec5 __libc_start_main + 245
26 clang-3.9         0x000000000055f1bb
Stack dump:


On Tue, Jan 19, 2016 at 6:49 AM, Dan Gohman via llvm-commits <
llvm-commits at lists.llvm.org> wrote:

> Author: djg
> Date: Tue Jan 19 08:49:23 2016
> New Revision: 258125
>
> URL: http://llvm.org/viewvc/llvm-project?rev=258125&view=rev
> Log:
> [WebAssembly] Re-enable loop idiom recognition for memcpy et al.
>
> Removed:
>     llvm/trunk/test/CodeGen/WebAssembly/loop-idiom.ll
> Modified:
>     llvm/trunk/lib/Analysis/TargetLibraryInfo.cpp
>
> Modified: llvm/trunk/lib/Analysis/TargetLibraryInfo.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/TargetLibraryInfo.cpp?rev=258125&r1=258124&r2=258125&view=diff
>
> ==============================================================================
> --- llvm/trunk/lib/Analysis/TargetLibraryInfo.cpp (original)
> +++ llvm/trunk/lib/Analysis/TargetLibraryInfo.cpp Tue Jan 19 08:49:23 2016
> @@ -70,9 +70,7 @@ static void initialize(TargetLibraryInfo
>    // There are no library implementations of mempcy and memset for AMD
> gpus and
>    // these can be difficult to lower in the backend.
>    if (T.getArch() == Triple::r600 ||
> -      T.getArch() == Triple::amdgcn ||
> -      T.getArch() == Triple::wasm32 ||
> -      T.getArch() == Triple::wasm64) {
> +      T.getArch() == Triple::amdgcn) {
>      TLI.setUnavailable(LibFunc::memcpy);
>      TLI.setUnavailable(LibFunc::memset);
>      TLI.setUnavailable(LibFunc::memset_pattern16);
>
> Removed: llvm/trunk/test/CodeGen/WebAssembly/loop-idiom.ll
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/WebAssembly/loop-idiom.ll?rev=258124&view=auto
>
> ==============================================================================
> --- llvm/trunk/test/CodeGen/WebAssembly/loop-idiom.ll (original)
> +++ llvm/trunk/test/CodeGen/WebAssembly/loop-idiom.ll (removed)
> @@ -1,53 +0,0 @@
> -; RUN: opt -loop-idiom -S < %s -march=wasm32 | FileCheck %s
> -
> -target datalayout = "e-m:e-p:32:32-i64:64-n32:64-S128"
> -target triple = "wasm32-unknown-unknown"
> -
> -
> -; Make sure loop-idiom doesn't create memcpy or memset. These aren't well
> -; supported in WebAssembly for now.
> -;
> -; TODO Check the patterns are recognized once memcpy / memset are
> supported.
> -
> -; CHECK-LABEL: @cpy(
> -; CHECK-NOT: llvm.memcpy
> -; CHECK: load
> -; CHECK: store
> -define void @cpy(i64 %Size) {
> -bb.nph:
> -  %Base = alloca i8, i32 10000
> -  %Dest = alloca i8, i32 10000
> -  br label %for.body
> -
> -for.body:
> -  %indvar = phi i64 [ 0, %bb.nph ], [ %indvar.next, %for.body ]
> -  %I.0.014 = getelementptr i8, i8* %Base, i64 %indvar
> -  %DestI = getelementptr i8, i8* %Dest, i64 %indvar
> -  %V = load i8, i8* %I.0.014, align 1
> -  store i8 %V, i8* %DestI, align 1
> -  %indvar.next = add i64 %indvar, 1
> -  %exitcond = icmp eq i64 %indvar.next, %Size
> -  br i1 %exitcond, label %for.end, label %for.body
> -
> -for.end:
> -  ret void
> -}
> -
> -; CHECK-LABEL: @set(
> -; CHECK-NOT: llvm.memset
> -; CHECK: store
> -define void @set(i8* %Base, i64 %Size) {
> -bb.nph:
> -  br label %for.body
> -
> -for.body:
> -  %indvar = phi i64 [ 0, %bb.nph ], [ %indvar.next, %for.body ]
> -  %I.0.014 = getelementptr i8, i8* %Base, i64 %indvar
> -  store i8 0, i8* %I.0.014, align 1
> -  %indvar.next = add i64 %indvar, 1
> -  %exitcond = icmp eq i64 %indvar.next, %Size
> -  br i1 %exitcond, label %for.end, label %for.body
> -
> -for.end:
> -  ret void
> -}
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160119/8431c18f/attachment.html>


More information about the llvm-commits mailing list