mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2026-04-21 08:17:40 +00:00
AllocaInst can't return a null pointer. Fixes missed optimization
opportunity pointed out by Andrew Lewycky. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@31115 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -31,6 +31,7 @@
|
||||
#define DEBUG_TYPE "predsimplify"
|
||||
#include "llvm/Transforms/Scalar.h"
|
||||
#include "llvm/Constants.h"
|
||||
#include "llvm/DerivedTypes.h"
|
||||
#include "llvm/Instructions.h"
|
||||
#include "llvm/Pass.h"
|
||||
#include "llvm/ADT/Statistic.h"
|
||||
@@ -446,6 +447,7 @@ namespace {
|
||||
void visitBranchInst(BranchInst &BI);
|
||||
void visitSwitchInst(SwitchInst &SI);
|
||||
|
||||
void visitAllocaInst(AllocaInst &AI);
|
||||
void visitLoadInst(LoadInst &LI);
|
||||
void visitStoreInst(StoreInst &SI);
|
||||
void visitBinaryOperator(BinaryOperator &BO);
|
||||
@@ -712,6 +714,10 @@ void PredicateSimplifier::Forwards::visitSwitchInst(SwitchInst &SI) {
|
||||
}
|
||||
}
|
||||
|
||||
void PredicateSimplifier::Forwards::visitAllocaInst(AllocaInst &AI) {
|
||||
KP.addNotEqual(Constant::getNullValue(AI.getType()), &AI);
|
||||
}
|
||||
|
||||
void PredicateSimplifier::Forwards::visitLoadInst(LoadInst &LI) {
|
||||
Value *Ptr = LI.getPointerOperand();
|
||||
KP.addNotEqual(Constant::getNullValue(Ptr->getType()), Ptr);
|
||||
|
||||
Reference in New Issue
Block a user