[llvm] [HEXAGON] AddrModeOpt support for HVX and optmize adds (PR #106368)
Brian Cain via llvm-commits
llvm-commits at lists.llvm.org
Thu Aug 29 08:03:23 PDT 2024
================
@@ -0,0 +1,232 @@
+# It is not safe to make the transformation if the definition is killed by a call.
+# Use debug output for simplicity and test resilience.
+#
+# RUN: llc -march=hexagon -run-pass amode-opt %s -debug -o %t_1.mir 2>&1 | FileCheck %s
+#CHECK: The LRExtReg reg {{.*}} is NOT live in to MBB
+--- |
+ ; ModuleID = 'foo.reduced.i'
+ source_filename = "foo.reduced.i"
+ target datalayout = "e-m:e-p:32:32:32-a:0-n16:32-i64:64:64-i32:32:32-i16:16:16-i1:8:8-f32:32:32-f64:64:64-v32:32:32-v64:64:64-v512:512:512-v1024:1024:1024-v2048:2048:2048"
+ target triple = "hexagon-unknown-unknown-elf"
+
+ %struct.struct_1 = type { i8, i8, [7 x %struct.struct_3] }
+ %struct.struct_3 = type { i8, %struct.struct_4 }
+ %struct.struct_4 = type { i32, i32 }
+ %struct.struct_2 = type { i32, i32 }
+
+ ; Function Attrs: nounwind
+ define dso_local zeroext i8 @fun_4(i32 noundef %arg_1, i8 noundef zeroext %arg_2, ptr nocapture noundef readonly %arg_3, ptr nocapture noundef readonly %arg_4) local_unnamed_addr #0 {
+ entry:
+ %conv = zext i8 %arg_2 to i32
+ %cmp = icmp ult i8 %arg_2, 7
+ br i1 %cmp, label %if.then, label %if.end
+
+ if.then: ; preds = %entry
+ tail call void @fun_2(ptr noundef null, i32 noundef %conv) #3
+ unreachable
+
+ if.end: ; preds = %entry
+ %cgep = getelementptr inbounds %struct.struct_1, ptr %arg_3, i32 0, i32 2, i32 %conv
+ %cgep23 = getelementptr inbounds %struct.struct_3, ptr %cgep, i32 0, i32 1, i32 1
+ %0 = load i32, ptr %cgep23, align 4
+ %cmp3 = icmp eq i32 %0, 4
+ br i1 %cmp3, label %land.lhs.true, label %if.else
+
+ land.lhs.true: ; preds = %if.end
+ %cgep22 = getelementptr inbounds %struct.struct_3, ptr %cgep, i32 0, i32 1
+ %1 = load i32, ptr %cgep22, align 4
+ %call = tail call zeroext i8 @fun_5(i32 noundef %arg_1, i32 noundef %1) #4
+ %tobool.not = icmp eq i8 %call, 0
+ br i1 %tobool.not, label %if.else, label %if.end12
+
+ if.else: ; preds = %land.lhs.true, %if.end
+ %2 = load i8, ptr %cgep, align 4
+ %cmp.i = icmp eq i8 %2, 1
+ br i1 %cmp.i, label %if.then.i, label %fun_3.exit
+
+ if.then.i: ; preds = %if.else
+ %cgep2027 = bitcast ptr %arg_4 to ptr
+ %cgep26 = getelementptr inbounds %struct.struct_2, ptr %cgep2027, i32 0, i32 1
+ %3 = load i32, ptr %cgep26, align 4
+ %call.i = tail call i32 @fun_1(i32 noundef %arg_1) #4
+ %cmp2.i = icmp ult i32 %3, %call.i
+ %cgep25 = getelementptr inbounds %struct.struct_2, ptr %cgep2027, i32 0, i32 1
+ %4 = load i32, ptr %cgep25, align 4
+ %call6.i = tail call i32 @fun_1(i32 noundef %arg_1) #4
+ %cmp7.i = icmp ult i32 %4, %call6.i
+ %5 = select i1 %cmp2.i, i1 true, i1 %cmp7.i
+ br label %fun_3.exit
+
+ fun_3.exit: ; preds = %if.else, %if.then.i
+ %resume_ttl.1.i = phi i1 [ false, %if.else ], [ %5, %if.then.i ]
+ %conv15.i = zext i1 %resume_ttl.1.i to i8
+ br label %if.end12
+
+ if.end12: ; preds = %land.lhs.true, %fun_3.exit
+ %resume_loops.0 = phi i8 [ %conv15.i, %fun_3.exit ], [ 1, %land.lhs.true ]
+ ret i8 %resume_loops.0
+ }
+
+ ; Function Attrs: noreturn
+ declare dso_local void @fun_2(ptr noundef, i32 noundef) local_unnamed_addr #1
+
+ declare dso_local zeroext i8 @fun_5(i32 noundef, i32 noundef) local_unnamed_addr #2
+
+ declare dso_local i32 @fun_1(i32 noundef) local_unnamed_addr #2
+
+ !llvm.module.flags = !{!0, !1}
+ !llvm.ident = !{!2}
+
+ !0 = !{i32 1, !"wchar_size", i32 4}
+ !1 = !{i32 7, !"frame-pointer", i32 2}
+ !2 = !{!"QuIC LLVM Hexagon Clang version 8.9 Engineering Release: hexagon-clang-89"}
----------------
androm3da wrote:
This string can probably be omitted from the test case.
https://github.com/llvm/llvm-project/pull/106368
More information about the llvm-commits
mailing list