mirror of
https://github.com/intel/llvm.git
synced 2026-01-25 10:55:58 +08:00
[Attributor][FIX] Do not ignore memory writes in AAMemoryBehavior
Even if we look for `nocapture` we need to bail on escaping pointers. The crucial thing is that we might not look at a big enough scope when we derive the memory behavior. Thus, it might be `nocapture` in a larger context while it is "captured" in a smaller context.
This commit is contained in:
@@ -7322,10 +7322,12 @@ void AAMemoryBehaviorFloating::analyzeUseIn(Attributor &A, const Use &U,
|
||||
|
||||
case Instruction::Store:
|
||||
// Stores cause the NO_WRITES property to disappear if the use is the
|
||||
// pointer operand. Note that we do assume that capturing was taken care of
|
||||
// somewhere else.
|
||||
// pointer operand. Note that while capturing was taken care of somewhere
|
||||
// else we need to deal with stores of the value that is not looked through.
|
||||
if (cast<StoreInst>(UserI)->getPointerOperand() == U.get())
|
||||
removeAssumedBits(NO_WRITES);
|
||||
else
|
||||
indicatePessimisticFixpoint();
|
||||
return;
|
||||
|
||||
case Instruction::Call:
|
||||
|
||||
@@ -49,7 +49,7 @@ define dso_local void @func(float* nocapture %a, float* %b, i32 %N) local_unname
|
||||
;
|
||||
; IS__CGSCC_OPM: Function Attrs: nounwind uwtable
|
||||
; IS__CGSCC_OPM-LABEL: define {{[^@]+}}@func
|
||||
; IS__CGSCC_OPM-SAME: (float* nocapture nofree readnone [[A:%.*]], float* nofree [[B:%.*]], i32 [[N:%.*]]) local_unnamed_addr #[[ATTR0:[0-9]+]] {
|
||||
; IS__CGSCC_OPM-SAME: (float* nocapture nofree [[A:%.*]], float* nofree [[B:%.*]], i32 [[N:%.*]]) local_unnamed_addr #[[ATTR0:[0-9]+]] {
|
||||
; IS__CGSCC_OPM-NEXT: entry:
|
||||
; IS__CGSCC_OPM-NEXT: [[A_ADDR:%.*]] = alloca float*, align 8
|
||||
; IS__CGSCC_OPM-NEXT: [[B_ADDR:%.*]] = alloca float*, align 8
|
||||
@@ -62,7 +62,7 @@ define dso_local void @func(float* nocapture %a, float* %b, i32 %N) local_unname
|
||||
;
|
||||
; IS__CGSCC_NPM: Function Attrs: nounwind uwtable
|
||||
; IS__CGSCC_NPM-LABEL: define {{[^@]+}}@func
|
||||
; IS__CGSCC_NPM-SAME: (float* nocapture nofree readnone [[A:%.*]], float* nofree [[B:%.*]], i32 [[N:%.*]]) local_unnamed_addr #[[ATTR0:[0-9]+]] {
|
||||
; IS__CGSCC_NPM-SAME: (float* nocapture nofree [[A:%.*]], float* nofree [[B:%.*]], i32 [[N:%.*]]) local_unnamed_addr #[[ATTR0:[0-9]+]] {
|
||||
; IS__CGSCC_NPM-NEXT: entry:
|
||||
; IS__CGSCC_NPM-NEXT: [[A_ADDR:%.*]] = alloca float*, align 8
|
||||
; IS__CGSCC_NPM-NEXT: [[B_ADDR:%.*]] = alloca float*, align 8
|
||||
|
||||
Reference in New Issue
Block a user