[all-commits] [llvm/llvm-project] fed0f8: InstCombine: Negator: don't rely on complexity sor...
Roman Lebedev via All-commits
all-commits at lists.llvm.org
Wed Oct 7 05:10:28 PDT 2020
Branch: refs/heads/master
Home: https://github.com/llvm/llvm-project
Commit: fed0f890e5698a7a408acaf0aa23319e918f6a2a
https://github.com/llvm/llvm-project/commit/fed0f890e5698a7a408acaf0aa23319e918f6a2a
Author: Roman Lebedev <lebedev.ri at gmail.com>
Date: 2020-10-07 (Wed, 07 Oct 2020)
Changed paths:
M llvm/lib/Transforms/InstCombine/InstCombineInternal.h
M llvm/lib/Transforms/InstCombine/InstCombineNegator.cpp
M llvm/test/Transforms/InstCombine/sub-of-negatible.ll
Log Message:
-----------
InstCombine: Negator: don't rely on complexity sorting already being performed (PR47752)
In some cases, we can negate instruction if only one of it's operands
negates. Previously, we assumed that constants would have been
canonicalized to RHS already, but that isn't guaranteed to happen,
because of InstCombine worklist visitation order,
as the added test (previously-hanging) shows.
So if we only need to negate a single operand,
we should ensure ourselves that we try constant operand first.
Do that by re-doing the complexity sorting ourselves,
when we actually care about it.
Fixes https://bugs.llvm.org/show_bug.cgi?id=47752
More information about the All-commits
mailing list