| Issue |
64687
|
| Summary |
opt -O2 crash Assertion `(Value == 0 || llvm::isPowerOf2_64(Value)) && "Alignment is neither 0 nor a power of 2"' failed, but works under `instcombine`
|
| Labels |
new issue
|
| Assignees |
|
| Reporter |
Hatsunespica
|
Here is the link:
https://godbolt.org/z/M1ahz5KxY
Source code
```
declare void @llvm.assume(i1 noundef)
define i8 @assume_align_non_pow2(ptr %p) {
call void @llvm.assume(i1 true) [ "align"(ptr %p, i64 123) ]
%v = load i8, ptr %p
ret i8 %v
}
```
This test case comes from:
https://github.com/llvm/llvm-project/blob/main/llvm/test/Transforms/InstCombine/assume-align.ll
Is this crash an intentional behavior? I submitted this issue because this function doesn't trigger crashes under `instcombine`
Error message:
```
opt: /root/llvm-project/llvm/include/llvm/Support/Alignment.h:134: llvm::MaybeAlign::MaybeAlign(uint64_t): Assertion `(Value == 0 || llvm::isPowerOf2_64(Value)) && "Alignment is neither 0 nor a power of 2"' failed.
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
Stack dump:
0. Program arguments: /opt/compiler-explorer/clang-assertions-trunk/bin/opt -o /app/output.s -S -O2 <source>
#0 0x0000000003487758 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x3487758)
#1 0x000000000348504c SignalHandler(int) Signals.cpp:0:0
#2 0x00007f70155a6420 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x14420)
#3 0x00007f701506900b raise (/lib/x86_64-linux-gnu/libc.so.6+0x4300b)
#4 0x00007f7015048859 abort (/lib/x86_64-linux-gnu/libc.so.6+0x22859)
#5 0x00007f7015048729 (/lib/x86_64-linux-gnu/libc.so.6+0x22729)
#6 0x00007f7015059fd6 (/lib/x86_64-linux-gnu/libc.so.6+0x33fd6)
#7 0x00000000040c5187 getNewAlignmentDiff(llvm::SCEV const*, llvm::SCEV const*, llvm::ScalarEvolution*) AlignmentFromAssumptions.cpp:0:0
#8 0x00000000040c56f8 getNewAlignment(llvm::SCEV const*, llvm::SCEV const*, llvm::SCEV const*, llvm::Value*, llvm::ScalarEvolution*) AlignmentFromAssumptions.cpp:0:0
#9 0x00000000040c672c llvm::AlignmentFromAssumptionsPass::processAssumption(llvm::CallInst*, unsigned int) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x40c672c)
#10 0x00000000040c7a77 llvm::AlignmentFromAssumptionsPass::runImpl(llvm::Function&, llvm::AssumptionCache&, llvm::ScalarEvolution*, llvm::DominatorTree*) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x40c7a77)
#11 0x00000000040c7c21 llvm::AlignmentFromAssumptionsPass::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x40c7c21)
#12 0x000000000369c55e llvm::detail::PassModel<llvm::Function, llvm::AlignmentFromAssumptionsPass, llvm::PreservedAnalyses, llvm::AnalysisManager<llvm::Function>>::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x369c55e)
#13 0x0000000000d3fa9d llvm::detail::PassModel<llvm::Function, llvm::PassManager<llvm::Function, llvm::AnalysisManager<llvm::Function>>, llvm::PreservedAnalyses, llvm::AnalysisManager<llvm::Function>>::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0xd3fa9d)
#14 0x0000000002df4ade llvm::ModuleToFunctionPassAdaptor::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x2df4ade)
#15 0x0000000000d2459e llvm::detail::PassModel<llvm::Module, llvm::ModuleToFunctionPassAdaptor, llvm::PreservedAnalyses, llvm::AnalysisManager<llvm::Module>>::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0xd2459e)
#16 0x0000000002df2adc llvm::PassManager<llvm::Module, llvm::AnalysisManager<llvm::Module>>::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x2df2adc)
#17 0x0000000000887d2a 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, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x887d2a)
#18 0x000000000078e0c1 main (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x78e0c1)
#19 0x00007f701504a083 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x24083)
#20 0x000000000087cf6e _start (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x87cf6e)
Program terminated with signal: SIGSEGV
Compiler returned: 139
```
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs