[PATCH] D84491: [SimplifyCFG] Canonicalize branch predicates

Yevgeny Rouban via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 23 23:57:14 PDT 2020


yrouban created this revision.
yrouban added reviewers: nikic, efriedma, kuhar.
Herald added a subscriber: hiraditya.
Herald added a project: LLVM.

Canonicalize branch predicates as it is done by InstCombine.
This patch is the first step to move the branch predicate canonicalization transformation from InstCombine to SimplifyCFG.
This move is needed to make InstCombine preserve CFG. Currently we have a bug 46098 <https://bugs.llvm.org/show_bug.cgi?id=46098> which reports PostDomTree invalidation once InstCombine swaps branches in a post-order unreachable block. See discussion in D81089 <https://reviews.llvm.org/D81089>.

The new transformation is disabled by default (the new flag //simplifycfg-canonicalize-branch-predicates//). So the patch is safe but. The sensitive tests are fixed and get additional option //-simplifycfg-canonicalize-branch-predicates//.


https://reviews.llvm.org/D84491

Files:
  llvm/lib/Transforms/Utils/SimplifyCFG.cpp
  llvm/test/Transforms/SimplifyCFG/X86/switch_to_lookup_table.ll
  llvm/test/Transforms/SimplifyCFG/switch_msan.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D84491.280333.patch
Type: text/x-patch
Size: 6573 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200724/a6465c6e/attachment.bin>


More information about the llvm-commits mailing list