]> granicus.if.org Git - llvm/commit
InstCombine: Fix assert when reassociating fsub with undef
authorMatt Arsenault <Matthew.Arsenault@amd.com>
Mon, 24 Apr 2017 17:24:37 +0000 (17:24 +0000)
committerMatt Arsenault <Matthew.Arsenault@amd.com>
Mon, 24 Apr 2017 17:24:37 +0000 (17:24 +0000)
commit772deb9cd55e2f1ff2e772f5c29b15ee65c4122c
tree554f11131934e3bd9f9df54565c1070068a49d73
parentf322f9268ce035a51f8a7fae160f55b6749be21e
InstCombine: Fix assert when reassociating fsub with undef

There is logic to track the expected number of instructions
produced. It thought in this case an instruction would
be necessary to negate the result, but here it folded
into a ConstantExpr fneg when the non-undef value operand
was cancelled out by the second fsub.

I'm not sure why we don't fold constant FP ops with undef currently,
but I think that would also avoid this problem.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301199 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Transforms/InstCombine/InstCombineAddSub.cpp
test/Transforms/InstCombine/fsub.ll