[AMDGPU] Avoid DAG combining assert with fneg(fadd(A,0))
authorTim Renouf <tpr.llvm@botech.co.uk>
Thu, 18 Apr 2019 05:27:01 +0000 (05:27 +0000)
committerTim Renouf <tpr.llvm@botech.co.uk>
Thu, 18 Apr 2019 05:27:01 +0000 (05:27 +0000)
commit7c55c8d8c347c718dbe359cda064392de5fbf3e7
tree77d5592e66e789f95fe7c83ba594824d02d8ef13
parent6263365b082d7e03988a45c113aa3099cabac5de
[AMDGPU] Avoid DAG combining assert with fneg(fadd(A,0))

fneg combining attempts to turn it into fadd(fneg(A), fneg(0)), but
creating the new fadd folds to just fneg(A). When A has multiple uses,
this confuses it and you get an assert. Fixed.

Differential Revision: https://reviews.llvm.org/D60633

Change-Id: I0ddc9b7286abe78edc0cd8d734fdeb05ff09821c
llvm-svn: 358640
llvm/lib/Target/AMDGPU/AMDGPUISelLowering.cpp
llvm/test/CodeGen/AMDGPU/fneg-combines.ll