[CodegenPrepare] Guard against degenerate branches
authorValentin Churavy <v.churavy@gmail.com>
Sat, 14 Dec 2019 15:33:30 +0000 (10:33 -0500)
committerValentin Churavy <v.churavy@gmail.com>
Mon, 16 Dec 2019 09:23:32 +0000 (04:23 -0500)
commit5c29e8c65fe372b0239f32b38a0299d9abef3167
tree934ab5083e1d5ecfd74e8d9f5d4359c921c1d3d3
parent049f9672d8566f0d0a115f11e2a53018ea502b10
[CodegenPrepare] Guard against degenerate branches

Summary:
Guard against a potential crash observed in https://github.com/JuliaLang/julia/issues/32994#issuecomment-524249628
If two branches are collapsed we can encounter a degenerate conditional branch `TBB==FBB`.
The subsequent code assumes that they differ, so we exit out early.

Reviewers: ributzka, spatel

Subscribers: loladiro, dexonsmith, hiraditya, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D66657
llvm/lib/CodeGen/CodeGenPrepare.cpp
llvm/test/CodeGen/X86/codegen-prepare-collapse.ll [new file with mode: 0644]