[PATCH] D96399: [X86][CodeGenPrepare] Try to reuse IV's incremented value instead of adding the offset
Juneyoung Lee via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Feb 17 05:29:01 PST 2021
aqjune added a comment.
The change from the previous output to the new output looks valid to me.
$ ./build/alive-tv D96399.srctgt.ll -disable-undef-input
----------------------------------------
define * @src(* %p, i64 %idx) {
%0:
%addr1 = mul i64 %idx, 4
%ptr = gep * %p, 1 x i64 %addr1
%ptr2 = gep * %ptr, 1 x i64 -4
ret * %ptr2
}
=>
define * @tgt(* %p, i64 %idx) {
%0:
%res = usub_overflow {i64, i1, i24} %idx, 1
%sub = extractvalue {i64, i1, i24} %res, 0
%addr2 = mul i64 %sub, 4
%ptr2 = gep * %p, 1 x i64 %addr2
ret * %ptr2
}
Transformation seems to be correct!
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D96399/new/
https://reviews.llvm.org/D96399
More information about the llvm-commits
mailing list