[llvm] r245385 - Fix backward operands in call to isTruncateFree() and improve comments.

Steve King via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 21 17:10:01 PDT 2015


On Fri, Aug 21, 2015 at 12:08 PM, Duncan P. N. Exon Smith
<dexonsmith at apple.com> wrote:
>
>> On 2015-Aug-18, at 16:02, Steve King via llvm-commits <llvm-commits at lists.llvm.org> wrote:
>>
>> Author: srking
>> Date: Tue Aug 18 18:02:41 2015
>> New Revision: 245385
>>
>> URL: https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject-3Frev-3D245385-26view-3Drev&d=BQIGaQ&c=eEvniauFctOgLOKGJOplqw&r=vftFLnHiqThJHdL0qZWd_Vo12qdMVOZDFnNVBhP9GKA&m=yp8m1-5uXYoKswDXC2oJzI3_i4B8g-RUFdiPhjILLGU&s=T5MYuh_a8IwlOzr7QIj4WGJVA5qwkIfwkoBwxpkJMKY&e=
>> Log:
>> Fix backward operands in call to isTruncateFree() and improve comments.
>>
>> Modified:
>>    llvm/trunk/include/llvm/Target/TargetLowering.h
>>    llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
>>
>
> Any chance of a testcase for this fix?

Unfortunately the short answer is no.  I particularly wanted to put a
good foot forward on my first personal commit, but I didn't see a way
to create a succinct test in a reasonable amount of time.

The bug is buried in what looks like a cost analysis algorithm that is
functionally correct regardless of the isTruncateFree() answer.  The
problem was detected by investigating nonsense truncation cases, i.e.
where From < To. By inspection, we see the original code places the
destination as "From" and the source operand as "To" in the truncation
check.


More information about the llvm-commits mailing list