<html>
<head>
<base href="https://bugs.llvm.org/">
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_NEW "
title="NEW - SLH assertion error: Should never have a PHI in the initial checking block as it always has a single predecessor!"
href="https://bugs.llvm.org/show_bug.cgi?id=44951">44951</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>SLH assertion error: Should never have a PHI in the initial checking block as it always has a single predecessor!
</td>
</tr>
<tr>
<th>Product</th>
<td>libraries
</td>
</tr>
<tr>
<th>Version</th>
<td>trunk
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>Linux
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>enhancement
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>Backend: X86
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>rupprecht@google.com
</td>
</tr>
<tr>
<th>CC</th>
<td>craig.topper@gmail.com, llvm-bugs@lists.llvm.org, llvm-dev@redking.me.uk, spatel+llvm@rotateright.com
</td>
</tr></table>
<p>
<div>
<pre>Created <span class=""><a href="attachment.cgi?id=23138" name="attach_23138" title="reproducer">attachment 23138</a> <a href="attachment.cgi?id=23138&action=edit" title="reproducer">[details]</a></span>
reproducer
IR reproducer (original input is a crash w/ -mspeculative-load-hardening
-fexperimental-new-pass-manager -O3):
$ cat repro.ll # Also attached to the bug
; ModuleID = 'repro.ll'
source_filename = "repro.cc"
target datalayout =
"e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"
@y = external dso_local global i8, align 1
@ap = external dso_local local_unnamed_addr global i32, align 4
; Function Attrs: speculative_load_hardening
define dso_local void @f1() local_unnamed_addr #0 {
entry:
%0 = load i32, i32* @ap, align 4
switch i32 %0, label %sw.epilog [
i32 0, label %sw.bb
i32 1, label %sw.bb1
i32 2, label %sw.bb4
i32 3, label %sw.bb7
]
sw.bb: ; preds = %entry
call void @f2(i8* nonnull undef, i8* null)
unreachable
sw.bb1: ; preds = %entry
call void @f2(i8* nonnull undef, i8* null)
unreachable
sw.bb4: ; preds = %entry
call void @f2(i8* nonnull undef, i8* nonnull @y)
br label %sw.bb7
sw.bb7: ; preds = %sw.bb4, %entry
ret void
sw.epilog: ; preds = %entry
unreachable
}
; Function Attrs: speculative_load_hardening
declare dso_local void @f2(i8*, i8*) unnamed_addr #0
; Function Attrs: speculative_load_hardening
define dso_local void @f3() local_unnamed_addr #0 {
for.body.lr.ph:
%call4 = call { i8*, i32 } @f4(i8* nonnull undef)
%0 = extractvalue { i8*, i32 } %call4, 0
%tobool.i.i = icmp eq i8* %0, null
br i1 %tobool.i.i, label %for.cond.cleanup9, label %for.body10.outer
for.body10.outer: ; preds = %if.then.i,
%for.body.lr.ph
%ph = phi i8* [ %add.ptr.i, %if.then.i ], [ undef, %for.body.lr.ph ]
br label %for.body10
for.cond.cleanup9: ; preds = %for.body.lr.ph
%call = call zeroext i1 @f6(i8* nonnull undef)
unreachable
for.body10: ; preds = %for.body10,
%for.body10.outer
call void @f1()
%call.i = call zeroext i1 @f7()
br i1 %call.i, label %if.then.i, label %for.body10
if.then.i: ; preds = %for.body10
call void @f2(i8* nonnull undef, i8* %ph)
%add.ptr.i = getelementptr inbounds i8, i8* %ph, i64 undef
br label %for.body10.outer
}
; Function Attrs: speculative_load_hardening
declare dso_local i1 @f6(i8*) local_unnamed_addr #0
; Function Attrs: speculative_load_hardening
declare dso_local { i8*, i32 } @f4(i8*) local_unnamed_addr #0
; Function Attrs: speculative_load_hardening
declare dso_local i1 @f7() local_unnamed_addr #0
attributes #0 = { speculative_load_hardening }
$ clang++ -O3 -fexperimental-new-pass-manager -c repro.ll
clang++: llvm-project/llvm/lib/Target/X86/X86SpeculativeLoadHardening.cpp:743:
auto (anonymous
namespace)::X86SpeculativeLoadHardeningPass::tracePredStateThroughCFG(llvm::MachineFunction
&, ArrayRef<(anonymous
namespace)::X86SpeculativeLoadHardeningPass::BlockCondInfo>)::(anonymous
class)::operator()(llvm::MachineBasicBlock &, llvm::MachineBasicBlock &, int,
llvm::MachineInstr *, llvm::MachineInstr *&, ArrayRef<X86::CondCode>) const:
Assertion `(InsertPt == CheckingMBB.end() || !InsertPt->isPHI()) && "Should
never have a PHI in the initial checking block as it " "always has a single
predecessor!"' failed.
Stack dump:
0. Program arguments: clang++ -O3 -fexperimental-new-pass-manager -c
repro.ll
1. Code generation
2. Running pass 'Function Pass Manager' on module 'repro.ll'.
3. Running pass 'X86 speculative load hardening' on function '@f3'
#0 0x0000000007f89b17 llvm::sys::PrintStackTrace(llvm::raw_ostream&)
llvm-project/llvm/lib/Support/Unix/Signals.inc:564:11
<...stack unwinder...>
#11 0x00000000068c3f43 (anonymous
namespace)::X86SpeculativeLoadHardeningPass::tracePredStateThroughCFG(llvm::MachineFunction&,
llvm::ArrayRef<(anonymous
namespace)::X86SpeculativeLoadHardeningPass::BlockCondInfo>)::$_5::operator()(llvm::MachineBasicBlock&,
llvm::MachineBasicBlock&, int, llvm::MachineInstr*, llvm::MachineInstr*&,
llvm::ArrayRef<llvm::X86::CondCode>) const
llvm-project/llvm/lib/Target/X86/X86SpeculativeLoadHardening.cpp:0:11
#12 0x00000000068c063d (anonymous
namespace)::X86SpeculativeLoadHardeningPass::tracePredStateThroughCFG(llvm::MachineFunction&,
llvm::ArrayRef<(anonymous
namespace)::X86SpeculativeLoadHardeningPass::BlockCondInfo>)
llvm-project/llvm/lib/Target/X86/X86SpeculativeLoadHardening.cpp:800:9
#13 0x00000000068bed7d (anonymous
namespace)::X86SpeculativeLoadHardeningPass::runOnMachineFunction(llvm::MachineFunction&)
llvm-project/llvm/lib/Target/X86/X86SpeculativeLoadHardening.cpp:507:16
#14 0x0000000006f546d7
llvm::MachineFunctionPass::runOnFunction(llvm::Function&)
llvm-project/llvm/lib/CodeGen/MachineFunctionPass.cpp:73:8
#15 0x0000000007487dcc llvm::FPPassManager::runOnFunction(llvm::Function&)
llvm-project/llvm/lib/IR/LegacyPassManager.cpp:1482:23
#16 0x00000000074881f5 llvm::FPPassManager::runOnModule(llvm::Module&)
llvm-project/llvm/lib/IR/LegacyPassManager.cpp:1518:16
#17 0x0000000007488974 (anonymous
namespace)::MPPassManager::runOnModule(llvm::Module&)
llvm-project/llvm/lib/IR/LegacyPassManager.cpp:1583:23
#18 0x0000000007488498 llvm::legacy::PassManagerImpl::run(llvm::Module&)
llvm-project/llvm/lib/IR/LegacyPassManager.cpp:1695:16
#19 0x0000000007488f11 llvm::legacy::PassManager::run(llvm::Module&)
llvm-project/llvm/lib/IR/LegacyPassManager.cpp:1726:3
#20 0x00000000082eb24d (anonymous
namespace)::EmitAssemblyHelper::EmitAssemblyWithNewPassManager(clang::BackendAction,
std::unique_ptr<llvm::raw_pwrite_stream,
std::default_delete<llvm::raw_pwrite_stream> >)
llvm-project/clang/lib/CodeGen/BackendUtil.cpp:1362:3
#21 0x00000000082e7f3d clang::EmitBackendOutput(clang::DiagnosticsEngine&,
clang::HeaderSearchOptions const&, clang::CodeGenOptions const&,
clang::TargetOptions const&, clang::LangOptions const&, llvm::DataLayout
const&, llvm::Module*, clang::BackendAction,
std::unique_ptr<llvm::raw_pwrite_stream,
std::default_delete<llvm::raw_pwrite_stream> >)
llvm-project/clang/lib/CodeGen/BackendUtil.cpp:1580:5</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are on the CC list for the bug.</li>
</ul>
</body>
</html>