[InstCombine] avoid crashing on attribute propagation
authorSanjay Patel <spatel@rotateright.com>
Thu, 21 Jan 2021 12:54:41 +0000 (07:54 -0500)
committerSanjay Patel <spatel@rotateright.com>
Thu, 21 Jan 2021 13:13:26 +0000 (08:13 -0500)
commit070af1b7887f80383d8473bb4da565edbde6c6b0
tree5774498d86cdb60864b0816271fa257e26b7eac1
parent2b4716d6dff1c9a5e64b3487a0b2388e3ff18b30
[InstCombine] avoid crashing on attribute propagation

In https://llvm.org/PR48810 , we are crashing while trying to
propagate attributes from mempcpy (returns void*) to memcpy
(returns nothing - void).

We can avoid the crash by removing known incompatible
attributes for the void return type.

I'm not sure if this goes far enough (should we just drop all
attributes since this isn't the same function?). We also need
to audit other transforms in LibCallSimplifier to make sure
there are no other cases that have the same problem.

Differential Revision: https://reviews.llvm.org/D95088
llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp
llvm/test/Transforms/InstCombine/mempcpy.ll