[all-commits] [llvm/llvm-project] e9fc2f: [flang][CodeGen] fix bug hoisting allocas using a ...
Tom Eccles via All-commits
all-commits at lists.llvm.org
Fri Nov 15 02:31:43 PST 2024
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: e9fc2faf0c2551eb4f9f932da09bdf1af24ac7e2
https://github.com/llvm/llvm-project/commit/e9fc2faf0c2551eb4f9f932da09bdf1af24ac7e2
Author: Tom Eccles <tom.eccles at arm.com>
Date: 2024-11-15 (Fri, 15 Nov 2024)
Changed paths:
M flang/lib/Optimizer/CodeGen/CodeGen.cpp
M flang/test/Fir/convert-to-llvm-openmp-and-fir.fir
Log Message:
-----------
[flang][CodeGen] fix bug hoisting allocas using a shared constant arg (#116251)
When hoisting the allocas with a constant integer size, the constant
integer was moved to where the alloca is hoisted to unconditionally.
By CodeGen there have been various iterations of mlir canonicalization
and dead code elimination. This can cause lots of unrelated bits of code
to share the same constant values. If for some reason the alloca
couldn't be hoisted all of the way to the entry block of the function,
moving the constant might result in it no-longer dominating some of the
remaining uses.
In theory, there should be dominance analysis to ensure the location of
the constant does dominate all uses of it. But those constants are
effectively free anyway (they aren't even separate instructions in LLVM
IR), so it is less expensive just to leave the old one where it was and
insert a new one we know for sure is immediately before the alloca.
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