Skip to content

Commit 1c1aae7

Browse files
committed
Revert basictest.ll changes and DL check
1 parent d68d923 commit 1c1aae7

File tree

4 files changed

+11
-18
lines changed

4 files changed

+11
-18
lines changed

llvm/include/llvm/IR/Instructions.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -252,8 +252,7 @@ class LoadInst : public UnaryInstruction {
252252

253253
/// Returns false if this type would be invalid in the
254254
/// creation of a load atomic instruction.
255-
static bool isValidAtomicTy(Type *Ty, const DataLayout &DL,
256-
AtomicOrdering AO = AtomicOrdering::NotAtomic);
255+
static bool isValidAtomicTy(Type *Ty);
257256

258257
Value *getPointerOperand() { return getOperand(0); }
259258
const Value *getPointerOperand() const { return getOperand(0); }

llvm/lib/IR/Instructions.cpp

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1247,14 +1247,10 @@ void LoadInst::AssertOK() {
12471247
"Ptr must have pointer type.");
12481248
}
12491249

1250-
bool LoadInst::isValidAtomicTy(Type *Ty, const DataLayout &DL,
1251-
AtomicOrdering AO) {
1250+
bool LoadInst::isValidAtomicTy(Type *Ty) {
12521251
if (!Ty->isIntOrPtrTy() && !Ty->isFloatingPointTy())
12531252
return false;
1254-
if (AO == AtomicOrdering::Release || AO == AtomicOrdering::AcquireRelease)
1255-
return false;
1256-
unsigned Size = DL.getTypeSizeInBits(Ty);
1257-
return Size >= 8 && !(Size & (Size - 1));
1253+
return true;
12581254
}
12591255

12601256
static Align computeLoadStoreDefaultAlign(Type *Ty, InsertPosition Pos) {

llvm/lib/Transforms/Scalar/SROA.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2855,8 +2855,7 @@ class AllocaSliceRewriter : public InstVisitor<AllocaSliceRewriter, bool> {
28552855
LLVM_DEBUG(dbgs() << " original: " << LI << "\n");
28562856

28572857
// load atomic vector would be generated, which is illegal
2858-
if (LI.isAtomic() &&
2859-
!LoadInst::isValidAtomicTy(NewAI.getAllocatedType(), DL))
2858+
if (LI.isAtomic() && !LoadInst::isValidAtomicTy(NewAI.getAllocatedType()))
28602859
return false;
28612860

28622861
Value *OldOp = LI.getOperand(0);

llvm/test/Transforms/SROA/basictest.ll

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1332,10 +1332,10 @@ define void @PR15674(ptr %data, ptr %src, i32 %size) {
13321332
; CHECK-NEXT: entry:
13331333
; CHECK-NEXT: [[TMP_SROA_0:%.*]] = alloca i32, align 4
13341334
; CHECK-NEXT: switch i32 [[SIZE:%.*]], label [[END:%.*]] [
1335-
; CHECK-NEXT: i32 4, label [[BB4:%.*]]
1336-
; CHECK-NEXT: i32 3, label [[BB3:%.*]]
1337-
; CHECK-NEXT: i32 2, label [[BB2:%.*]]
1338-
; CHECK-NEXT: i32 1, label [[BB1:%.*]]
1335+
; CHECK-NEXT: i32 4, label [[BB4:%.*]]
1336+
; CHECK-NEXT: i32 3, label [[BB3:%.*]]
1337+
; CHECK-NEXT: i32 2, label [[BB2:%.*]]
1338+
; CHECK-NEXT: i32 1, label [[BB1:%.*]]
13391339
; CHECK-NEXT: ]
13401340
; CHECK: bb4:
13411341
; CHECK-NEXT: [[SRC_GEP3:%.*]] = getelementptr inbounds i8, ptr [[SRC:%.*]], i32 3
@@ -1971,7 +1971,7 @@ bb7:
19711971
define i32 @load_atomic_volatile_past_end() {
19721972
; CHECK-LABEL: @load_atomic_volatile_past_end(
19731973
; CHECK-NEXT: [[A:%.*]] = alloca i1, align 1
1974-
; CHECK-NEXT: [[A_0_V:%.*]] = load atomic volatile i32, ptr [[A]] seq_cst, align 4
1974+
; CHECK-NEXT: [[A_0_V:%.*]] = load atomic volatile i32, ptr [[A]] seq_cst, align 1
19751975
; CHECK-NEXT: ret i32 [[A_0_V]]
19761976
;
19771977
%a = alloca i1, align 1
@@ -1992,9 +1992,8 @@ define i32 @load_volatile_past_end() {
19921992

19931993
define i32 @load_atomic_past_end() {
19941994
; CHECK-LABEL: @load_atomic_past_end(
1995-
; CHECK-NEXT: [[A:%.*]] = alloca i1, align 1
1996-
; CHECK-NEXT: [[V:%.*]] = load atomic i32, ptr [[A]] seq_cst, align 4
1997-
; CHECK-NEXT: ret i32 [[V]]
1995+
; CHECK-NEXT: [[A_0_LOAD_EXT:%.*]] = zext i1 undef to i32
1996+
; CHECK-NEXT: ret i32 [[A_0_LOAD_EXT]]
19981997
;
19991998
%a = alloca i1, align 1
20001999
%v = load atomic i32, ptr %a seq_cst, align 4

0 commit comments

Comments
 (0)