@@ -1448,7 +1448,7 @@ static Value *getIntToFPVal(Value *I2F, IRBuilderBase &B) {
1448
1448
// / exp10(x) for pow(10.0, x); exp2(log2(n) * x) for pow(n, x).
1449
1449
Value *LibCallSimplifier::replacePowWithExp (CallInst *Pow, IRBuilderBase &B) {
1450
1450
Value *Base = Pow->getArgOperand (0 ), *Expo = Pow->getArgOperand (1 );
1451
- AttributeList Attrs = Pow-> getCalledFunction ()-> getAttributes ();
1451
+ AttributeList Attrs; // Attributes are only meaningful on the original call
1452
1452
Module *Mod = Pow->getModule ();
1453
1453
Type *Ty = Pow->getType ();
1454
1454
bool Ignored;
@@ -1615,7 +1615,7 @@ static Value *getSqrtCall(Value *V, AttributeList Attrs, bool NoErrno,
1615
1615
// / Use square root in place of pow(x, +/-0.5).
1616
1616
Value *LibCallSimplifier::replacePowWithSqrt (CallInst *Pow, IRBuilderBase &B) {
1617
1617
Value *Sqrt, *Base = Pow->getArgOperand (0 ), *Expo = Pow->getArgOperand (1 );
1618
- AttributeList Attrs = Pow-> getCalledFunction ()-> getAttributes ();
1618
+ AttributeList Attrs; // Attributes are only meaningful on the original call
1619
1619
Module *Mod = Pow->getModule ();
1620
1620
Type *Ty = Pow->getType ();
1621
1621
@@ -1785,6 +1785,7 @@ Value *LibCallSimplifier::optimizePow(CallInst *Pow, IRBuilderBase &B) {
1785
1785
1786
1786
Value *LibCallSimplifier::optimizeExp2 (CallInst *CI, IRBuilderBase &B) {
1787
1787
Function *Callee = CI->getCalledFunction ();
1788
+ AttributeList Attrs; // Attributes are only meaningful on the original call
1788
1789
StringRef Name = Callee->getName ();
1789
1790
Value *Ret = nullptr ;
1790
1791
if (UnsafeFPShrink && Name == TLI->getName (LibFunc_exp2) &&
@@ -1801,7 +1802,7 @@ Value *LibCallSimplifier::optimizeExp2(CallInst *CI, IRBuilderBase &B) {
1801
1802
if (Value *Exp = getIntToFPVal (Op, B))
1802
1803
return emitBinaryFloatFnCall (ConstantFP::get (Ty, 1.0 ), Exp, TLI,
1803
1804
LibFunc_ldexp, LibFunc_ldexpf, LibFunc_ldexpl,
1804
- B, CI-> getCalledFunction ()-> getAttributes () );
1805
+ B, Attrs );
1805
1806
}
1806
1807
1807
1808
return Ret;
@@ -1836,7 +1837,7 @@ Value *LibCallSimplifier::optimizeFMinFMax(CallInst *CI, IRBuilderBase &B) {
1836
1837
1837
1838
Value *LibCallSimplifier::optimizeLog (CallInst *Log, IRBuilderBase &B) {
1838
1839
Function *LogFn = Log->getCalledFunction ();
1839
- AttributeList Attrs = LogFn-> getAttributes ();
1840
+ AttributeList Attrs; // Attributes are only meaningful on the original call
1840
1841
StringRef LogNm = LogFn->getName ();
1841
1842
Intrinsic::ID LogID = LogFn->getIntrinsicID ();
1842
1843
Module *Mod = Log->getModule ();
0 commit comments