It is a usual pattern to get the lifetime marker of Instruction I:
SmallPtrSet<Instruction*, 4> LifetimeMarkers; for (User *U : I->users()) { if ( U is a lifetime marker) LifetimeMarkers.insert(U); if (BitCastInst* BCI=dyn_cast<BitCastInst>(U)){ for (User* BCIUser:BCI->users()) if (BCIUser is a lifetime marker) LifetimeMarkers.insert(BCIUser); } }
In another word, the lifetime marker of an instruction I is either a user of I or a user of a user of I which is a BitCastInst. Although I don't find any rule for this pattern, I find it in a lot of codes.
However, in the InstCombine pass, it would try to transfer BitCast to a GEP when the target type of BitCast could be transferred by the source type of BitCast, which would break this pattern.
So I try to Disable the transferring process when the user of BitCast is lifetime marker.