Equality is directly stated as true in the LangRef,
and I believe this works for every compare type.
Details
Diff Detail
Event Timeline
| llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp | ||
|---|---|---|
| 7109 | Need to handle/test the commuted pattern too? fcmp Pred x, canonical(x) | |
| llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp | ||
|---|---|---|
| 7109 | Have that, canonicalize_oeq_arg_f32 and canonicalize_oeq_arg_f32_commute | |
| llvm/test/Transforms/InstCombine/canonicalize.ll | ||
|---|---|---|
| 316–318 | This isn't testing what was intended. The operands are canonicalized by complexity before we reach the transform in this patch. It needs an extra instruction to create the expected pattern: declare float @gen_f32()
define i1 @canonicalize_oeq_arg_f32_commute() {
%x = call float @gen_f32() ; thwart complexity-based canonicalization
%canon.x = call float @llvm.canonicalize.f32(float %x)
%cmp = fcmp oeq float %x, %canon.x
ret i1 %cmp
} | |
| 340–342 | Similar to above - the operands got commuted. | |
| llvm/test/Transforms/InstCombine/canonicalize.ll | ||
|---|---|---|
| 316–318 | I thought the idea was to rely on the complexity based canonicalization, but I guess that's not good enough | |
Need to handle/test the commuted pattern too?