[PATCH] D29620: [JumpThreading] Thread through guards
Max Kazantsev via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Feb 7 00:55:29 PST 2017
mkazantsev created this revision.
This patch allows JumpThreading also thread through guards.
Virtually, guard(cond) is equivalent to the following construction:
if (cond) { do something } else {deoptimize}
Yet it is not explicitly converted into IFs before lowering.
This patch enables early threading through guards in simple cases.
Currently it covers the following situation:
if (cond1) {
// code A
} else {
// code B
}
// code C
guard(cond2)
// code D
If there is implication between cond1 and cond2, we can transform
this construction into the following:
if (cond1) {
// code A
// code C
} else {
// code B
// code C
guard(cond2)
}
// code D
Thus, removing the guard from one of execution branches.
https://reviews.llvm.org/D29620
Files:
include/llvm/Transforms/Scalar/JumpThreading.h
lib/Transforms/Scalar/JumpThreading.cpp
test/Transforms/JumpThreading/guards.ll
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D29620.87370.patch
Type: text/x-patch
Size: 11377 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170207/3abe6846/attachment.bin>
More information about the llvm-commits
mailing list