Skip to content

[LV] Crash in VPPartialReductionRecipe::computeCost #162902

@sjoerdmeijer

Description

@sjoerdmeijer

Compiling this:

char a, b;
char *c;
void d(bool e) {
  for (;;)
    for (int f; f < 2; f += e) {
      a = c[f];
      b += !f ?: e;
    }
}

with clang -O2 -mcpu=grace results in a crash with this backtrace:

 #4 0x0000000005837d75 llvm::VPPartialReductionRecipe::computeCost(llvm::ElementCount, llvm::VPCostContext&) const (/opt/compiler-explorer/clang-trunk/bin/clang+++0x5837d75)
 #5 0x0000000005841f46 llvm::VPRecipeBase::cost(llvm::ElementCount, llvm::VPCostContext&) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x5841f46)
 #6 0x0000000005807b57 llvm::VPBasicBlock::cost(llvm::ElementCount, llvm::VPCostContext&) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x5807b57)
 #7 0x000000000580e888 llvm::VPRegionBlock::cost(llvm::ElementCount, llvm::VPCostContext&) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x580e888)
 #8 0x000000000580f70d llvm::VPlan::cost(llvm::ElementCount, llvm::VPCostContext&) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x580f70d)
 #9 0x00000000056bdbda llvm::LoopVectorizationPlanner::cost(llvm::VPlan&, llvm::ElementCount) const (/opt/compiler-explorer/clang-trunk/bin/clang+++0x56bdbda)
#10 0x00000000056c443a llvm::LoopVectorizationPlanner::computeBestVF() (.part.0) LoopVectorize.cpp:0:0
#11 0x00000000056c537a llvm::LoopVectorizationPlanner::computeBestVF() (/opt/compiler-explorer/clang-trunk/bin/clang+++0x56c537a)
#12 0x00000000056ccee7 llvm::LoopVectorizePass::processLoop(llvm::Loop*) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x56ccee7)

See also: https://godbolt.org/z/njcnr58a4

Metadata

Metadata

Assignees

No one assigned

    Labels

    crashPrefer [crash-on-valid] or [crash-on-invalid]vectorizers

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions