[llvm] [AMDGPU] Create local KnownBits in case DenseMap gets invalidated (PR #111568)
Matt Arsenault via llvm-commits
llvm-commits at lists.llvm.org
Wed Oct 9 07:59:15 PDT 2024
================
@@ -1,120 +1,144 @@
-; REQUIRES: asserts
-; RUN: llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx1030 -o - %s 2>&1 | FileCheck %s
+; RUN: llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx1030 < %s | FileCheck %s
-; CHECK-NOT: Assertion `BitWidth == RHS.BitWidth && "Bit widths must be same for comparison"' failed
+; Previously, this would hit an assertion on incompatible comparison between
+; APInts due to BitWidth differences. This was due to assignment of DenseMap
+; value using another value within that same DenseMap which results in a
+; use-after-free if the assignment operator invokes a DenseMap growth.
-define void @RunTic() {
- %call5.i1 = call i32 @G_CheckDemoStatus()
- tail call void @D_AdvanceDemo()
- call void @G_Ticker()
+; CHECK-LABEL: I_Quit:
+define void @I_Quit() {
+ %fptr = load ptr, ptr null, align 8
+ tail call void %fptr()
ret void
}
-define void @G_Ticker() {
- call void @G_DoReborn()
- tail call void @F_Ticker()
- tail call void @AM_Stop()
- tail call void @F_StartFinale()
- tail call void @D_AdvanceDemo()
- %call.i.i449 = call i32 @R_FlatNumForName()
- %call9.i.i = call i32 @R_TextureNumForName()
- %call.i306 = tail call ptr @P_TempSaveGameFile()
- %call1.i307 = call ptr @P_SaveGameFile()
- call void (...) @I_Error()
+; CHECK-LABEL: P_RemoveMobj:
+define void @P_RemoveMobj() {
ret void
}
-define void @G_DoReborn() {
- call void @P_RemoveMobj()
- call void @P_SpawnMobj()
- call void @P_SpawnPlayer()
- call void (...) @I_Error()
+; CHECK-LABEL: P_SpawnMobj:
+define void @P_SpawnMobj() {
ret void
}
-define void @AM_Stop() {
+; CHECK-LABEL: G_PlayerReborn:
+define void @G_PlayerReborn() {
ret void
}
-define void @D_AdvanceDemo() {
+; CHECK-LABEL: P_SetThingPosition:
+define void @P_SetThingPosition() {
ret void
}
-define void @F_StartFinale() {
+; CHECK-LABEL: P_SetupPsprites:
+define void @P_SetupPsprites(ptr addrspace(1) %i) {
+ %fptr = load ptr, ptr addrspace(1) %i, align 8
+ tail call void %fptr()
ret void
}
-define void @F_Ticker() {
+; CHECK-LABEL: HU_Start:
+define void @HU_Start() {
ret void
}
-define void @G_PlayerReborn() {
+; CHECK-LABEL: P_SpawnPlayer:
+define void @P_SpawnPlayer() {
+ call void @G_PlayerReborn()
+ call void @P_SetThingPosition()
+ call void @P_SetupPsprites(ptr addrspace(1) null)
+ tail call void @HU_Start()
ret void
}
-define i32 @G_CheckDemoStatus() {
- tail call void @I_Quit()
- tail call void @D_AdvanceDemo()
- call void (...) @I_Error()
- ret i32 0
-}
-
-define void @HU_Start() {
+; CHECK-LABEL: I_Error:
+define void @I_Error(...) {
+ %fptr = load ptr, ptr null, align 8
+ call void %fptr()
ret void
}
-define void @I_Quit() {
- %fptr = load ptr, ptr null, align 8
- tail call void %fptr()
+; CHECK-LABEL: G_DoReborn:
+define void @G_DoReborn() {
+ call void @P_RemoveMobj()
+ call void @P_SpawnMobj()
+ call void @P_SpawnPlayer()
+ call void (...) @I_Error()
ret void
}
-define void @P_SetThingPosition() {
+; CHECK-LABEL: AM_Stop:
+define void @AM_Stop() {
ret void
}
-define void @P_RemoveMobj() {
+; CHECK-LABEL: D_AdvanceDemo:
+define void @D_AdvanceDemo() {
ret void
}
-define void @P_SpawnMobj() {
+; CHECK-LABEL: F_StartFinale:
+define void @F_StartFinale() {
ret void
}
-define void @P_SpawnPlayer() {
- call void @G_PlayerReborn()
- call void @P_SetThingPosition()
- call void @P_SetupPsprites(ptr addrspace(1) null)
- tail call void @HU_Start()
+; CHECK-LABEL: F_Ticker:
+define void @F_Ticker() {
ret void
}
-define void @P_SetupPsprites(ptr addrspace(1) %i) {
- %fptr = load ptr, ptr addrspace(1) %i, align 8
- tail call void %fptr()
- ret void
+; CHECK-LABEL: G_CheckDemoStatus:
+define i32 @G_CheckDemoStatus() {
+ tail call void @I_Quit()
+ tail call void @D_AdvanceDemo()
+ call void (...) @I_Error()
+ ret i32 0
}
+
+; CHECK-LABEL: P_TempSaveGameFile:
define ptr @P_TempSaveGameFile() {
ret ptr null
}
+; CHECK-LABEL: P_SaveGameFile:
define ptr @P_SaveGameFile() {
ret ptr null
}
+; CHECK-LABEL: R_FlatNumForName:
+define i32 @R_FlatNumForName() {
+ call void (...) @I_Error()
+ unreachable
+}
+
+; CHECK-LABEL: R_TextureNumForName:
define i32 @R_TextureNumForName() {
%ret = call i32 @R_FlatNumForName()
ret i32 0
}
-define void @I_Error(...) {
- %fptr = load ptr, ptr null, align 8
- call void %fptr()
+; CHECK-LABEL: G_Ticker:
+define void @G_Ticker() {
+ call void @G_DoReborn()
+ tail call void @F_Ticker()
+ tail call void @AM_Stop()
+ tail call void @F_StartFinale()
+ tail call void @D_AdvanceDemo()
+ %call.i.i449 = call i32 @R_FlatNumForName()
+ %call9.i.i = call i32 @R_TextureNumForName()
+ %call.i306 = tail call ptr @P_TempSaveGameFile()
+ %call1.i307 = call ptr @P_SaveGameFile()
+ call void (...) @I_Error()
ret void
}
-define i32 @R_FlatNumForName() {
- call void (...) @I_Error()
- unreachable
+; CHECK-LABEL: RunTic:
+define void @RunTic() {
+ %call5.i1 = call i32 @G_CheckDemoStatus()
+ tail call void @D_AdvanceDemo()
+ call void @G_Ticker()
+ ret void
}
----------------
arsenm wrote:
Check resource limits?
https://github.com/llvm/llvm-project/pull/111568
More information about the llvm-commits
mailing list