We call the function that attempts to reuse the conversion without checking whether the target matches the constraints that the callee expects. This patch adds the check prior to the call.
Details
- Reviewers
hfinkel sfertile - Group Reviewers
Restricted Project - Commits
- rG3de89abf189e: [PowerPC] Do not attempt to reuse load for 64-bit FP_TO_UINT without FPCVT
rG64b31d96dfd6: [PowerPC] Do not attempt to reuse load for 64-bit FP_TO_UINT without FPCVT
Diff Detail
- Repository
- rG LLVM Github Monorepo
Unit Tests
Time | Test | |
---|---|---|
120 ms | lldb-unit.Host/_/HostTests::Unknown Unit Message ("") |
Event Timeline
run clang-format, but otherwise for fixing the assertion it LGTM. FWIW I'm not sure the code we produce for the conversion handles negative numbers correctly. For the reduced IR I posted I get:
# %bb.0: # %entry addis 3, 2, .LCPI0_0@toc@ha li 4, 1 lfs 0, .LCPI0_0@toc@l(3) sldi 4, 4, 63 fsub 2, 1, 0 fctidz 2, 2 stfd 2, -8(1) fctidz 2, 1 stfd 2, -16(1) ld 3, -8(1) ld 5, -16(1) fcmpu 0, 1, 0 xor 3, 3, 4 bc 12, 0, .LBB0_1 b .LBB0_2 .LBB0_1: # %entry addi 3, 5, 0 .LBB0_2: # %entry std 3, -24(1) lfd 0, -24(1) fcfid 1, 0 blr
Which I think mishandles negative values. I cant produce the same output on powerpc64le so I haven't tested it yet, but will try on AIX64 to see if the assembly works like I think it does.
llvm/test/CodeGen/PowerPC/pr43976.ll | ||
---|---|---|
4 | We can reduce the test further and still exercise the assertion: define dso_local double @b(double) local_unnamed_addr { entry: %conv = fptoui double %0 to i64 %conv1 = sitofp i64 %conv to double ret double %conv1 } |
Which I think mishandles negative values.
I was wrong. Thanks Nemanja for testing it out on a BE machine for me.
Is there anything preventing this from being committed?
If you can, please also backport for 10.0.1.
Thanks!
llvm/test/CodeGen/PowerPC/pr43976.ll | ||
---|---|---|
4 | I initially reduced this down to something like that, but chose not to go ahead with that for two reasons:
|
clang-format: please reformat the code