Relax the check to allow evaluation of atomic stores
(but still skip volatile stores).
Test plan:
1/ ninja check-llvm check-clang
2/ Bootstrapped LLVM/Clang pass tests
Differential revision: https://reviews.llvm.org/D129841
LLVM_DEBUG(dbgs() << "Evaluating Instruction: " << *CurInst << "\n");
if (StoreInst *SI = dyn_cast<StoreInst>(CurInst)) {
- if (!SI->isSimple()) {
- LLVM_DEBUG(dbgs() << "Store is not simple! Can not evaluate.\n");
- return false; // no volatile/atomic accesses.
+ if (SI->isVolatile()) {
+ LLVM_DEBUG(dbgs() << "Store is volatile! Can not evaluate.\n");
+ return false; // no volatile accesses.
}
Constant *Ptr = getVal(SI->getOperand(1));
Constant *FoldedPtr = ConstantFoldConstant(Ptr, DL, TLI);
@Z = global i32 123 ; <i32*> [#uses=1]
@D = global double 0.000000e+00 ; <double*> [#uses=1]
@CTORGV = internal global i1 false ; <i1*> [#uses=2]
+@GA = global i32 0 ; <i32*> [#uses=1]
define internal void @CTOR1() {
ret void
define internal void @CTOR12() {
ret void
}
+
+; CHECK-NOT: CTOR13
+define internal void @CTOR13() {
+ store atomic i32 123, i32* @GA seq_cst, align 4
+ ret void
+}