diff options
| author | Johannes Doerfert <jdoerfert@anl.gov> | 2019-09-14 02:57:50 +0000 |
|---|---|---|
| committer | Johannes Doerfert <jdoerfert@anl.gov> | 2019-09-14 02:57:50 +0000 |
| commit | e7c6f97039a4c9acee583af9d0e7aac94762d8ac (patch) | |
| tree | 6caf4b3890624c62ee75c44c8aa4c1daf8aa167a /llvm/lib/Transforms | |
| parent | 2f519d7072bf48a81985fadc2dc145296d612223 (diff) | |
| download | bcm5719-llvm-e7c6f97039a4c9acee583af9d0e7aac94762d8ac.tar.gz bcm5719-llvm-e7c6f97039a4c9acee583af9d0e7aac94762d8ac.zip | |
[Attributor][Fix] Use right type to replace expressions
Summary: This should be obsolete once the functionality in D66967 is integrated.
Reviewers: uenoku, sstefan1
Subscribers: hiraditya, bollu, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D67231
llvm-svn: 371915
Diffstat (limited to 'llvm/lib/Transforms')
| -rw-r--r-- | llvm/lib/Transforms/IPO/Attributor.cpp | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/llvm/lib/Transforms/IPO/Attributor.cpp b/llvm/lib/Transforms/IPO/Attributor.cpp index 94ed7003c96..b9f943e4772 100644 --- a/llvm/lib/Transforms/IPO/Attributor.cpp +++ b/llvm/lib/Transforms/IPO/Attributor.cpp @@ -874,12 +874,17 @@ ChangeStatus AAReturnedValuesImpl::manifest(Attributor &A) { if (Function *F = dyn_cast<Function>(&AnchorValue)) { for (const Use &U : F->uses()) if (CallBase *CB = dyn_cast<CallBase>(U.getUser())) - if (CB->isCallee(&U)) - Changed = ReplaceCallSiteUsersWith(*CB, *RVC) | Changed; + if (CB->isCallee(&U)) { + Constant *RVCCast = + ConstantExpr::getTruncOrBitCast(RVC, CB->getType()); + Changed = ReplaceCallSiteUsersWith(*CB, *RVCCast) | Changed; + } } else { assert(isa<CallBase>(AnchorValue) && "Expcected a function or call base anchor!"); - Changed = ReplaceCallSiteUsersWith(cast<CallBase>(AnchorValue), *RVC); + Constant *RVCCast = + ConstantExpr::getTruncOrBitCast(RVC, AnchorValue.getType()); + Changed = ReplaceCallSiteUsersWith(cast<CallBase>(AnchorValue), *RVCCast); } if (Changed == ChangeStatus::CHANGED) STATS_DECLTRACK(UniqueConstantReturnValue, FunctionReturn, |

