[all-commits] [llvm/llvm-project] 43f30a: [IR] Memory effects for floating-point operations
Serge Pavlov via All-commits
all-commits at lists.llvm.org
Sun Sep 27 12:08:15 PDT 2026
Branch: refs/heads/users/spavloff/memeffect2
Home: https://github.com/llvm/llvm-project
Commit: 43f30af4420b573ab220d2d8d8be22821fd16708
https://github.com/llvm/llvm-project/commit/43f30af4420b573ab220d2d8d8be22821fd16708
Author: Serge Pavlov <sepavloff at gmail.com>
Date: 2026-09-28 (Mon, 28 Sep 2026)
Changed paths:
M llvm/include/llvm/AsmParser/LLToken.h
M llvm/include/llvm/Support/ModRef.h
M llvm/include/llvm/Transforms/IPO/Attributor.h
M llvm/lib/Analysis/AliasAnalysis.cpp
M llvm/lib/Analysis/BasicAliasAnalysis.cpp
M llvm/lib/Analysis/GlobalsModRef.cpp
M llvm/lib/AsmParser/LLLexer.cpp
M llvm/lib/AsmParser/LLParser.cpp
M llvm/lib/IR/Attributes.cpp
M llvm/lib/Support/ModRef.cpp
M llvm/lib/Transforms/IPO/Attributor.cpp
M llvm/lib/Transforms/IPO/AttributorAttributes.cpp
M llvm/lib/Transforms/IPO/FunctionAttrs.cpp
M llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp
M llvm/test/Assembler/memory-attribute-errors.ll
M llvm/test/Assembler/memory-attribute.ll
M llvm/unittests/Support/ModRefTest.cpp
Log Message:
-----------
[IR] Memory effects for floating-point operations
Floating-point operations in a strictfp function have side effects,
which are modeled using memory effects in the form of a read-write
access to "inaccessible memory". This helps maintain strictfp semantics
but may hinder optimizations. Floating-point operations may depend on
rounding mode or not - this fact may be used to reorder them in a more
optimal way. Similarly, functions that control floating-point
environment (like `set_rounding`, `set_fpmode` etc.) also have more
specific access than generic read-write. Also, "inaccessible memory" is
used in cases other than FP operation, this results in unnecessary
restrictions.
This change implements two new memory location to use instead of the
access to "inaccessible memory". The "fpcontrol" location is used to
represent access to floating-point control modes, of which only rounding
mode is currently supported. The other location, "fpstatus", represents
access to floating-point exceptions. Together they replace the use of
"inaccessible memory".
The new memory locations are not supported in all cases. The Attributor
does not support them now, as these locations do not exactly represent
memory. Writing to a floating-point control register inside a function
does not mean that the function itself changes some floating-point
control mode. Supporting these locations in the Attributor requires
additional considerations and, probably, new attributes.
The meaning of `MemoryEffects::onlyAccessesInaccessibleMem` is changed
in this commit. Now this method checks not only the "inaccessible
memory" but also floating-point environment. This change agrees with the
current usage of the method in the compiler sources and will hopefully
reduce the risk on misuse.
This change only introduces the new memory locations. Their use in the
functions that access the floating-point environment will be implemented
in another commit.
This MR was obtained from
https://github.com/llvm/llvm-project/pull/221754 by keeping only the
changes required to introduce the new memory locations only.
To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications
More information about the All-commits
mailing list