Skip to content

Commit c996e31

Browse files
committed
Don't enable cray pointer aliasing by default.
See discussion on #170900
1 parent 8edcf4e commit c996e31

File tree

3 files changed

+6
-3
lines changed

3 files changed

+6
-3
lines changed

flang/include/flang/Optimizer/Analysis/TBAAForest.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ struct TBAATree {
9696
// "any access"
9797
// |
9898
// |- "descriptor member"
99-
// |- "any data access" <--- Cray pointer/pointee accesses
99+
// |- "any data access"
100100
// |
101101
// |- "dummy arg data"
102102
// |

flang/lib/Optimizer/Transforms/AddAliasTags.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,9 @@ static llvm::cl::opt<unsigned> localAllocsThreshold(
6060
llvm::cl::desc("If present, stops generating TBAA tags for accesses of "
6161
"local allocations after N accesses in a module"));
6262

63+
// Defined in AliasAnalysis.cpp
64+
extern llvm::cl::opt<bool> supportCrayPointers;
65+
6366
namespace {
6467

6568
// Return the size and alignment (in bytes) for the given type.
@@ -688,7 +691,7 @@ void AddAliasTagsPass::runOnAliasInterface(fir::FirAliasTagOpInterface op,
688691

689692
mlir::LLVM::TBAATagAttr tag;
690693
// Cray pointer/pointee is a special case. These might alias with any data.
691-
if (source.isCrayPointerOrPointee()) {
694+
if (supportCrayPointers && source.isCrayPointerOrPointee()) {
692695
LLVM_DEBUG(llvm::dbgs().indent(2)
693696
<< "Found reference to Cray pointer/pointee at " << *op << "\n");
694697
mlir::LLVM::TBAATypeDescriptorAttr anyDataDesc =

flang/test/Transforms/tbaa-cray-pointer.fir

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: fir-opt --fir-add-alias-tags %s | FileCheck %s
1+
// RUN: fir-opt -funsafe-cray-pointers --fir-add-alias-tags %s | FileCheck %s
22

33
// Fortran source:
44
// subroutine test()

0 commit comments

Comments
 (0)