[PATCH] D70247: [JumpThreading] Thread jumps through two basic blocks
Kazu Hirata via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Nov 14 08:34:36 PST 2019
kazu created this revision.
kazu added a reviewer: wmi.
Herald added subscribers: jfb, hiraditya.
Herald added a project: LLVM.
This patch teaches JumpThreading.cpp to thread through two basic
blocks like:
bb3:
%var = phi i32* [ null, %bb1 ], [ @a, %bb2 ]
%tobool = icmp eq i32 %cond, 0
br i1 %tobool, label %bb4, label ...
bb4:
%cmp = icmp eq i32* %var, null
br i1 %cmp, label bb5, label bb6
by duplicating basic blocks like bb3 above. Once we duplicate bb3 as
bb3.dup and redirect edge bb2->bb3 to bb2->bb3.dup, we have:
bb3:
%var = phi i32* [ @a, %bb2 ]
%tobool = icmp eq i32 %cond, 0
br i1 %tobool, label %bb4, label ...
bb3.dup:
%var = phi i32* [ null, %bb1 ]
%tobool = icmp eq i32 %cond, 0
br i1 %tobool, label %bb4, label ...
bb4:
%cmp = icmp eq i32* %var, null
br i1 %cmp, label bb5, label bb6
Then the existing code in JumpThreading.cpp can thread edge
bb3.dup->bb4 through bb4 and eventually create bb3.dup->bb5.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D70247
Files:
llvm/include/llvm/Transforms/Scalar/JumpThreading.h
llvm/lib/Transforms/Scalar/JumpThreading.cpp
llvm/test/Transforms/JumpThreading/thread-two-bbs1.ll
llvm/test/Transforms/JumpThreading/thread-two-bbs2.ll
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D70247.229316.patch
Type: text/x-patch
Size: 11745 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20191114/38812c46/attachment.bin>
More information about the llvm-commits
mailing list