<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 - A/F: `(UserVF || isPowerOf2_32(MaxVF)) && "MaxVF must be a power of 2"' failed"
   href="https://bugs.llvm.org/show_bug.cgi?id=46139">46139</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>A/F: `(UserVF || isPowerOf2_32(MaxVF)) && "MaxVF must be a power of 2"' failed
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>new-bugs
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Windows NT
          </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>new bugs
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>douglas_yung@playstation.sony.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>htmldeveloper@gmail.com, llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>After upstream change 840450549c9199150cbdee29acef756c19660ca1, the compiler
started hitting the assertion failure added in that commit when compiling one
of our internal tests. The assertion that is hit is:

clang-11:
/home/dyung/src/upstream/llvm_clean_git/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp:5011:
llvm::Optional<unsigned int>
llvm::LoopVectorizationCostModel::computeMaxVF(unsigned int, unsigned int):
Assertion `(UserVF || isPowerOf2_32(MaxVF)) && "MaxVF must be a power of 2"'
failed.

To reproduce, compile the following code with "clang-c -O2 -mavx test.c"

/* test.c */
long double table [] = {
  0.0L,
};
long double
foo(long double x, long int n)
{
  for (; n < 0; n++) {
    x /= 2;
  }
  for (; n > 0; n--) {
    x *= 2;
  }
  return x;
}
int main()
{
  long int j;

  for (j = 0; j < 8; j++) {
    if( 0.0L == foo(table[0], j)) { return 1; }
  }

  return 0;
}
/* test.c */

When compiled with a compiler built from
02f6f1ebb1f16e7e324df5201ce7003a4d9f2570, the assertion failure happens and
gives the following stack trace:

clang-11:
/home/dyung/src/upstream/llvm_clean_git/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp:5011:
llvm::Optional<unsigned int>
llvm::LoopVectorizationCostModel::computeMaxVF(unsigned int, unsigned int):
Assertion `(UserVF || isPowerOf2_32(MaxVF)) && "MaxVF must be a power of 2"'
failed.
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:
/home/dyung/src/upstream/02f6f1ebb1f16e7e324df5201ce7003a4d9f2570-linux/bin/clang-11
-c -O2 -mavx test3a.c 
1.      <eof> parser at end of file
2.      Per-module optimization passes
3.      Running pass 'Function Pass Manager' on module 'test3a.c'.
4.      Running pass 'Loop Vectorization' on function '@main'
 #0 0x000055945c01f27e llvm::sys::PrintStackTrace(llvm::raw_ostream&)
(/home/dyung/src/upstream/02f6f1ebb1f16e7e324df5201ce7003a4d9f2570-linux/bin/clang-11+0x59e627e)
 #1 0x000055945c01cfd4 llvm::sys::RunSignalHandlers()
(/home/dyung/src/upstream/02f6f1ebb1f16e7e324df5201ce7003a4d9f2570-linux/bin/clang-11+0x59e3fd4)
 #2 0x000055945c01d251 llvm::sys::CleanupOnSignal(unsigned long)
(/home/dyung/src/upstream/02f6f1ebb1f16e7e324df5201ce7003a4d9f2570-linux/bin/clang-11+0x59e4251)
 #3 0x000055945bf83f88 CrashRecoverySignalHandler(int)
(/home/dyung/src/upstream/02f6f1ebb1f16e7e324df5201ce7003a4d9f2570-linux/bin/clang-11+0x594af88)
 #4 0x00007f170fbd53c0 __restore_rt
(/lib/x86_64-linux-gnu/libpthread.so.0+0x153c0)
 #5 0x00007f170e0f118b raise
/build/glibc-YYA7BZ/glibc-2.31/signal/../sysdeps/unix/sysv/linux/raise.c:51:1
 #6 0x00007f170e0d0859 abort /build/glibc-YYA7BZ/glibc-2.31/stdlib/abort.c:81:7
 #7 0x00007f170e0d0729 get_sysdep_segment_value
/build/glibc-YYA7BZ/glibc-2.31/intl/loadmsgcat.c:509:8
 #8 0x00007f170e0d0729 _nl_load_domain
/build/glibc-YYA7BZ/glibc-2.31/intl/loadmsgcat.c:970:34
 #9 0x00007f170e0e1f36 (/lib/x86_64-linux-gnu/libc.so.6+0x36f36)
#10 0x000055945c1efb4b llvm::LoopVectorizationCostModel::computeMaxVF(unsigned
int, unsigned int)
(/home/dyung/src/upstream/02f6f1ebb1f16e7e324df5201ce7003a4d9f2570-linux/bin/clang-11+0x5bb6b4b)
#11 0x000055945c1efe54 llvm::LoopVectorizationPlanner::plan(unsigned int,
unsigned int)
(/home/dyung/src/upstream/02f6f1ebb1f16e7e324df5201ce7003a4d9f2570-linux/bin/clang-11+0x5bb6e54)
#12 0x000055945c1f281e llvm::LoopVectorizePass::processLoop(llvm::Loop*)
(/home/dyung/src/upstream/02f6f1ebb1f16e7e324df5201ce7003a4d9f2570-linux/bin/clang-11+0x5bb981e)
#13 0x000055945c1f5120 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*)
(/home/dyung/src/upstream/02f6f1ebb1f16e7e324df5201ce7003a4d9f2570-linux/bin/clang-11+0x5bbc120)
#14 0x000055945c1f55b7 (anonymous
namespace)::LoopVectorize::runOnFunction(llvm::Function&)
(/home/dyung/src/upstream/02f6f1ebb1f16e7e324df5201ce7003a4d9f2570-linux/bin/clang-11+0x5bbc5b7)
#15 0x000055945b834a2c llvm::FPPassManager::runOnFunction(llvm::Function&)
(/home/dyung/src/upstream/02f6f1ebb1f16e7e324df5201ce7003a4d9f2570-linux/bin/clang-11+0x51fba2c)
#16 0x000055945b8350d9 llvm::FPPassManager::runOnModule(llvm::Module&)
(/home/dyung/src/upstream/02f6f1ebb1f16e7e324df5201ce7003a4d9f2570-linux/bin/clang-11+0x51fc0d9)
#17 0x000055945b835487 llvm::legacy::PassManagerImpl::run(llvm::Module&)
(/home/dyung/src/upstream/02f6f1ebb1f16e7e324df5201ce7003a4d9f2570-linux/bin/clang-11+0x51fc487)
#18 0x000055945c75a86c 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> >)
(/home/dyung/src/upstream/02f6f1ebb1f16e7e324df5201ce7003a4d9f2570-linux/bin/clang-11+0x612186c)
#19 0x000055945cb46ea9
clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&)
(/home/dyung/src/upstream/02f6f1ebb1f16e7e324df5201ce7003a4d9f2570-linux/bin/clang-11+0x650dea9)
#20 0x000055945dd62669 clang::ParseAST(clang::Sema&, bool, bool)
(/home/dyung/src/upstream/02f6f1ebb1f16e7e324df5201ce7003a4d9f2570-linux/bin/clang-11+0x7729669)
#21 0x000055945cb45918 clang::CodeGenAction::ExecuteAction()
(/home/dyung/src/upstream/02f6f1ebb1f16e7e324df5201ce7003a4d9f2570-linux/bin/clang-11+0x650c918)
#22 0x000055945ca3b389 clang::FrontendAction::Execute()
(/home/dyung/src/upstream/02f6f1ebb1f16e7e324df5201ce7003a4d9f2570-linux/bin/clang-11+0x6402389)
#23 0x000055945c99773e
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&)
(/home/dyung/src/upstream/02f6f1ebb1f16e7e324df5201ce7003a4d9f2570-linux/bin/clang-11+0x635e73e)
#24 0x000055945cb10403
clang::ExecuteCompilerInvocation(clang::CompilerInstance*)
(/home/dyung/src/upstream/02f6f1ebb1f16e7e324df5201ce7003a4d9f2570-linux/bin/clang-11+0x64d7403)
#25 0x0000559459d454af cc1_main(llvm::ArrayRef<char const*>, char const*,
void*)
(/home/dyung/src/upstream/02f6f1ebb1f16e7e324df5201ce7003a4d9f2570-linux/bin/clang-11+0x370c4af)
#26 0x0000559459d3f2f8 ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&)
(/home/dyung/src/upstream/02f6f1ebb1f16e7e324df5201ce7003a4d9f2570-linux/bin/clang-11+0x37062f8)
#27 0x000055945c8595d9 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::'lambda'()>(long)
(/home/dyung/src/upstream/02f6f1ebb1f16e7e324df5201ce7003a4d9f2570-linux/bin/clang-11+0x62205d9)
#28 0x000055945bf8410c
llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>)
(/home/dyung/src/upstream/02f6f1ebb1f16e7e324df5201ce7003a4d9f2570-linux/bin/clang-11+0x594b10c)
#29 0x000055945c85a096
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 (.part.0)
(/home/dyung/src/upstream/02f6f1ebb1f16e7e324df5201ce7003a4d9f2570-linux/bin/clang-11+0x6221096)
#30 0x000055945c83003c
clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&,
clang::driver::Command const*&) const
(/home/dyung/src/upstream/02f6f1ebb1f16e7e324df5201ce7003a4d9f2570-linux/bin/clang-11+0x61f703c)
#31 0x000055945c830976
clang::driver::Compilation::ExecuteJobs(clang::driver::JobList const&,
llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*> >&) const
(/home/dyung/src/upstream/02f6f1ebb1f16e7e324df5201ce7003a4d9f2570-linux/bin/clang-11+0x61f7976)
#32 0x000055945c839c29
clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&,
llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*> >&)
(/home/dyung/src/upstream/02f6f1ebb1f16e7e324df5201ce7003a4d9f2570-linux/bin/clang-11+0x6200c29)
#33 0x0000559459d42989 main
(/home/dyung/src/upstream/02f6f1ebb1f16e7e324df5201ce7003a4d9f2570-linux/bin/clang-11+0x3709989)
#34 0x00007f170e0d20b3 __libc_start_main
/build/glibc-YYA7BZ/glibc-2.31/csu/../csu/libc-start.c:342:3
#35 0x0000559459d3ee4e _start
(/home/dyung/src/upstream/02f6f1ebb1f16e7e324df5201ce7003a4d9f2570-linux/bin/clang-11+0x3705e4e)
clang-11: error: clang frontend command failed due to signal (use -v to see
invocation)
clang version 11.0.0 (<a href="https://github.com/llvm/llvm-project.git">https://github.com/llvm/llvm-project.git</a>
02f6f1ebb1f16e7e324df5201ce7003a4d9f2570)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir:
/home/dyung/src/upstream/02f6f1ebb1f16e7e324df5201ce7003a4d9f2570-linux/bin</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>