Skip to content

[openmp] [opt] Attributor assertion failure #63597

@dhruvachak

Description

@dhruvachak

This started failing after the following commit

https://reviews.llvm.org/rG732bdb607341854de8185bd71cec00e8cb04bad2
[Attributor] Avoid the type check in getCalledFunction

It showed up in a downstream build of DeviceRTL. It turns out that it is reproducible with the trunk compiler as well. To reproduce, run the following on the attached .bc file.
% opt -O3 -openmp-opt-disable -attributor-enable=module test.bc -o out.bc

The problem disappears if -attributor-enable=module is removed.

Here's the assertion failure.

opt: /home/dhchakra/git/aomp-trunk/llvm-project/llvm/lib/IR/Value.cpp:922: llvm::Align llvm::Value::getPointerAlignment(const llvm::DataLayout&) const: Assertion `getType()->isPointerTy() && "must be pointer"' failed.
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
Stack dump:
0.	Program arguments: /home/dhchakra/git/aomp-trunk/llvm-project/build/bin/opt -O3 -openmp-opt-disable -attributor-enable=module test.bc -o out.bc
 #0 0x000055de5674136f llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/home/dhchakra/git/aomp-trunk/llvm-project/build/bin/opt+0x21c436f)
 #1 0x000055de5673eac4 SignalHandler(int) Signals.cpp:0:0
 #2 0x00007ff84f319420 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x14420)
 #3 0x00007ff84edb600b raise /build/glibc-SzIz7B/glibc-2.31/signal/../sysdeps/unix/sysv/linux/raise.c:51:1
 #4 0x00007ff84ed95859 abort /build/glibc-SzIz7B/glibc-2.31/stdlib/abort.c:81:7
 #5 0x00007ff84ed95729 get_sysdep_segment_value /build/glibc-SzIz7B/glibc-2.31/intl/loadmsgcat.c:509:8
 #6 0x00007ff84ed95729 _nl_load_domain /build/glibc-SzIz7B/glibc-2.31/intl/loadmsgcat.c:970:34
 #7 0x00007ff84eda6fd6 (/lib/x86_64-linux-gnu/libc.so.6+0x33fd6)
 #8 0x000055de560b204e llvm::Value::getPointerAlignment(llvm::DataLayout const&) const (/home/dhchakra/git/aomp-trunk/llvm-project/build/bin/opt+0x1b3504e)
 #9 0x000055de561824ec (anonymous namespace)::AAAlignImpl::initialize(llvm::Attributor&) AttributorAttributes.cpp:0:0
#10 0x000055de56117403 llvm::AAAlign const* llvm::Attributor::getOrCreateAAFor<llvm::AAAlign>(llvm::IRPosition, llvm::AbstractAttribute const*, llvm::DepClassTy, bool, bool) (/home/dhchakra/git/aomp-trunk/llvm-project/build/bin/opt+0x1b9a403)
#11 0x000055de56182c6b (anonymous namespace)::AAAlignCallSiteArgument::updateImpl(llvm::Attributor&) AttributorAttributes.cpp:0:0
#12 0x000055de560eea1a llvm::AbstractAttribute::update(llvm::Attributor&) (/home/dhchakra/git/aomp-trunk/llvm-project/build/bin/opt+0x1b71a1a)
#13 0x000055de56101edb llvm::Attributor::updateAA(llvm::AbstractAttribute&) (/home/dhchakra/git/aomp-trunk/llvm-project/build/bin/opt+0x1b84edb)
#14 0x000055de561175e5 llvm::AAAlign const* llvm::Attributor::getOrCreateAAFor<llvm::AAAlign>(llvm::IRPosition, llvm::AbstractAttribute const*, llvm::DepClassTy, bool, bool) (/home/dhchakra/git/aomp-trunk/llvm-project/build/bin/opt+0x1b9a5e5)
#15 0x000055de56181ff1 void (anonymous namespace)::followUsesInContext<(anonymous namespace)::AAAlignImpl, llvm::IncIntegerState<unsigned long, 4294967296ul, 1ul>>((anonymous namespace)::AAAlignImpl&, llvm::Attributor&, llvm::MustBeExecutedContextExplorer&, llvm::Instruction const*, llvm::SetVector<llvm::Use const*, std::vector<llvm::Use const*, std::allocator<llvm::Use const*>>, llvm::DenseSet<llvm::Use const*, llvm::DenseMapInfo<llvm::Use const*, void>>, 0u>&, llvm::IncIntegerState<unsigned long, 4294967296ul, 1ul>&) AttributorAttributes.cpp:0:0
#16 0x000055de56182619 (anonymous namespace)::AAAlignImpl::initialize(llvm::Attributor&) AttributorAttributes.cpp:0:0
#17 0x000055de56117403 llvm::AAAlign const* llvm::Attributor::getOrCreateAAFor<llvm::AAAlign>(llvm::IRPosition, llvm::AbstractAttribute const*, llvm::DepClassTy, bool, bool) (/home/dhchakra/git/aomp-trunk/llvm-project/build/bin/opt+0x1b9a403)
#18 0x000055de56182c6b (anonymous namespace)::AAAlignCallSiteArgument::updateImpl(llvm::Attributor&) AttributorAttributes.cpp:0:0
#19 0x000055de560eea1a llvm::AbstractAttribute::update(llvm::Attributor&) (/home/dhchakra/git/aomp-trunk/llvm-project/build/bin/opt+0x1b71a1a)
#20 0x000055de56101edb llvm::Attributor::updateAA(llvm::AbstractAttribute&) (/home/dhchakra/git/aomp-trunk/llvm-project/build/bin/opt+0x1b84edb)
#21 0x000055de561175e5 llvm::AAAlign const* llvm::Attributor::getOrCreateAAFor<llvm::AAAlign>(llvm::IRPosition, llvm::AbstractAttribute const*, llvm::DepClassTy, bool, bool) (/home/dhchakra/git/aomp-trunk/llvm-project/build/bin/opt+0x1b9a5e5)
#22 0x000055de56181ff1 void (anonymous namespace)::followUsesInContext<(anonymous namespace)::AAAlignImpl, llvm::IncIntegerState<unsigned long, 4294967296ul, 1ul>>((anonymous namespace)::AAAlignImpl&, llvm::Attributor&, llvm::MustBeExecutedContextExplorer&, llvm::Instruction const*, llvm::SetVector<llvm::Use const*, std::vector<llvm::Use const*, std::allocator<llvm::Use const*>>, llvm::DenseSet<llvm::Use const*, llvm::DenseMapInfo<llvm::Use const*, void>>, 0u>&, llvm::IncIntegerState<unsigned long, 4294967296ul, 1ul>&) AttributorAttributes.cpp:0:0
#23 0x000055de56182619 (anonymous namespace)::AAAlignImpl::initialize(llvm::Attributor&) AttributorAttributes.cpp:0:0
#24 0x000055de56117403 llvm::AAAlign const* llvm::Attributor::getOrCreateAAFor<llvm::AAAlign>(llvm::IRPosition, llvm::AbstractAttribute const*, llvm::DepClassTy, bool, bool) (/home/dhchakra/git/aomp-trunk/llvm-project/build/bin/opt+0x1b9a403)
#25 0x000055de561197cd llvm::Attributor::identifyDefaultAbstractAttributes(llvm::Function&) (/home/dhchakra/git/aomp-trunk/llvm-project/build/bin/opt+0x1b9c7cd)
#26 0x000055de5611eaf7 runAttributorOnFunctions(llvm::InformationCache&, llvm::SetVector<llvm::Function*, std::vector<llvm::Function*, std::allocator<llvm::Function*>>, llvm::DenseSet<llvm::Function*, llvm::DenseMapInfo<llvm::Function*, void>>, 0u>&, llvm::AnalysisGetter&, llvm::CallGraphUpdater&, bool, bool) (.constprop.0) Attributor.cpp:0:0
#27 0x000055de5611fe7c llvm::AttributorPass::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) (/home/dhchakra/git/aomp-trunk/llvm-project/build/bin/opt+0x1ba2e7c)
#28 0x000055de56959866 llvm::detail::PassModel<llvm::Module, llvm::AttributorPass, llvm::PreservedAnalyses, llvm::AnalysisManager<llvm::Module>>::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) (/home/dhchakra/git/aomp-trunk/llvm-project/build/bin/opt+0x23dc866)
#29 0x000055de56081e4d llvm::PassManager<llvm::Module, llvm::AnalysisManager<llvm::Module>>::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) (/home/dhchakra/git/aomp-trunk/llvm-project/build/bin/opt+0x1b04e4d)
#30 0x000055de54bc5ab5 llvm::runPassPipeline(llvm::StringRef, llvm::Module&, llvm::TargetMachine*, llvm::TargetLibraryInfoImpl*, llvm::ToolOutputFile*, llvm::ToolOutputFile*, llvm::ToolOutputFile*, llvm::StringRef, llvm::ArrayRef<llvm::PassPlugin>, llvm::opt_tool::OutputKind, llvm::opt_tool::VerifierKind, bool, bool, bool, bool, bool, bool) (/home/dhchakra/git/aomp-trunk/llvm-project/build/bin/opt+0x648ab5)
#31 0x000055de54b1c233 main (/home/dhchakra/git/aomp-trunk/llvm-project/build/bin/opt+0x59f233)
#32 0x00007ff84ed97083 __libc_start_main /build/glibc-SzIz7B/glibc-2.31/csu/../csu/libc-start.c:342:3
#33 0x000055de54bb903e _start (/home/dhchakra/git/aomp-trunk/llvm-project/build/bin/opt+0x63c03e)
Aborted (core dumped)

test.bc.gz

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions