[llvm] 1a97138 - Add test case from 356ada9
Philip Reames via llvm-commits
llvm-commits at lists.llvm.org
Wed Jan 5 11:19:22 PST 2022
Author: Philip Reames
Date: 2022-01-05T11:19:16-08:00
New Revision: 1a97138a1c98501d2f0c5e38426dc3544bd49394
URL: https://github.com/llvm/llvm-project/commit/1a97138a1c98501d2f0c5e38426dc3544bd49394
DIFF: https://github.com/llvm/llvm-project/commit/1a97138a1c98501d2f0c5e38426dc3544bd49394.diff
LOG: Add test case from 356ada9
Added:
Modified:
llvm/test/Transforms/InstCombine/sink_sideeffecting_instruction.ll
Removed:
################################################################################
diff --git a/llvm/test/Transforms/InstCombine/sink_sideeffecting_instruction.ll b/llvm/test/Transforms/InstCombine/sink_sideeffecting_instruction.ll
index 8d0259df0392..d218d7871cbe 100644
--- a/llvm/test/Transforms/InstCombine/sink_sideeffecting_instruction.ll
+++ b/llvm/test/Transforms/InstCombine/sink_sideeffecting_instruction.ll
@@ -446,6 +446,33 @@ use_block:
ret i32 %var3
}
+; Mostly checking that trying to sink a non-call doesn't crash (i.e. prior bug)
+define i32 @sink_atomicrmw_to_use(i1 %c) {
+; CHECK-LABEL: @sink_atomicrmw_to_use(
+; CHECK-NEXT: entry:
+; CHECK-NEXT: [[VAR:%.*]] = alloca i32, align 4
+; CHECK-NEXT: store i32 0, i32* [[VAR]], align 4
+; CHECK-NEXT: [[VAR3:%.*]] = atomicrmw add i32* [[VAR]], i32 1 seq_cst, align 4
+; CHECK-NEXT: br i1 [[C:%.*]], label [[EARLY_RETURN:%.*]], label [[USE_BLOCK:%.*]]
+; CHECK: early_return:
+; CHECK-NEXT: ret i32 0
+; CHECK: use_block:
+; CHECK-NEXT: ret i32 [[VAR3]]
+;
+entry:
+ %var = alloca i32, align 4
+ store i32 0, i32* %var
+ %var3 = atomicrmw add i32* %var, i32 1 seq_cst, align 4
+ br i1 %c, label %early_return, label %use_block
+
+early_return:
+ ret i32 0
+
+use_block:
+ ret i32 %var3
+}
+
+
declare i32 @bar()
declare void @llvm.lifetime.start.p0i8(i64 immarg, i8* nocapture)
declare void @llvm.lifetime.end.p0i8(i64 immarg, i8* nocapture)
More information about the llvm-commits
mailing list