HomePhabricator

[IR] Look through bitcast in hasFnAttribute()

Authored by antoniofrighetto on Sep 21 2021, 12:54 PM.

Description

[IR] Look through bitcast in hasFnAttribute()

A logic incompleteness may lead MemorySSA to be too conservative
in its results. Specifically, when dealing with a call of kind
call i32 bitcast (i1 (i1)* @test to i32 (i32)*)(i32 %1), where
the function test is declared with readonly attribute, the
bitcast is not looked through, obscuring function attributes. Hence,
some methods of CallBase (e.g., doesNotReadMemory) could provide
suboptimal results.

Differential Revision: https://reviews.llvm.org/D109888