[PATCH] D71539: [SCEV] Look through trivial PHIs.

Amy Huang via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 30 11:30:01 PDT 2021


akhuang added a comment.

Hi, I saw a similar crash in chrome windows pgo builds that was caused by this change

repro:

  $ cat bugpoint-reduced-simplified.ll
  ; ModuleID = 'bugpoint-reduced-simplified.bc'
  source_filename = "t.cpp"
  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"
  
  define dso_local void @_Z1tv() local_unnamed_addr {
  entry:
    br label %for.cond.i.i.preheader
  
  for.cond.i.i.preheader:                           ; preds = %"_ZN1gILm5EZ1tvE3$_0E1hppEv.exit", %entry
    %__begin1.sroa.3.021 = phi i8 [ %storemerge.i.lcssa, %"_ZN1gILm5EZ1tvE3$_0E1hppEv.exit" ], [ undef, %entry ]
    br label %for.cond.i.i
  
  for.cond.cleanup:                                 ; preds = %"_ZN1gILm5EZ1tvE3$_0E1hppEv.exit"
    ret void
  
  for.cond.i.i:                                     ; preds = %for.body.i.i, %for.cond.i.i.preheader
    %__begin1.sroa.3.1 = phi i8 [ %storemerge.i, %for.body.i.i ], [ %__begin1.sroa.3.021, %for.cond.i.i.preheader ]
    %storemerge.i = add i8 %__begin1.sroa.3.1, 1
    br i1 undef, label %"_ZN1gILm5EZ1tvE3$_0E1hppEv.exit", label %for.body.i.i
  
  for.body.i.i:                                     ; preds = %for.cond.i.i
    br i1 undef, label %"_ZN1gILm5EZ1tvE3$_0E1hppEv.exit", label %for.cond.i.i
  
  "_ZN1gILm5EZ1tvE3$_0E1hppEv.exit":                ; preds = %for.body.i.i, %for.cond.i.i
    %storemerge.i.lcssa = phi i8 [ %storemerge.i, %for.cond.i.i ], [ %storemerge.i, %for.body.i.i ]
    %tobool.i.not = icmp eq i8 %storemerge.i.lcssa, 0
    br i1 %tobool.i.not, label %for.cond.cleanup, label %for.cond.i.i.preheader
  }
  
  $ opt --passes='loop(indvars,loop-deletion)' --disable-output bugpoint-reduced-simplified.ll
  opt: ../llvm-project/llvm/include/llvm/Analysis/LoopInfo.h:123: bool llvm::LoopBase<llvm::BasicBlock, llvm::Loop>::contains(const LoopT *) const [BlockT = llvm::BasicBlock, LoopT = llvm::Loop]: Assertion `!isInvalid() && "Loop not in a valid state!"' failed.
  PLEASE submit a bug report to https://bugs.llvm.org/ and include the crash backtrace.
  Stack dump:
  0.	Program arguments: opt --passes=loop(indvars,loop-deletion) --disable-output bugpoint-reduced-simplified.ll
  [...]
  #10 0x0000000002c278db llvm::LoopBase<llvm::BasicBlock, llvm::Loop>::contains(llvm::Loop const*) const /usr/local/google/home/akhuang/llvm-build/../llvm-project/llvm/include/llvm/Analysis/LoopInfo.h:0:5
  #11 0x0000000002dae92c llvm::ScalarEvolution::computeSCEVAtScope(llvm::SCEV const*, llvm::Loop const*) /usr/local/google/home/akhuang/llvm-build/../llvm-project/llvm/lib/Analysis/ScalarEvolution.cpp:9046:9
  #12 0x0000000002da8bd0 llvm::ScalarEvolution::getSCEVAtScope(llvm::SCEV const*, llvm::Loop const*) /usr/local/google/home/akhuang/llvm-build/../llvm-project/llvm/lib/Analysis/ScalarEvolution.cpp:8733:19
  #13 0x0000000002da77c5 llvm::ScalarEvolution::computeExitLimitFromICmp(llvm::Loop const*, llvm::ICmpInst*, bool, bool, bool) /usr/local/google/home/akhuang/llvm-build/../llvm-project/llvm/lib/Analysis/ScalarEvolution.cpp:8059:9
  #14 0x0000000002da6cc5 llvm::ScalarEvolution::computeExitLimitFromCondImpl(llvm::ScalarEvolution::ExitLimitCache&, llvm::Loop const*, llvm::Value*, bool, bool, bool) /usr/local/google/home/akhuang/llvm-build/../llvm-project/llvm/lib/Analysis/ScalarEvolution.cpp:7918:12
  [...]


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D71539/new/

https://reviews.llvm.org/D71539



More information about the llvm-commits mailing list