This got changed to use hasAttrSomewhere() during review, and I didn't
notice until today when I was writing some tests for another part of
this system that using hasAttrSomewhere only checked the callsite for
allocalign, rather than both the callsite and the definition. This fixes
that by introducing a helper method.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Unit Tests
Event Timeline
I'd suggest pre-committing the tests, so that the test diff then shows up in the individual patches.
llvm/lib/Analysis/MemoryBuiltins.cpp | ||
---|---|---|
343 | Maybe we should have a helper function on CallBase for this whole logic? See CallBase::getReturnedArgOperand() which implements exactly the same but with Attribute::Returned instead of Attribute::AllocAlign. |
llvm/lib/IR/Instructions.cpp | ||
---|---|---|
340 | That wasn't quite what I had in mind: I don't think we'll want to fetch allocalign beyond that one callsite. Rather, we could have CallBase::getArgOperandWithAttribute(AttrKind) and then use that both in getReturnedArgOperand() and in getAllocAlignment(). |
Maybe we should have a helper function on CallBase for this whole logic? See CallBase::getReturnedArgOperand() which implements exactly the same but with Attribute::Returned instead of Attribute::AllocAlign.