[all-commits] [llvm/llvm-project] d6a481: [SelectionDAG] Fix miscompile bugs related to smul...
Dimitry Andric via All-commits
all-commits at lists.llvm.org
Tue Aug 31 21:03:26 PDT 2021
Branch: refs/heads/release/13.x
Home: https://github.com/llvm/llvm-project
Commit: d6a48141f28456878050301a528dd17166a71338
https://github.com/llvm/llvm-project/commit/d6a48141f28456878050301a528dd17166a71338
Author: Bjorn Pettersson <bjorn.a.pettersson at ericsson.com>
Date: 2021-08-31 (Tue, 31 Aug 2021)
Changed paths:
M llvm/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp
M llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp
M llvm/test/CodeGen/X86/smul_fix_sat.ll
M llvm/test/CodeGen/X86/smul_fix_sat_constants.ll
Log Message:
-----------
[SelectionDAG] Fix miscompile bugs related to smul.fix.sat with scale zero
When expanding a SMULFIXSAT ISD node (usually originating from
a smul.fix.sat intrinsic) we've applied some optimizations for
the special case when the scale is zero. The idea has been that
it would be cheaper to use an SMULO instruction (if legal) to
perform the multiplication and at the same time detect any overflow.
And in case of overflow we could use some SELECT:s to replace the
result with the saturated min/max value. The only tricky part
is to know if we overflowed on the min or max value, i.e. if the
product is positive or negative. Unfortunately the implementation
has been incorrect as it has looked at the product returned by the
SMULO to determine the sign of the product. In case of overflow that
product is truncated and won't give us the correct sign bit.
This patch is adding an extra XOR of the multiplication operands,
which is used to determine the sign of the non truncated product.
This patch fixes PR51677.
Reviewed By: lebedev.ri
Differential Revision: https://reviews.llvm.org/D108938
(cherry picked from commit 789f01283d52065b10049b58a3288c4abd1ef351)
Commit: ce268f0eb9e71679a3d57edd95fc54db6c16d8a9
https://github.com/llvm/llvm-project/commit/ce268f0eb9e71679a3d57edd95fc54db6c16d8a9
Author: Dimitry Andric <dimitry at andric.com>
Date: 2021-08-31 (Tue, 31 Aug 2021)
Changed paths:
M openmp/libomptarget/plugins/amdgpu/impl/system.cpp
Log Message:
-----------
[libomptarget][amdgpu] don't declare Elf_Note on FreeBSD
On FreeBSD, the system `<libelf.h>` already declares `struct Elf_Note`
indirectly (via `<sys/elf_common.h>`). This results in compile errors
when building the libomptarget amdgpu plugin. Avoid redeclaring `struct
Elf_Note` on FreeBSD to fix the errors.
Reviewed By: JonChesterfield
Differential Revision: https://reviews.llvm.org/D107661
(cherry picked from commit 71ae2e0221a99958ed82175781d92a73ea05597c)
Compare: https://github.com/llvm/llvm-project/compare/d1dd1fb104a6...ce268f0eb9e7
More information about the All-commits
mailing list