[PATCH] D137862: InstCombine: Fold some identities for canonicalize
Sanjay Patel via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Nov 18 11:31:09 PST 2022
spatel added inline comments.
================
Comment at: llvm/test/Transforms/InstCombine/canonicalize.ll:284
-; CHECK-NEXT: [[CANON_X:%.*]] = call float @llvm.canonicalize.f32(float [[X:%.*]])
-; CHECK-NEXT: [[CMP:%.*]] = fcmp oeq float [[CANON_X]], [[X]]
; CHECK-NEXT: ret i1 [[CMP]]
----------------
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
}
```
================
Comment at: llvm/test/Transforms/InstCombine/canonicalize.ll:306
-; CHECK-NEXT: [[CANON_X:%.*]] = call <2 x float> @llvm.canonicalize.v2f32(<2 x float> [[X:%.*]])
-; CHECK-NEXT: [[CMP:%.*]] = fcmp oeq <2 x float> [[CANON_X]], [[X]]
; CHECK-NEXT: ret <2 x i1> [[CMP]]
----------------
Similar to above - the operands got commuted.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D137862/new/
https://reviews.llvm.org/D137862
More information about the llvm-commits
mailing list