[llvm] [EarlyCSE] Rematerialize alignment assumption. (PR #109131)
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Thu Sep 19 12:49:03 PDT 2024
================
@@ -1588,6 +1589,18 @@ bool EarlyCSE::processNode(DomTreeNode *Node) {
if (InVal.IsLoad)
if (auto *I = dyn_cast<Instruction>(Op))
combineMetadataForCSE(I, &Inst, false);
+
+ // If the load has align metadata, preserve it via an alignment
+ // assumption. Note that this doesn't use salavageKnowledge, as we need
+ // to create the assumption for the value we replaced the load with.
+ if (auto *AlignMD = Inst.getMetadata(LLVMContext::MD_align)) {
----------------
nikic wrote:
You also need `!noundef` for this transform. `!align` by itself only returns poison, while the assumption converts it into IUB.
https://github.com/llvm/llvm-project/pull/109131
More information about the llvm-commits
mailing list