[PATCH] D36858: [x86] Teach the cmov converter to aggressively convert cmovs with memory operands into control flow.
Amjad Aboud via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Aug 18 06:01:22 PDT 2017
aaboud added a comment.
Thanks Chandler for preparing the patch, the implementation looks elegant, however, it overlooked a case where the memory registers are a result of a previous CMOV instructions.
This is a small reproducer that result in bad MIR:
target datalayout = "e-m:w-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-unknown"
define i32 @bar(i32* %a, i32* %b, i32 %n1, i32 %n2, i32 %d) #0 {
entry:
%cmp = icmp sgt i32 %n1, %n2
%s = select i1 %cmp, i32* %a, i32* %b
%p = getelementptr inbounds i32, i32* %s, i64 1
%load = load i32, i32* %p, align 4
%res = select i1 %cmp, i32 %d, i32 %load
ret i32 %res
}
attributes #0 = {"target-cpu"="skylake"}
https://reviews.llvm.org/D36858
More information about the llvm-commits
mailing list