File tree 1 file changed +5
-2
lines changed
llvm/lib/Transforms/Scalar
1 file changed +5
-2
lines changed Original file line number Diff line number Diff line change 16
16
#include " llvm/ADT/Hashing.h"
17
17
#include " llvm/ADT/STLExtras.h"
18
18
#include " llvm/ADT/ScopedHashTable.h"
19
+ #include " llvm/ADT/SetVector.h"
19
20
#include " llvm/ADT/SmallVector.h"
20
21
#include " llvm/ADT/Statistic.h"
21
22
#include " llvm/Analysis/AssumptionCache.h"
@@ -1607,9 +1608,11 @@ bool EarlyCSE::processNode(DomTreeNode *Node) {
1607
1608
// load with.
1608
1609
if (Inst.hasMetadata (LLVMContext::MD_noundef)) {
1609
1610
if (auto *AlignMD = Inst.getMetadata (LLVMContext::MD_align)) {
1611
+ Inst.setMetadata (LLVMContext::MD_align, nullptr );
1610
1612
auto *A = mdconst::extract<ConstantInt>(AlignMD->getOperand (0 ));
1611
- if (Op->getPointerAlignment (SQ.DL ).value () % A->getZExtValue () !=
1612
- 0 ) {
1613
+ auto KB = computeKnownBits (Op, SQ.DL );
1614
+ unsigned AlignFromKB = 1 << KB.countMinTrailingZeros ();
1615
+ if (AlignFromKB < A->getZExtValue ()) {
1613
1616
IRBuilder B (&Inst);
1614
1617
B.CreateAlignmentAssumption (SQ.DL , Op, A);
1615
1618
}
You can’t perform that action at this time.
0 commit comments