File tree Expand file tree Collapse file tree 1 file changed +9
-0
lines changed
llvm/lib/Transforms/Scalar Expand file tree Collapse file tree 1 file changed +9
-0
lines changed Original file line number Diff line number Diff line change 31
31
#include " llvm/IR/Constants.h"
32
32
#include " llvm/IR/Dominators.h"
33
33
#include " llvm/IR/Function.h"
34
+ #include " llvm/IR/IRBuilder.h"
34
35
#include " llvm/IR/InstrTypes.h"
35
36
#include " llvm/IR/Instruction.h"
36
37
#include " llvm/IR/Instructions.h"
@@ -1588,6 +1589,14 @@ bool EarlyCSE::processNode(DomTreeNode *Node) {
1588
1589
if (InVal.IsLoad )
1589
1590
if (auto *I = dyn_cast<Instruction>(Op))
1590
1591
combineMetadataForCSE (I, &Inst, false );
1592
+ if (auto *AlignMD = Inst.getMetadata (LLVMContext::MD_align)) {
1593
+ auto *A = mdconst::extract<ConstantInt>(AlignMD->getOperand (0 ));
1594
+ if (Op->getPointerAlignment (SQ.DL ).value () % A->getZExtValue () != 0 ) {
1595
+ IRBuilder B (&Inst);
1596
+ B.CreateAlignmentAssumption (SQ.DL , Op, A);
1597
+ }
1598
+ }
1599
+
1591
1600
if (!Inst.use_empty ())
1592
1601
Inst.replaceAllUsesWith (Op);
1593
1602
salvageKnowledge (&Inst, &AC);
You can’t perform that action at this time.
0 commit comments