@@ -1807,54 +1807,58 @@ void Attributor::identifyDefaultAbstractAttributes(Function &F) {
1807
1807
// users. The return value might be dead if there are no live users.
1808
1808
getOrCreateAAFor<AAIsDead>(CSRetPos);
1809
1809
1810
- if (Function *Callee = CS.getCalledFunction ()) {
1811
- // Skip declerations except if annotations on their call sites were
1812
- // explicitly requested.
1813
- if (!AnnotateDeclarationCallSites && Callee->isDeclaration () &&
1814
- !Callee->hasMetadata (LLVMContext::MD_callback))
1815
- return true ;
1810
+ Function *Callee = CS.getCalledFunction ();
1811
+ // TODO: Even if the callee is not known now we might be able to simplify
1812
+ // the call/callee.
1813
+ if (!Callee)
1814
+ return true ;
1816
1815
1817
- if (!Callee->getReturnType ()->isVoidTy () && !CS->use_empty ()) {
1816
+ // Skip declarations except if annotations on their call sites were
1817
+ // explicitly requested.
1818
+ if (!AnnotateDeclarationCallSites && Callee->isDeclaration () &&
1819
+ !Callee->hasMetadata (LLVMContext::MD_callback))
1820
+ return true ;
1818
1821
1819
- IRPosition CSRetPos = IRPosition::callsite_returned (CS);
1822
+ if (!Callee-> getReturnType ()-> isVoidTy () && !CS-> use_empty ()) {
1820
1823
1821
- // Call site return integer values might be limited by a constant range.
1822
- if (Callee->getReturnType ()->isIntegerTy ())
1823
- getOrCreateAAFor<AAValueConstantRange>(CSRetPos);
1824
- }
1824
+ IRPosition CSRetPos = IRPosition::callsite_returned (CS);
1825
+
1826
+ // Call site return integer values might be limited by a constant range.
1827
+ if (Callee->getReturnType ()->isIntegerTy ())
1828
+ getOrCreateAAFor<AAValueConstantRange>(CSRetPos);
1829
+ }
1825
1830
1826
- for (int i = 0 , e = CS.getNumArgOperands (); i < e; i++) {
1831
+ for (int i = 0 , e = CS.getNumArgOperands (); i < e; i++) {
1827
1832
1828
- IRPosition CSArgPos = IRPosition::callsite_argument (CS, i);
1833
+ IRPosition CSArgPos = IRPosition::callsite_argument (CS, i);
1829
1834
1830
- // Every call site argument might be dead.
1831
- getOrCreateAAFor<AAIsDead>(CSArgPos);
1835
+ // Every call site argument might be dead.
1836
+ getOrCreateAAFor<AAIsDead>(CSArgPos);
1832
1837
1833
- // Call site argument might be simplified.
1834
- getOrCreateAAFor<AAValueSimplify>(CSArgPos);
1838
+ // Call site argument might be simplified.
1839
+ getOrCreateAAFor<AAValueSimplify>(CSArgPos);
1835
1840
1836
- if (!CS.getArgument (i)->getType ()->isPointerTy ())
1837
- continue ;
1841
+ if (!CS.getArgument (i)->getType ()->isPointerTy ())
1842
+ continue ;
1838
1843
1839
- // Call site argument attribute "non-null".
1840
- getOrCreateAAFor<AANonNull>(CSArgPos);
1844
+ // Call site argument attribute "non-null".
1845
+ getOrCreateAAFor<AANonNull>(CSArgPos);
1841
1846
1842
- // Call site argument attribute "no-alias".
1843
- getOrCreateAAFor<AANoAlias>(CSArgPos);
1847
+ // Call site argument attribute "no-alias".
1848
+ getOrCreateAAFor<AANoAlias>(CSArgPos);
1844
1849
1845
- // Call site argument attribute "dereferenceable".
1846
- getOrCreateAAFor<AADereferenceable>(CSArgPos);
1850
+ // Call site argument attribute "dereferenceable".
1851
+ getOrCreateAAFor<AADereferenceable>(CSArgPos);
1847
1852
1848
- // Call site argument attribute "align".
1849
- getOrCreateAAFor<AAAlign>(CSArgPos);
1853
+ // Call site argument attribute "align".
1854
+ getOrCreateAAFor<AAAlign>(CSArgPos);
1850
1855
1851
- // Call site argument attribute
1852
- // "readnone/readonly/writeonly/..."
1853
- getOrCreateAAFor<AAMemoryBehavior>(CSArgPos);
1856
+ // Call site argument attribute
1857
+ // "readnone/readonly/writeonly/..."
1858
+ getOrCreateAAFor<AAMemoryBehavior>(CSArgPos);
1854
1859
1855
- // Call site argument attribute "nofree".
1856
- getOrCreateAAFor<AANoFree>(CSArgPos);
1857
- }
1860
+ // Call site argument attribute "nofree".
1861
+ getOrCreateAAFor<AANoFree>(CSArgPos);
1858
1862
}
1859
1863
return true ;
1860
1864
};
0 commit comments