[llvm-bugs] [Bug 49394] New: [Attributor] Assertion fails by division by zero
via llvm-bugs
llvm-bugs at lists.llvm.org
Tue Mar 2 02:59:22 PST 2021
https://bugs.llvm.org/show_bug.cgi?id=49394
Bug ID: 49394
Summary: [Attributor] Assertion fails by division by zero
Product: tools
Version: trunk
Hardware: PC
OS: Linux
Status: NEW
Severity: enhancement
Priority: P
Component: opt
Assignee: unassignedbugs at nondot.org
Reporter: konndennsa at gmail.com
CC: llvm-bugs at lists.llvm.org
Hello,
I found an assertion fails when running 'attributor' pass with a particular
input like:
********
source_filename = "crash.ll"
define void @f() {
BB:
%B = udiv i8 127, 0
%C1 = icmp uge i8 127, %B
%A = alloca i1, align 1
%L1 = load i1, i1* %A, align 1
store i1 %C1, i1* %A, align 1
%G = getelementptr i1, i1* %A, i8 %B
%G1 = getelementptr i1, i1* %G, i8 %B
%B2 = sdiv i1 %C1, false
%L = load i1, i1* %G, align 1
%B4 = mul i1 %L1, %B2
%B1 = urem i1 %B4, %C1
ret void
}
*******
Following is the backtrace:
*******
WARNING: You're attempting to print out a bitcode file.
This is inadvisable as it may cause display problems. If
you REALLY want to taste LLVM bitcode first-hand, you
can force output with the `-f' option.
opt: /home/test/work/llvm-project/llvm/lib/Support/APInt.cpp:1605: llvm::APInt
llvm::APInt::udiv(const llvm::APInt &) const: Assertion `RHS.U.VAL != 0 &&
"Divide by zero?"' failed.
PLEASE submit a bug report to https://bugs.llvm.org/ and include the crash
backtrace.
Stack dump:
0. Program arguments: ./bin/opt -attributor crash.ll
#0 0x0000000004db207b backtrace (./bin/opt+0x4db207b)
#1 0x000000000dbea3b8 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int)
/home/test/work/llvm-project/llvm/lib/Support/Unix/Signals.inc:565:13
#2 0x000000000dbe1ac0 llvm::sys::RunSignalHandlers()
/home/test/work/llvm-project/llvm/lib/Support/Signals.cpp:0:5
#3 0x000000000dbeb6af SignalHandler(int)
/home/test/work/llvm-project/llvm/lib/Support/Unix/Signals.inc:0:3
#4 0x00007f024a0f13c0 __restore_rt
(/lib/x86_64-linux-gnu/libpthread.so.0+0x153c0)
#5 0x00007f0249b8618b raise
/build/glibc-eX1tMB/glibc-2.31/signal/../sysdeps/unix/sysv/linux/raise.c:51:1
#6 0x00007f0249b65859 abort /build/glibc-eX1tMB/glibc-2.31/stdlib/abort.c:81:7
#7 0x00007f0249b65729 get_sysdep_segment_value
/build/glibc-eX1tMB/glibc-2.31/intl/loadmsgcat.c:509:8
#8 0x00007f0249b65729 _nl_load_domain
/build/glibc-eX1tMB/glibc-2.31/intl/loadmsgcat.c:970:34
#9 0x00007f0249b76f36 (/lib/x86_64-linux-gnu/libc.so.6+0x36f36)
#10 0x000000000d8e2d4d llvm::APInt::udiv(llvm::APInt const&) const
/home/test/work/llvm-project/llvm/lib/Support/APInt.cpp:1606:30
#11 0x000000000d8fa1b5 llvm::APInt::sdiv(llvm::APInt const&) const
/home/test/work/llvm-project/llvm/lib/Support/APInt.cpp:0:25
#12 0x000000000b78315d llvm::ConstantRange::sdiv(llvm::ConstantRange const&)
const /home/test/work/llvm-project/llvm/lib/IR/ConstantRange.cpp:1147:28
#13 0x000000000b77a7d7
llvm::ConstantRange::binaryOp(llvm::Instruction::BinaryOps, llvm::ConstantRange
const&) const /home/test/work/llvm-project/llvm/lib/IR/ConstantRange.cpp:0:12
#14 0x0000000009c3934d std::_Function_handler<llvm::ConstantRange
(llvm::ConstantRange const&, llvm::ConstantRange const&), (anonymous
namespace)::LazyValueInfoImpl::solveBlockValueBinaryOp(llvm::BinaryOperator*,
llvm::BasicBlock*)::$_2>::_M_invoke(std::_Any_data const&, llvm::ConstantRange
const&, llvm::ConstantRange const&)
/usr/bin/../lib/gcc/x86_64-linux-gnu/9/../../../../include/c++/9/bits/std_function.h:285:2
#15 0x0000000009c3884d (anonymous
namespace)::LazyValueInfoImpl::solveBlockValueBinaryOpImpl(llvm::Instruction*,
llvm::BasicBlock*, std::function<llvm::ConstantRange (llvm::ConstantRange
const&, llvm::ConstantRange const&)>)
/home/test/work/llvm-project/llvm/lib/Analysis/LazyValueInfo.cpp:998:10
#16 0x0000000009c1d1ca ~_Function_base
/usr/bin/../lib/gcc/x86_64-linux-gnu/9/../../../../include/c++/9/bits/std_function.h:259:11
#17 0x0000000009c1d1ca solveBlockValueBinaryOp
/home/test/work/llvm-project/llvm/lib/Analysis/LazyValueInfo.cpp:1026:3
#18 0x0000000009c1d1ca (anonymous
namespace)::LazyValueInfoImpl::solveBlockValueImpl(llvm::Value*,
llvm::BasicBlock*)
/home/test/work/llvm-project/llvm/lib/Analysis/LazyValueInfo.cpp:617:14
#19 0x0000000009bff2c8 solveBlockValue
/home/test/work/llvm-project/llvm/lib/Analysis/LazyValueInfo.cpp:0:39
#20 0x0000000009bff2c8 (anonymous namespace)::LazyValueInfoImpl::solve()
/home/test/work/llvm-project/llvm/lib/Analysis/LazyValueInfo.cpp:515:9
#21 0x0000000009bed47e (anonymous
namespace)::LazyValueInfoImpl::getValueInBlock(llvm::Value*, llvm::BasicBlock*,
llvm::Instruction*)
/home/test/work/llvm-project/llvm/lib/Analysis/LazyValueInfo.cpp:1471:17
#22 0x0000000009bee735 isUnknown
/home/test/work/llvm-project/llvm/include/llvm/Analysis/ValueLattice.h:239:35
#23 0x0000000009bee735 llvm::LazyValueInfo::getConstantRange(llvm::Value*,
llvm::Instruction*, bool)
/home/test/work/llvm-project/llvm/lib/Analysis/LazyValueInfo.cpp:1627:14
#24 0x000000000c013e83 (anonymous
namespace)::AAValueConstantRangeImpl::getConstantRangeFromLVI(llvm::Attributor&,
llvm::Instruction const*) const
/home/test/work/llvm-project/llvm/lib/Transforms/IPO/AttributorAttributes.cpp:6976:3
#25 0x000000000c0118c6 (anonymous
namespace)::AAValueConstantRangeImpl::initialize(llvm::Attributor&)
/home/test/work/llvm-project/llvm/lib/Transforms/IPO/AttributorAttributes.cpp:0:20
#26 0x000000000c009937 (anonymous
namespace)::AAValueConstantRangeFloating::initialize(llvm::Attributor&)
/home/test/work/llvm-project/llvm/lib/Transforms/IPO/AttributorAttributes.cpp:0:31
#27 0x000000000bf5ace6 llvm::AAValueConstantRange const&
llvm::Attributor::getOrCreateAAFor<llvm::AAValueConstantRange>(llvm::IRPosition
const&, llvm::AbstractAttribute const*, bool, llvm::DepClassTy, bool)
/home/test/work/llvm-project/llvm/include/llvm/Transforms/IPO/Attributor.h:0:10
#28 0x000000000c04e2c9 getAAFor<llvm::AAValueConstantRange>
/home/test/work/llvm-project/llvm/include/llvm/Transforms/IPO/Attributor.h:0:12
#29 0x000000000c04e2c9 askSimplifiedValueFor<llvm::AAValueConstantRange>
/home/test/work/llvm-project/llvm/lib/Transforms/IPO/AttributorAttributes.cpp:4559:11
#30 0x000000000c04e2c9 (anonymous
namespace)::AAValueSimplifyImpl::askSimplifiedValueForOtherAAs(llvm::Attributor&)
/home/test/work/llvm-project/llvm/lib/Transforms/IPO/AttributorAttributes.cpp:4577:9
#31 0x000000000c04d484 (anonymous
namespace)::AAValueSimplifyFloating::updateImpl(llvm::Attributor&)
/home/test/work/llvm-project/llvm/lib/Transforms/IPO/AttributorAttributes.cpp:4872:11
#32 0x000000000bedb3f2 llvm::AbstractAttribute::update(llvm::Attributor&)
/home/test/work/llvm-project/llvm/lib/Transforms/IPO/Attributor.cpp:260:16
#33 0x000000000bef79b4 llvm::Attributor::updateAA(llvm::AbstractAttribute&)
/home/test/work/llvm-project/llvm/lib/Transforms/IPO/Attributor.cpp:0:13
#34 0x000000000bf22bb7 llvm::AAValueSimplify const&
llvm::Attributor::getOrCreateAAFor<llvm::AAValueSimplify>(llvm::IRPosition
const&, llvm::AbstractAttribute const*, bool, llvm::DepClassTy, bool)
/home/test/work/llvm-project/llvm/include/llvm/Transforms/IPO/Attributor.h:1157:11
#35 0x000000000bee41e4 getAAFor<llvm::AAValueSimplify>
/home/test/work/llvm-project/llvm/include/llvm/Transforms/IPO/Attributor.h:1060:12
#36 0x000000000bee41e4 llvm::Attributor::getAssumedConstant(llvm::Value const&,
llvm::AbstractAttribute const&, bool&)
/home/test/work/llvm-project/llvm/lib/Transforms/IPO/Attributor.cpp:538:33
#37 0x000000000bee8927
llvm::Attributor::checkForAllUses(llvm::function_ref<bool (llvm::Use const&,
bool&)>, llvm::AbstractAttribute const&, llvm::Value const&, llvm::DepClassTy)
/home/test/work/llvm-project/llvm/lib/Transforms/IPO/Attributor.cpp:698:7
#38 0x000000000c06780b areAllUsesAssumedDead
/home/test/work/llvm-project/llvm/lib/Transforms/IPO/AttributorAttributes.cpp:2796:3
#39 0x000000000c06780b (anonymous
namespace)::AAIsDeadFloating::updateImpl(llvm::Attributor&)
/home/test/work/llvm-project/llvm/lib/Transforms/IPO/AttributorAttributes.cpp:2848:10
#40 0x000000000bedb3f2 llvm::AbstractAttribute::update(llvm::Attributor&)
/home/test/work/llvm-project/llvm/lib/Transforms/IPO/Attributor.cpp:260:16
#41 0x000000000bef79b4 llvm::Attributor::updateAA(llvm::AbstractAttribute&)
/home/test/work/llvm-project/llvm/lib/Transforms/IPO/Attributor.cpp:0:13
#42 0x000000000bee8107 llvm::AAIsDead const&
llvm::Attributor::getOrCreateAAFor<llvm::AAIsDead>(llvm::IRPosition const&,
llvm::AbstractAttribute const*, bool, llvm::DepClassTy, bool)
/home/test/work/llvm-project/llvm/include/llvm/Transforms/IPO/Attributor.h:1157:11
#43 0x000000000bee5eb5 llvm::Attributor::isAssumedDead(llvm::IRPosition const&,
llvm::AbstractAttribute const*, llvm::AAIsDead const*, bool, llvm::DepClassTy)
/home/test/work/llvm-project/llvm/lib/Transforms/IPO/Attributor.cpp:669:17
#44 0x000000000bee64cd llvm::Attributor::isAssumedDead(llvm::Use const&,
llvm::AbstractAttribute const*, llvm::AAIsDead const*, bool, llvm::DepClassTy)
/home/test/work/llvm-project/llvm/lib/Transforms/IPO/Attributor.cpp:608:3
#45 0x000000000bee96d7
llvm::Attributor::checkForAllUses(llvm::function_ref<bool (llvm::Use const&,
bool&)>, llvm::AbstractAttribute const&, llvm::Value const&, llvm::DepClassTy)
/home/test/work/llvm-project/llvm/lib/Transforms/IPO/Attributor.cpp:727:9
#46 0x000000000c06780b areAllUsesAssumedDead
/home/test/work/llvm-project/llvm/lib/Transforms/IPO/AttributorAttributes.cpp:2796:3
#47 0x000000000c06780b (anonymous
namespace)::AAIsDeadFloating::updateImpl(llvm::Attributor&)
/home/test/work/llvm-project/llvm/lib/Transforms/IPO/AttributorAttributes.cpp:2848:10
#48 0x000000000bedb3f2 llvm::AbstractAttribute::update(llvm::Attributor&)
/home/test/work/llvm-project/llvm/lib/Transforms/IPO/Attributor.cpp:260:16
#49 0x000000000bef79b4 llvm::Attributor::updateAA(llvm::AbstractAttribute&)
/home/test/work/llvm-project/llvm/lib/Transforms/IPO/Attributor.cpp:0:13
#50 0x000000000bee8107 llvm::AAIsDead const&
llvm::Attributor::getOrCreateAAFor<llvm::AAIsDead>(llvm::IRPosition const&,
llvm::AbstractAttribute const*, bool, llvm::DepClassTy, bool)
/home/test/work/llvm-project/llvm/include/llvm/Transforms/IPO/Attributor.h:1157:11
#51 0x000000000bee5eb5 llvm::Attributor::isAssumedDead(llvm::IRPosition const&,
llvm::AbstractAttribute const*, llvm::AAIsDead const*, bool, llvm::DepClassTy)
/home/test/work/llvm-project/llvm/lib/Transforms/IPO/Attributor.cpp:669:17
#52 0x000000000bef0426
llvm::Attributor::checkForAllReadWriteInstructions(llvm::function_ref<bool
(llvm::Instruction&)>, llvm::AbstractAttribute&)
/home/test/work/llvm-project/llvm/lib/Transforms/IPO/Attributor.cpp:963:9
#53 0x000000000bf7b28a (anonymous
namespace)::AANoSyncImpl::updateImpl(llvm::Attributor&)
/home/test/work/llvm-project/llvm/lib/Transforms/IPO/AttributorAttributes.cpp:1369:72
#54 0x000000000bedb3f2 llvm::AbstractAttribute::update(llvm::Attributor&)
/home/test/work/llvm-project/llvm/lib/Transforms/IPO/Attributor.cpp:260:16
#55 0x000000000bef79b4 llvm::Attributor::updateAA(llvm::AbstractAttribute&)
/home/test/work/llvm-project/llvm/lib/Transforms/IPO/Attributor.cpp:0:13
#56 0x000000000bf172b7 llvm::AANoSync const&
llvm::Attributor::getOrCreateAAFor<llvm::AANoSync>(llvm::IRPosition const&,
llvm::AbstractAttribute const*, bool, llvm::DepClassTy, bool)
/home/test/work/llvm-project/llvm/include/llvm/Transforms/IPO/Attributor.h:1157:11
#57 0x000000000bf104df
llvm::Attributor::identifyDefaultAbstractAttributes(llvm::Function&)
/home/test/work/llvm-project/llvm/lib/Transforms/IPO/Attributor.cpp:2000:3
#58 0x000000000bf34918 operator++
/usr/bin/../lib/gcc/x86_64-linux-gnu/9/../../../../include/c++/9/bits/stl_iterator.h:829:2
#59 0x000000000bf34918 runAttributorOnFunctions(llvm::InformationCache&,
llvm::SetVector<llvm::Function*, std::vector<llvm::Function*,
std::allocator<llvm::Function*> >, llvm::DenseSet<llvm::Function*,
llvm::DenseMapInfo<llvm::Function*> > >&, llvm::AnalysisGetter&,
llvm::CallGraphUpdater&, bool)
/home/test/work/llvm-project/llvm/lib/Transforms/IPO/Attributor.cpp:2338:20
#60 0x000000000bf312ee llvm::AttributorPass::run(llvm::Module&,
llvm::AnalysisManager<llvm::Module>&)
/home/test/work/llvm-project/llvm/lib/Transforms/IPO/Attributor.cpp:2409:7
#61 0x000000000e608b0d llvm::detail::PassModel<llvm::Module,
llvm::AttributorPass, llvm::PreservedAnalyses,
llvm::AnalysisManager<llvm::Module> >::run(llvm::Module&,
llvm::AnalysisManager<llvm::Module>&)
/home/test/work/llvm-project/llvm/include/llvm/IR/PassManagerInternal.h:85:5
#62 0x000000000bc281fd llvm::PassManager<llvm::Module,
llvm::AnalysisManager<llvm::Module> >::run(llvm::Module&,
llvm::AnalysisManager<llvm::Module>&)
/home/test/work/llvm-project/llvm/include/llvm/IR/PassManager.h:0:21
#63 0x0000000004e384bd isSmall
/home/test/work/llvm-project/llvm/include/llvm/ADT/SmallPtrSet.h:194:33
#64 0x0000000004e384bd ~SmallPtrSetImplBase
/home/test/work/llvm-project/llvm/include/llvm/ADT/SmallPtrSet.h:82:10
#65 0x0000000004e384bd ~PreservedAnalyses
/home/test/work/llvm-project/llvm/include/llvm/IR/PassManager.h:155:7
#66 0x0000000004e384bd llvm::runPassPipeline(llvm::StringRef, llvm::Module&,
llvm::TargetMachine*, llvm::TargetLibraryInfoImpl*, llvm::ToolOutputFile*,
llvm::ToolOutputFile*, llvm::ToolOutputFile*, llvm::StringRef,
llvm::ArrayRef<llvm::StringRef>, llvm::opt_tool::OutputKind,
llvm::opt_tool::VerifierKind, bool, bool, bool, bool, bool, bool)
/home/test/work/llvm-project/llvm/tools/opt/NewPMDriver.cpp:449:3
#67 0x0000000004e80c74 main
/home/test/work/llvm-project/llvm/tools/opt/opt.cpp:813:12
#68 0x00007f0249b670b3 __libc_start_main
/build/glibc-eX1tMB/glibc-2.31/csu/../csu/libc-start.c:342:3
#69 0x0000000004d7b05e _start (./bin/opt+0x4d7b05e)
*******
--
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20210302/1be76573/attachment-0001.html>
More information about the llvm-bugs
mailing list