<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 - Clang rGa8e50f1c6e7b crashes in LoopVectorizationPlanner::buildVPlanWithVPRecipes when building the arm64 Linux kernel"
   href="https://bugs.llvm.org/show_bug.cgi?id=48142">48142</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Clang rGa8e50f1c6e7b crashes in LoopVectorizationPlanner::buildVPlanWithVPRecipes when building the arm64 Linux kernel
          </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>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>Loop Optimizer
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>florian_hahn@apple.com
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>samitolvanen@google.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>david.green@arm.com, llvm-bugs@lists.llvm.org, ndesaulniers@google.com
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Starting with commit a8e50f1c6e7b404aab8fedb972f003a4d6a6434e ("[VPlan] Use
VPValue def for VPWidenSelectRecipe.") Clang crashes when building the arm64
Linux kernel:

PLEASE submit a bug report to <a href="https://bugs.llvm.org/">https://bugs.llvm.org/</a> and include the crash
backtrace, preprocessed source, and associated run script.
Stack dump:
0.      Program arguments:   CC      drivers/hwmon/hwmon.o
clang -Wp,-MMD,drivers/net/wireless/broadcom/brcm80211/brcmfmac/.cfg80211.o.d
-nostdinc -isystem unified-llvm/testbuild-release/lib/clang/12.0.0/include
-I../arch/arm64/include -I./arch/arm64/include/generated -I../include
-I./include -I../arch/arm64/include/uapi -I./arch/arm64/include/generated/uapi
-I../include/uapi -I./include/generated/uapi -include
../include/linux/kconfig.h -include ../include/linux/compiler_types.h
-D__KERNEL__ -mlittle-endian -DKASAN_SHADOW_SCALE_SHIFT=3 -Qunused-arguments
-Wall -Wundef -Werror=strict-prototypes -Wno-trigraphs -fno-strict-aliasing
-fno-common -fshort-wchar -fno-PIE -Werror=implicit-function-declaration
-Werror=implicit-int -Werror=return-type -Wno-format-security -std=gnu89
--target=aarch64-linux-gnu --prefix=/usr/bin/aarch64-linux-gnu-
--gcc-toolchain=/usr -Werror=unknown-warning-option -mgeneral-regs-only
-DCONFIG_CC_HAS_K_CONSTRAINT=1 -Wno-psabi -fno-asynchronous-unwind-tables
-fno-unwind-tables -mbranch-protection=pac-ret+leaf+bti -Wa,-march=armv8.4-a
-DARM64_ASM_ARCH="armv8.4-a" -DKASAN_SHADOW_SCALE_SHIFT=3
-fno-delete-null-pointer-checks -Wno-frame-address
-Wno-address-of-packed-member -O2 -Wframe-larger-than=2048
-fstack-protector-strong -Wno-format-invalid-specifier -Wno-gnu
-mno-global-merge -Wno-unused-const-variable -fno-omit-frame-pointer
-fno-optimize-sibling-calls -g -Wdeclaration-after-statement -Wvla
-Wno-pointer-sign -Wno-array-bounds -fno-strict-overflow -fno-stack-check
-Werror=date-time -Werror=incompatible-pointer-types -fmacro-prefix-map=../=
-Wno-initializer-overrides -Wno-format -Wno-sign-compare
-Wno-format-zero-length -Wno-pointer-to-enum-cast
-Wno-tautological-constant-out-of-range-compare -I
../drivers/net/wireless/broadcom/brcm80211/brcmfmac -I
../drivers/net/wireless/broadcom/brcm80211/brcmfmac/../include -I
../drivers/net/wireless/broadcom/brcm80211/brcmfmac -I
./drivers/net/wireless/broadcom/brcm80211/brcmfmac -DMODULE
-DKBUILD_BASENAME="cfg80211" -DKBUILD_MODNAME="brcmfmac" -c -o
drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.o
../drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c 
1.      <eof> parser at end of file
2.      Per-module optimization passes
3.      Running pass 'Function Pass Manager' on module
'../drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c'.
4.      Running pass 'Loop Vectorization' on function '@brcmf_cfg80211_attach'
 #0 0x0000000002ac62b3 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int)
(unified-llvm/testbuild-release/bin/clang-12+0x2ac62b3)
 #1 0x0000000002ac40ee llvm::sys::RunSignalHandlers()
(unified-llvm/testbuild-release/bin/clang-12+0x2ac40ee)
 #2 0x0000000002ac5724 llvm::sys::CleanupOnSignal(unsigned long)
(unified-llvm/testbuild-release/bin/clang-12+0x2ac5724)
 #3 0x0000000002a48de0 CrashRecoverySignalHandler(int)
(unified-llvm/testbuild-release/bin/clang-12+0x2a48de0)
 #4 0x00007fc8eea9e140 __restore_rt
(/lib/x86_64-linux-gnu/libpthread.so.0+0x14140)
 #5 0x0000000002c03ece
llvm::LoopVectorizationPlanner::buildVPlanWithVPRecipes(llvm::VFRange&,
llvm::SmallPtrSetImpl<llvm::Value*>&,
llvm::SmallPtrSetImpl<llvm::Instruction*>&, llvm::DenseMap<llvm::Instruction*,
llvm::Instruction*, llvm::DenseMapInfo<llvm::Instruction*>,
llvm::detail::DenseMapPair<llvm::Instruction*, llvm::Instruction*> > const&)
(unified-llvm/testbuild-release/bin/clang-12+0x2c03ece)
 #6 0x0000000002bfcfe5
llvm::LoopVectorizationPlanner::buildVPlansWithVPRecipes(llvm::ElementCount,
llvm::ElementCount) (unified-llvm/testbuild-release/bin/clang-12+0x2bfcfe5)
 #7 0x0000000002bfc619 llvm::LoopVectorizationPlanner::plan(llvm::ElementCount,
unsigned int) (unified-llvm/testbuild-release/bin/clang-12+0x2bfc619)
 #8 0x0000000002c07635 llvm::LoopVectorizePass::processLoop(llvm::Loop*)
(unified-llvm/testbuild-release/bin/clang-12+0x2c07635)
 #9 0x0000000002c0a237 llvm::LoopVectorizePass::runImpl(llvm::Function&,
llvm::ScalarEvolution&, llvm::LoopInfo&, llvm::TargetTransformInfo&,
llvm::DominatorTree&, llvm::BlockFrequencyInfo&, llvm::TargetLibraryInfo*,
llvm::DemandedBits&, llvm::AAResults&, llvm::AssumptionCache&,
std::function<llvm::LoopAccessInfo const& (llvm::Loop&)>&,
llvm::OptimizationRemarkEmitter&, llvm::ProfileSummaryInfo*)
(unified-llvm/testbuild-release/bin/clang-12+0x2c0a237)
#10 0x0000000002c0e9be (anonymous
namespace)::LoopVectorize::runOnFunction(llvm::Function&)
(unified-llvm/testbuild-release/bin/clang-12+0x2c0e9be)
#11 0x00000000024e9b56 llvm::FPPassManager::runOnFunction(llvm::Function&)
(unified-llvm/testbuild-release/bin/clang-12+0x24e9b56)
#12 0x00000000024ef623 llvm::FPPassManager::runOnModule(llvm::Module&)
(unified-llvm/testbuild-release/bin/clang-12+0x24ef623)
#13 0x00000000024ea18f llvm::legacy::PassManagerImpl::run(llvm::Module&)
(unified-llvm/testbuild-release/bin/clang-12+0x24ea18f)
#14 0x0000000002ca2690 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> >)
(unified-llvm/testbuild-release/bin/clang-12+0x2ca2690)
#15 0x0000000003460278
clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&)
(unified-llvm/testbuild-release/bin/clang-12+0x3460278)
#16 0x00000000042f2e73 clang::ParseAST(clang::Sema&, bool, bool)
(unified-llvm/testbuild-release/bin/clang-12+0x42f2e73)
#17 0x00000000033b813b clang::FrontendAction::Execute()
(unified-llvm/testbuild-release/bin/clang-12+0x33b813b)
#18 0x0000000003311631
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&)
(unified-llvm/testbuild-release/bin/clang-12+0x3311631)
#19 0x000000000345ae4a
clang::ExecuteCompilerInvocation(clang::CompilerInstance*)
(unified-llvm/testbuild-release/bin/clang-12+0x345ae4a)
#20 0x000000000182ee9d cc1_main(llvm::ArrayRef<char const*>, char const*,
void*) (unified-llvm/testbuild-release/bin/clang-12+0x182ee9d)
#21 0x000000000182d201 ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&)
(unified-llvm/testbuild-release/bin/clang-12+0x182d201)
#22 0x00000000031ced42 void llvm::function_ref<void
()>::callback_fn<clang::driver::CC1Command::Execute(llvm::ArrayRef<llvm::Optional<llvm::StringRef>
<span class="quote">>, std::__cxx11::basic_string<char, std::char_traits<char>,</span >
std::allocator<char> >*, bool*) const::$_1>(long)
(unified-llvm/testbuild-release/bin/clang-12+0x31ced42)
#23 0x0000000002a48bf7
llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>)
(unified-llvm/testbuild-release/bin/clang-12+0x2a48bf7)
#24 0x00000000031ce4a9
clang::driver::CC1Command::Execute(llvm::ArrayRef<llvm::Optional<llvm::StringRef>
<span class="quote">>, std::__cxx11::basic_string<char, std::char_traits<char>,</span >
std::allocator<char> >*, bool*) const
(unified-llvm/testbuild-release/bin/clang-12+0x31ce4a9)
#25 0x0000000003197474
clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&,
clang::driver::Command const*&) const
(unified-llvm/testbuild-release/bin/clang-12+0x3197474)
#26 0x0000000003197927
clang::driver::Compilation::ExecuteJobs(clang::driver::JobList const&,
llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*> >&) const
(unified-llvm/testbuild-release/bin/clang-12+0x3197927)
#27 0x00000000031b0078
clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&,
llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*> >&)
(unified-llvm/testbuild-release/bin/clang-12+0x31b0078)
#28 0x000000000182cb3d main
(unified-llvm/testbuild-release/bin/clang-12+0x182cb3d)
#29 0x00007fc8ee561cca __libc_start_main ./csu/../csu/libc-start.c:308:16
#30 0x000000000182a02a _start
(unified-llvm/testbuild-release/bin/clang-12+0x182a02a)
clang-12: error: clang frontend command failed with exit code 139 (use -v to
see invocation)
clang version 12.0.0 (unified-llvm/llvm-project/.git
a8e50f1c6e7b404aab8fedb972f003a4d6a6434e)
Target: aarch64-unknown-linux-gnu
Thread model: posix
InstalledDir: unified-llvm/testbuild-release/bin
clang-12: note: diagnostic msg: 
********************

PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
Preprocessed source(s) and associated run script(s) are located at:
clang-12: note: diagnostic msg: /tmp/cfg80211-ad10bb.c
clang-12: note: diagnostic msg: /tmp/cfg80211-ad10bb.sh
clang-12: note: diagnostic msg: 

********************

The preprocessed source is too large to attach here, even when compressed. I'm
working on reducing it and will post a test case when I have it.</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>