[Attributor][FIX] Store alignment only holds for the pointer value
We accidentally used the store alignment for the value operand as well,
which is incorrect and crashed the SPASS application in the test suite.
diff --git a/llvm/lib/Transforms/IPO/Attributor.cpp b/llvm/lib/Transforms/IPO/Attributor.cpp
index baa1cb1..5eb21a0 100644
--- a/llvm/lib/Transforms/IPO/Attributor.cpp
+++ b/llvm/lib/Transforms/IPO/Attributor.cpp
@@ -3420,9 +3420,10 @@
}
const Value *UseV = U->get();
- if (auto *SI = dyn_cast<StoreInst>(I))
- Alignment = SI->getAlignment();
- else if (auto *LI = dyn_cast<LoadInst>(I))
+ if (auto *SI = dyn_cast<StoreInst>(I)) {
+ if (SI->getPointerOperand() == UseV)
+ Alignment = SI->getAlignment();
+ } else if (auto *LI = dyn_cast<LoadInst>(I))
Alignment = LI->getAlignment();
if (Alignment <= 1)