[PATCH] D71547: Resubmit "[Alignment][NFC] Deprecate CreateMemCpy/CreateMemMove"

Guillaume Chatelet via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 16 08:33:59 PST 2020


I cannot understand the root cause of the assertion with stack trace only.
It's linked to an atomic load that is not setup properly at the IR level so
it can come from a lot of places (clang itself or an IR optimisation pass
to name a few).
It would be nice to have a reduced example indeed.

On Thu, Jan 16, 2020 at 5:09 PM Alexandre Ganea via Phabricator <
reviews at reviews.llvm.org> wrote:

> aganea added a comment.
> Herald added a subscriber: kerbowa.
>
> Hi! Since this is the last commit in `Instructions.cpp`, you can maybe
> help?
>
> I'm seeing an assertion in one of our projects. I'm at
> rG28bb43bdf808c7e737eabfb6f6a368ace9086a9f <
> https://reviews.llvm.org/rG28bb43bdf808c7e737eabfb6f6a368ace9086a9f>.
> I'm using the following cmake to build on Windows:
>
>   > set LLVM=c:/Program Files/LLVM
>   > %LLVM%\bin\clang-cl --version
>   clang version 9.0.0 (tags/RELEASE_900/final)
>   Target: x86_64-pc-windows-msvc
>   Thread model: posix
>   InstalledDir: C:\Program Files\LLVM\bin
>
>   > cmake -GNinja %ROOT%/llvm -DCMAKE_BUILD_TYPE=Release
> -DLLVM_OPTIMIZED_TABLEGEN=true -DLLVM_ENABLE_ASSERTIONS=ON
> -DLLVM_ENABLE_LIBXML2=OFF -DLLVM_USE_CRT_RELEASE=MT
> -DCMAKE_C_COMPILER="%LLVM%/bin/clang-cl.EXE"
> -DCMAKE_CXX_COMPILER="%LLVM%/bin/clang-cl.EXE"
> -DCMAKE_LINKER="%LLVM%/bin/link.EXE" -DLLVM_ENABLE_PDB=true
> -DCMAKE_CXX_FLAGS="/GS- /D_ITERATOR_DEBUG_LEVEL=0 /arch:AVX2"
> -DCMAKE_C_FLAGS="/GS- /D_ITERATOR_DEBUG_LEVEL=0 /arch:AVX2"
> -DLLVM_ENABLE_PROJECTS="llvm;clang;lld" -DLLVM_ENABLE_PDB=ON
>
> The assertion is this:
>
>   Assertion failed: !(isAtomic() && getAlignment() == 0) && "Alignment
> required for atomic load", file
> D:\llvm-project\llvm\lib\IR\Instructions.cpp, line 1287
>   Stack dump:
>   0.    Program arguments: D:\llvm-project\buildNinjaRel\bin\clang-cl.exe
> (stripped).cpp /Fo(stripped).obj /c /Yu(stripped).h /Fp(stripped).pch
> /FI(stripped).h (stripped project-specific /I) /Z7 /nologo /W0 /WX-
> (stripped project-specific /D)  /DWIN32_LEAN_AND_MEAN /DWIN64
> /DWINAPI_FAMILY=WINAPI_FAMILY_DESKTOP_APP
> /D_ENABLE_EXTENDED_ALIGNED_STORAGE /D_LIB
> /D_SILENCE_STDEXT_HASH_DEPRECATION_WARNINGS /D_WIN32_WINNT=0x0601
> /D__clang__=1 /GF /EHsc /MT /GS /Gy- /fp:fast /fp:except- /Zc:wchar_t
> /Zc:forScope /Zc:inline /GR- /openmp- /Fd(stripped).pdb /Gd /wd4100 /wd4127
> /wd4189 /wd4201 /wd4206 /wd4503 /wd4505 /wd4511 /wd4512 /wd4611 /wd4702
> /wd4714 /wd4748 /wd4800 /TP -m64 -fmsc-version=1910 /errorReport:queue
> /D_MBCS /bigobj /FC /permissive- /Zc:twoPhase- /Zc:strictStrings
> /Zc:ternary- /Zo -fdiagnostics-absolute-paths -march=haswell
> -Wno-c++11-narrowing /O2 /Ob2 /Oi /Ot /Oy- /showIncludes
>   1.    <eof> parser at end of file
>   2.    Per-module optimization passes
>   3.    Running pass 'CallGraph Pass Manager' on module '(stripped).cpp'.
>   4.    Running pass 'Jump Threading' on function '(stripped)'
>    #0 0x00007ff716254c56 HandleAbort
> D:\llvm-project\llvm\lib\Support\Windows\Signals.inc:408:0
>    #1 0x00007ff719e994a5 raise
> minkernel\crts\ucrt\src\appcrt\misc\signal.cpp:547:0
>    #2 0x00007ff719e8f13c abort
> minkernel\crts\ucrt\src\appcrt\startup\abort.cpp:71:0
>    #3 0x00007ff719e8f7da common_assert_to_stderr<wchar_t>
> minkernel\crts\ucrt\src\appcrt\startup\assert.cpp:186:0
>    #4 0x00007ff719e8f682 _wassert
> minkernel\crts\ucrt\src\appcrt\startup\assert.cpp:443:0
>    #5 0x00007ff71657c161 llvm::LoadInst::LoadInst(class llvm::Type *,
> class llvm::Value *, class llvm::Twine const &, bool, struct
> llvm::MaybeAlign, enum llvm::AtomicOrdering, unsigned char, class
> llvm::Instruction *) D:\llvm-project\llvm\lib\IR\Instructions.cpp:1325:0
>    #6 0x00007ff716587a5b llvm::LoadInst::cloneImpl(void) const
> D:\llvm-project\llvm\lib\IR\Instructions.cpp:4147:0
>    #7 0x00007ff71680ca7c llvm::Instruction::clone(void) const
> D:\llvm-project\llvm\include\llvm\IR\Instruction.def:172:0
>    #8 0x00007ff7160c85f1 llvm::JumpThreadingPass::CloneInstructions(class
> llvm::ilist_iterator<struct llvm::ilist_detail::node_options<class
> llvm::Instruction, 1, 0, void>, 0, 0>, class llvm::ilist_iterator<struct
> llvm::ilist_detail::node_options<class llvm::Instruction, 1, 0, void>, 0,
> 0>, class llvm::BasicBlock *, class llvm::BasicBlock *)
> D:\llvm-project\llvm\lib\Transforms\Scalar\JumpThreading.cpp:2001:0
>    #9 0x00007ff7160c92b1 llvm::JumpThreadingPass::ThreadEdge(class
> llvm::BasicBlock *, class llvm::SmallVectorImpl<class llvm::BasicBlock *>
> const &, class llvm::BasicBlock *)
> D:\llvm-project\llvm\lib\Transforms\Scalar\JumpThreading.cpp:2105:0
>   #10 0x00007ff7160c6582 llvm::JumpThreadingPass::TryThreadEdge(class
> llvm::BasicBlock *, class llvm::SmallVectorImpl<class llvm::BasicBlock *>
> const &, class llvm::BasicBlock *)
> D:\llvm-project\llvm\lib\Transforms\Scalar\JumpThreading.cpp:2051:0
>   #11 0x00007ff7160c3209
> llvm::JumpThreadingPass::ProcessThreadableEdges(class llvm::Value *, class
> llvm::BasicBlock *, enum llvm::jumpthreading::ConstantPreference, class
> llvm::Instruction *)
> D:\llvm-project\llvm\lib\Transforms\Scalar\JumpThreading.cpp:1720:0
>   #12 0x00007ff7160be44d llvm::JumpThreadingPass::ProcessBlock(class
> llvm::BasicBlock *)
> D:\llvm-project\llvm\lib\Transforms\Scalar\JumpThreading.cpp:0:0
>   #13 0x00007ff7160bc90b llvm::JumpThreadingPass::runImpl(class
> llvm::Function &, class llvm::TargetLibraryInfo *, class
> llvm::LazyValueInfo *, class llvm::AAResults *, class llvm::DomTreeUpdater
> *, bool, class std::unique_ptr<class llvm::BlockFrequencyInfo, struct
> std::default_delete<class llvm::BlockFrequencyInfo>>, class
> std::unique_ptr<class llvm::BranchProbabilityInfo, struct
> std::default_delete<class llvm::BranchProbabilityInfo>>)
> D:\llvm-project\llvm\lib\Transforms\Scalar\JumpThreading.cpp:397:0
>   #14 0x00007ff7160cbadd `anonymous
> namespace'::JumpThreading::runOnFunction
> D:\llvm-project\llvm\lib\Transforms\Scalar\JumpThreading.cpp:315:0
>   #15 0x00007ff715ebab56 llvm::FPPassManager::runOnFunction(class
> llvm::Function &) D:\llvm-project\llvm\lib\IR\LegacyPassManager.cpp:1481:0
>   #16 0x00007ff716f2e45b `anonymous namespace'::CGPassManager::runOnModule
> D:\llvm-project\llvm\lib\Analysis\CallGraphSCCPass.cpp:497:0
>   #17 0x00007ff715ebb4e1 llvm::legacy::PassManagerImpl::run(class
> llvm::Module &) D:\llvm-project\llvm\lib\IR\LegacyPassManager.cpp:1694:0
>   #18 0x00007ff717283634 clang::EmitBackendOutput(class
> clang::DiagnosticsEngine &, class clang::HeaderSearchOptions const &, class
> clang::CodeGenOptions const &, class clang::TargetOptions const &, class
> clang::LangOptions const &, class llvm::DataLayout const &, class
> llvm::Module *, enum clang::BackendAction, class std::unique_ptr<class
> llvm::raw_pwrite_stream, struct std::default_delete<class
> llvm::raw_pwrite_stream>>)
> D:\llvm-project\clang\lib\CodeGen\BackendUtil.cpp:1550:0
>   #19 0x00007ff7175cb82b
> clang::BackendConsumer::HandleTranslationUnit(class clang::ASTContext &)
> D:\llvm-project\clang\lib\CodeGen\CodeGenAction.cpp:339:0
>   #20 0x00007ff718cef6b3 clang::ParseAST(class clang::Sema &, bool, bool)
> D:\llvm-project\clang\lib\Parse\ParseAST.cpp:178:0
>   #21 0x00007ff71752fd95 clang::FrontendAction::Execute(void)
> D:\llvm-project\clang\lib\Frontend\FrontendAction.cpp:940:0
>   #22 0x00007ff71634a41b clang::CompilerInstance::ExecuteAction(class
> clang::FrontendAction &)
> D:\llvm-project\clang\lib\Frontend\CompilerInstance.cpp:965:0
>   #23 0x00007ff7163a8777 clang::ExecuteCompilerInvocation(class
> clang::CompilerInstance *)
> D:\llvm-project\clang\lib\FrontendTool\ExecuteCompilerInvocation.cpp:290:0
>   #24 0x00007ff715af788a cc1_main(class llvm::ArrayRef<char const *>, char
> const *, void *) D:\llvm-project\clang\tools\driver\cc1_main.cpp:239:0
>   #25 0x00007ff715af48aa ExecuteCC1Tool
> D:\llvm-project\clang\tools\driver\driver.cpp:340:0
>   #26 0x00007ff71736695e llvm::function_ref<void ()>::callback_fn<`lambda
> at D:\llvm-project\clang\lib\Driver\Job.cpp:402:22'>
> D:\llvm-project\llvm\include\llvm\ADT\STLExtras.h:108:0
>   #27 0x00007ff71620bf2a InvokeFunctionCall
> D:\llvm-project\llvm\lib\Support\CrashRecoveryContext.cpp:207:0
>   #28 0x00007ff71620beed llvm::CrashRecoveryContext::RunSafely(class
> llvm::function_ref<(void)>)
> D:\llvm-project\llvm\lib\Support\CrashRecoveryContext.cpp:214:0
>   #29 0x00007ff71736625a clang::driver::CC1Command::Execute(class
> llvm::ArrayRef<class llvm::Optional<class llvm::StringRef>>, class
> std::basic_string<char, struct std::char_traits<char>, class
> std::allocator<char>> *, bool *) const
> D:\llvm-project\clang\lib\Driver\Job.cpp:402:0
>   #30 0x00007ff71631584f clang::driver::Compilation::ExecuteCommand(class
> clang::driver::Command const &, class clang::driver::Command const *&)
> const D:\llvm-project\clang\lib\Driver\Compilation.cpp:182:0
>   #31 0x00007ff716315bb9 clang::driver::Compilation::ExecuteJobs(class
> clang::driver::JobList const &, class llvm::SmallVectorImpl<struct
> std::pair<int, class clang::driver::Command const *>> &) const
> D:\llvm-project\clang\lib\Driver\Compilation.cpp:233:0
>   #32 0x00007ff716328c97 clang::driver::Driver::ExecuteCompilation(class
> clang::driver::Compilation &, class llvm::SmallVectorImpl<struct
> std::pair<int, class clang::driver::Command const *>> &)
> D:\llvm-project\clang\lib\Driver\Driver.cpp:1476:0
>   #33 0x00007ff715af3f59 main
> D:\llvm-project\clang\tools\driver\driver.cpp:493:0
>   #34 0x00007ff719e7b788 __scrt_common_main_seh
> d:\agent\_work\5\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl:288:0
>   #35 0x00007ffb60747bd4 (C:\WINDOWS\System32\KERNEL32.DLL+0x17bd4)
>   #36 0x00007ffb610eced1 (C:\WINDOWS\SYSTEM32\ntdll.dll+0x6ced1)
>
> I can try to c-reduce if that's necessary.
>
> Can you help or should I ask on the mailing list?
>
>
> Repository:
>   rG LLVM Github Monorepo
>
> CHANGES SINCE LAST ACTION
>   https://reviews.llvm.org/D71547/new/
>
> https://reviews.llvm.org/D71547
>
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200116/98b4de91/attachment.html>


More information about the llvm-commits mailing list