Skip to content

nontrivial SimpleLoopUnswitch crashes on partial unswitch assertion  #58666

@yrouban

Description

@yrouban

I found an IR that causes SimpleLoopUnswitch to crash as follows:

$ opt -passes=simple-loop-unswitch'<nontrivial>' simple-loop-unswitch-crash.ll --disable-output
opt: /home/yrouban/work/llvm-project/llvm/lib/Transforms/Scalar/SimpleLoopUnswitch.cpp:2113: void unswitchNontrivialInvariants(llvm::Loop&, llvm::Instruction&,
llvm::ArrayRef<llvm::Value*>, llvm::IVConditionInfo&, llvm::DominatorTree&, llvm::LoopInfo&, llvm::AssumptionCache&, llvm::function_ref<void(bool, bool, llvm::A
rrayRef<llvm::Loop*>)>, llvm::ScalarEvolution*, llvm::MemorySSAUpdater*, llvm::function_ref<void(llvm::Loop&, llvm::StringRef)>): Assertion `((match(Cond, m_Log
icalAnd()) ^ match(Cond, m_LogicalOr())) || PartiallyInvariant) && "Only `or`, `and`, an `select`, partially invariant instructions " "can combine invariants be
ing unswitched."' failed.

simple-loop-unswitch-crash.ll.txt

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions