Skip to content

Commit 560bd05

Browse files
committed
Skip constants
1 parent 406f3a3 commit 560bd05

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

llvm/lib/Transforms/Utils/InlineFunction.cpp

+6
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@
6060
#include "llvm/IR/MDBuilder.h"
6161
#include "llvm/IR/Metadata.h"
6262
#include "llvm/IR/Module.h"
63+
#include "llvm/IR/PatternMatch.h"
6364
#include "llvm/IR/ProfDataUtils.h"
6465
#include "llvm/IR/Type.h"
6566
#include "llvm/IR/User.h"
@@ -1418,6 +1419,11 @@ static void AddParamAndFnBasicAttributes(const CallBase &CB,
14181419
if (AL.hasParamAttr(I, Attribute::ByVal))
14191420
continue;
14201421

1422+
// Don't both propagating attrs to constants.
1423+
if (match(NewInnerCB->getArgOperand(I),
1424+
llvm::PatternMatch::m_ImmConstant()))
1425+
continue;
1426+
14211427
// Check if the underlying value for the parameter is an argument.
14221428
const Argument *Arg = dyn_cast<Argument>(InnerCB->getArgOperand(I));
14231429
unsigned ArgNo;

0 commit comments

Comments
 (0)