[PATCH] D37121: [DivRemHoist] add a pass to move div/rem pairs into the same block (PR31028)
Sanjay Patel via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Aug 29 12:36:21 PDT 2017
spatel added a comment.
On closer inspection, I misdiagnosed who was sinking the rem in my example, but I don't think it makes a difference to the patch. We don't need loops to show the problem...if simplifycfg can't flatten the code, then it's instcombine sinking instructions for some unstated reason:
define void @rebase_mask(i1 %cmp, i32 %num, i32 %divisor, i32* %p1, i32* %p2) {
entry:
%div = sdiv i32 %num, %divisor
store i32 %div, i32* %p1
br i1 %cmp, label %exit, label %if.end
if.end:
%rem = srem i32 %num, %divisor
store i32 %rem, i32* %p2
br label %exit
exit:
ret void
}
./opt -div-rem-hoist -instcombine divrem.ll -S -debug
...
IC: Sink: %rem = srem i32 %num, %divisor
https://reviews.llvm.org/D37121
More information about the llvm-commits
mailing list