-
Notifications
You must be signed in to change notification settings - Fork 10.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Metarenamer] Introduce option to only change inst names
This is useful when needing to modify IR and test some optimizations on them, while keeping BB names and function names intact. If the IR uses ordered number naming (%1, %2, %3 etc), then we cannot just remove or reorder specific instructions since the verifier expects the numbers to be in order.
- Loading branch information
1 parent
a5ea676
commit 6f9e743
Showing
2 changed files
with
64 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
; RUN: opt -passes=metarenamer -rename-only-inst=1 -S < %s | FileCheck %s | ||
target triple = "x86_64-pc-linux-gnu" | ||
|
||
; CHECK: %struct.foo_xxx = type { i32, float, %struct.bar_xxx } | ||
; CHECK: %struct.bar_xxx = type { i32, double } | ||
%struct.bar_xxx = type { i32, double } | ||
%struct.foo_xxx = type { i32, float, %struct.bar_xxx } | ||
|
||
; CHECK: @global_3_xxx = common global | ||
@global_3_xxx = common global i32 0, align 4 | ||
|
||
; CHECK-LABEL: func_4_xxx | ||
; CHECK-NOT: %1 | ||
; CHECK-NOT: %2 | ||
; CHECK-NOT: %3 | ||
; CHECK-NOT: %4 | ||
define void @func_4_xxx(ptr sret(%struct.foo_xxx) %agg.result) nounwind uwtable ssp { | ||
%1 = alloca %struct.foo_xxx, align 8 | ||
store i32 1, ptr %1, align 4 | ||
%2 = getelementptr inbounds %struct.foo_xxx, ptr %1, i32 0, i32 1 | ||
store float 2.000000e+00, ptr %2, align 4 | ||
%3 = getelementptr inbounds %struct.foo_xxx, ptr %1, i32 0, i32 2 | ||
store i32 3, ptr %3, align 4 | ||
%4 = getelementptr inbounds %struct.bar_xxx, ptr %3, i32 0, i32 1 | ||
store double 4.000000e+00, ptr %4, align 8 | ||
call void @llvm.memcpy.p0.p0.i64(ptr align 8 %agg.result, ptr align 8 %1, i64 24, i1 false) | ||
ret void | ||
} | ||
|
||
declare void @llvm.memcpy.p0.p0.i64(ptr nocapture, ptr nocapture, i64, i1) nounwind |