llvm / llvm-project

The LLVM Project is a collection of modular and reusable compiler and toolchain technologies.
http://llvm.org
Other
29.05k stars 11.98k forks source link

[debugify] loop-vectorize fail #37303

Open gregbedwell opened 6 years ago

gregbedwell commented 6 years ago
Bugzilla Link 37955
Version trunk
OS Windows NT
Blocks llvm/llvm-project#37301
Attachments .ll file
CC @fhahn,@vedantk

Extended Description

From the same source example as in Bug 37954, from Stephen Wilks's work to automatically find debugify failures.

$ clang -v clang version 7.0.0 (trunk 335708) (llvm/trunk 335721) Target: x86_64-pc-windows-msvc Thread model: posix InstalledDir: e:\work\upstream-llvm\build-vs2015-native-ninja\bin

$ cat loop_vectorization.cpp void baz(int *foo, int bar) { while (bar--) foo[bar] = bar; }

$ clang loop_vectorization.cpp -S -emit-llvm -O0 -Xclang -disable-O0-optnone -o - | opt -S -O3 -opt-bisect-limit=59 -o loop-vectorize-input.ll 2>nul

$ opt loop-vectorize-input.ll -disable-output -debugify-each -loop-vectorize ERROR: Instruction with empty DebugLoc in function ?baz@@YAXPEAHH@Z -- %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ] ERROR: Instruction with empty DebugLoc in function ?baz@@YAXPEAHH@Z -- %vec.ind = phi <4 x i64> [ %induction, %vector.ph ], [ %vec.ind.next, %vector.body ] ERROR: Instruction with empty DebugLoc in function ?baz@@YAXPEAHH@Z -- %step.add = add <4 x i64> %vec.ind, <i64 -4, i64 -4, i64 -4, i64 -4> ERROR: Instruction with empty DebugLoc in function ?baz@@YAXPEAHH@Z -- %index.next = add i64 %index, 8 ERROR: Instruction with empty DebugLoc in function ?baz@@YAXPEAHH@Z -- %vec.ind.next = add <4 x i64> %step.add, <i64 -4, i64 -4, i64 -4, i64 -4> ERROR: Instruction with empty DebugLoc in function ?baz@@YAXPEAHH@Z -- %15 = icmp eq i64 %index.next, %n.vec ERROR: Instruction with empty DebugLoc in function ?baz@@YAXPEAHH@Z -- br i1 %15, label %middle.block, label %vector.body, !llvm.loop !​30 ERROR: Instruction with empty DebugLoc in function ?baz@@YAXPEAHH@Z -- %cmp.n = icmp eq i64 %0, %n.vec ERROR: Instruction with empty DebugLoc in function ?baz@@YAXPEAHH@Z -- %bc.resume.val = phi i64 [ %ind.end, %middle.block ], [ %0, %while.body.preheader ] CheckFunctionDebugify [Loop Vectorization]: FAIL CheckFunctionDebugify [Module Verifier]: PASS

$

llvmbot commented 6 years ago

There are some active ones: https://reviews.llvm.org/D49347 and https://reviews.llvm.org/D49746

reviews are welcomed!

llvmbot commented 6 years ago

https://reviews.llvm.org/rL336667 here is another one.

llvmbot commented 6 years ago

Yup, you are right to assume that :)

I'll try and fix more of those, although some seem more complicated that a simple DL copy from the dying Instruction.

gregbedwell commented 6 years ago

As of "clang version 7.0.0 (trunk 336255) (llvm/trunk 336258)" we're now down to 8 errors rather than 9 for this example, as we no longer get the final:

ERROR: Instruction with empty DebugLoc in function ?baz@@YAXPEAHH@Z -- %bc.resume.val = phi i64 [ %ind.end, %middle.block ], [ %0, %while.body.preheader ]

I've not verified the before/after, but I strongly assume that this is down to the following commit, so thanks Anastasis! http://llvm.org/viewvc/llvm-project?view=revision&revision=336256